Skip to content

Conversation

@bpblanken
Copy link
Collaborator

No description provided.

@bpblanken bpblanken marked this pull request as ready for review October 20, 2025 19:31
@bpblanken bpblanken requested a review from a team as a code owner October 20, 2025 19:31
)[0]


def normalize_partition(partition: str) -> tuple:
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

when fetching the partition ids from the system table, they come out as a string representation of a tuple OR just the raw string. It's unfortunate and I couldn't find a cleaner way to do this within clickhouse.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do SELECT tuple(partition) does that force it to be consistent, or no?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It doesn't:

wmbbe-67c :) select tuple(partition), toTypeName(partition), toTypeName(tuple(partition)) FROM system.parts where table = 'my_table';

SELECT
    tuple(partition),
    toTypeName(partition),
    toTypeName(tuple(partition))
FROM system.parts
WHERE `table` = 'my_table'

Query id: eaea3ec0-b4ce-46f5-8411-f8e69133dfd3

   ┌─(partition)────┬─toTypeName(partition)─┬─toTypeName((partition))─┐
1. │ ('1')          │ String                │ Tuple(String)           │
2. │ ('1')          │ String                │ Tuple(String)           │
3. │ ('(\'90\',1)') │ String                │ Tuple(String)           │
4. │ ('(\'93\',3)') │ String                │ Tuple(String)           │
5. │ ('(\'91\',2)') │ String                │ Tuple(String)           │
   └────────────────┴───────────────────────┴─────────────────────────┘

5 rows in set. Elapsed: 0.001 sec.

And it actually gets worse.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😢

f"""
INSERT INTO {table_name_builder.staging_dst_table(ClickHouseTable.ENTRIES)}
SELECT *
INSERT INTO {table_name_builder.staging_dst_table(ClickHouseTable.ENTRIES)} ({dst_list})
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

INSERT INTO SELECT * fails with columns misalignment. We really want INSERT EXCEPT (...)... which isn't supported though SELECT EXCEPT is.

)
self.assertCountEqual(gt_stats, [(1, 0)])

def test_repartitioned_entries_table(self):
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the existing tests cover the existing partitioning structure.

)[0]


def normalize_partition(partition: str) -> tuple:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you do SELECT tuple(partition) does that force it to be consistent, or no?

…es into benb/support_alternate_partitionings
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants