Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test dynamic column names in resultsets with less partitions created #346

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 14 additions & 19 deletions tests/bwc/test_upgrade.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,12 @@
) PARTITIONED BY (version) CLUSTERED INTO 1 SHARDS
'''

CREATE_DYNAMIC_TABLE = '''
CREATE TABLE dynamic (
o object
) CLUSTERED INTO 1 SHARDS
WITH (column_policy = 'dynamic', number_of_replicas = 0)
'''

CREATE_DOC_TABLE = '''
CREATE TABLE t1 (
Expand Down Expand Up @@ -305,26 +311,15 @@ def assert_data_persistence(self,
cursor.execute(f'select * from versioned."{table}"')
cursor.execute(f'insert into versioned."{table}" (id, col_int) values (?, ?)', [str(uuid4()), 1])

# to trigger `alter` stmt bug(https://github.com/crate/crate/pull/17178) that falsely updated the table's
# version created setting that resulted in oids instead of column names in resultsets
cursor.execute('ALTER TABLE doc.parted SET ("refresh_interval" = 900)')

# older versions had a bug that caused this to fail
# Test that partition and dynamic columns can be created
key = "t_" + version.replace('.', '_')
obj = {key: True}
args = (str(uuid4()), version, obj)
cursor.execute(
'INSERT INTO doc.parted (id, version, cols) VALUES (?, ?, ?)',
args
)
cursor.execute('REFRESH TABLE doc.parted')
accumulated_dynamic_column_names.append(key)
cursor.execute('SELECT cols FROM doc.parted')
result = cursor.fetchall()
for row in result:
for name in row[0].keys():
self.assertIn(name, accumulated_dynamic_column_names)
if version in ('latest-nightly', '3.2'):
# Test that partition and dynamic columns can be created
obj = {"t_" + version.replace('.', '_'): True}
args = (str(uuid4()), version, obj)
cursor.execute(
'INSERT INTO doc.parted (id, version, cols) values (?, ?, ?)',
args
)
self._process_on_stop()

def assert_green(self, conn: Connection, schema: str, table_name: str):
Expand Down