Skip to content

Commit

Permalink
Set allow_suspicious_low_cardinality_types for LowCardinality tests
Browse files Browse the repository at this point in the history
This setting has been introduced in v19.9.2.4-stable (all previous tags
marked as -testing, so I think they should be skipped).

Refs: ClickHouse/ClickHouse@4819a34
Refs: ClickHouse/ClickHouse#5448
  • Loading branch information
azat committed Oct 15, 2019
1 parent 61f25ee commit 38dcaa3
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 11 deletions.
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
env:
- VERSION=19.8.3.8 # SimpleAggregateFunction
- VERSION=19.15.3.6 # latest
- VERSION=19.9.2.4 # allow_suspicious_low_cardinality_types
- VERSION=19.8.3.8 # SimpleAggregateFunction
- VERSION=19.3.3
- VERSION=18.12.17
- VERSION=18.12.13
Expand Down
28 changes: 18 additions & 10 deletions tests/columns/test_low_cardinality.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,17 @@


class LowCardinalityTestCase(BaseTestCase):
stable_support_version = (19, 9, 2)

def cli_client_kwargs(self):
current = self.client.connection.server_info.version_tuple()
if current >= self.stable_support_version:
return {'allow_suspicious_low_cardinality_types': 1}
return {}

@require_server_version(19, 3, 3)
def test_uint8(self):
with self.create_table('a LowCardinality(UInt8)'):
with self.create_table('a LowCardinality(UInt8)', **self.cli_client_kwargs()):
data = [(x, ) for x in range(255)]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -24,7 +32,7 @@ def test_uint8(self):

@require_server_version(19, 3, 3)
def test_int8(self):
with self.create_table('a LowCardinality(Int8)'):
with self.create_table('a LowCardinality(Int8)', **self.cli_client_kwargs()):
data = [(x - 127, ) for x in range(255)]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -41,7 +49,7 @@ def test_int8(self):

@require_server_version(19, 3, 3)
def test_nullable_int8(self):
with self.create_table('a LowCardinality(Nullable(Int8))'):
with self.create_table('a LowCardinality(Nullable(Int8))', **self.cli_client_kwargs()):
data = [(None, ), (-1, ), (0, ), (1, ), (None, )]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -54,7 +62,7 @@ def test_nullable_int8(self):

@require_server_version(19, 3, 3)
def test_date(self):
with self.create_table('a LowCardinality(Date)'):
with self.create_table('a LowCardinality(Date)', **self.cli_client_kwargs()):
start = date(1970, 1, 1)
data = [(start + timedelta(x), ) for x in range(300)]
self.client.execute('INSERT INTO test (a) VALUES', data)
Expand All @@ -65,7 +73,7 @@ def test_date(self):

@require_server_version(19, 3, 3)
def test_float(self):
with self.create_table('a LowCardinality(Float)'):
with self.create_table('a LowCardinality(Float)', **self.cli_client_kwargs()):
data = [(float(x),) for x in range(300)]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -75,7 +83,7 @@ def test_float(self):

@require_server_version(19, 3, 3)
def test_decimal(self):
with self.create_table('a LowCardinality(Float)'):
with self.create_table('a LowCardinality(Float)', **self.cli_client_kwargs()):
data = [(Decimal(x),) for x in range(300)]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -85,7 +93,7 @@ def test_decimal(self):

@require_server_version(19, 3, 3)
def test_array(self):
with self.create_table('a Array(LowCardinality(Int16))'):
with self.create_table('a Array(LowCardinality(Int16))', **self.cli_client_kwargs()):
data = [((100, 500), )]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -98,7 +106,7 @@ def test_array(self):

@require_server_version(19, 3, 3)
def test_empty_array(self):
with self.create_table('a Array(LowCardinality(Int16))'):
with self.create_table('a Array(LowCardinality(Int16))', **self.cli_client_kwargs()):
data = [(tuple(), )]
self.client.execute('INSERT INTO test (a) VALUES', data)

Expand All @@ -111,7 +119,7 @@ def test_empty_array(self):

@require_server_version(19, 3, 3)
def test_string(self):
with self.create_table('a LowCardinality(String)'):
with self.create_table('a LowCardinality(String)', **self.cli_client_kwargs()):
data = [
('test', ), ('low', ), ('cardinality', ),
('test', ), ('test', ), ('', )
Expand All @@ -130,7 +138,7 @@ def test_string(self):

@require_server_version(19, 3, 3)
def test_fixed_string(self):
with self.create_table('a LowCardinality(FixedString(12))'):
with self.create_table('a LowCardinality(FixedString(12))', **self.cli_client_kwargs()):
data = [
('test', ), ('low', ), ('cardinality', ),
('test', ), ('test', ), ('', )
Expand Down

0 comments on commit 38dcaa3

Please sign in to comment.