-
Notifications
You must be signed in to change notification settings - Fork 3.4k
Extend automatic type coercion support in Iceberg table creation to char #21515
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
Extend automatic type coercion support in Iceberg table creation to char #21515
Conversation
|
https://github.com/trinodb/trino/actions/runs/8646870078/job/23709683367?pr=21515 |
plugin/trino-iceberg/src/main/java/io/trino/plugin/iceberg/IcebergMetadata.java
Outdated
Show resolved
Hide resolved
e3447a8 to
b52bd02
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testDataMappingSmokeTest.DataMappingTestSetup("char(3)", "'ab'", "'zzz'") is failing due to the fact that char is padded upon coercion:
CREATE TABLE test_data_mapping_smoke_char_3_63hssk8sp8
AS SELECT CAST(row_id AS varchar(50)) row_id, CAST(value AS char(3)) value, CAST(value AS char(3)) another_column
FROM (VALUES ('null value', NULL), ('sample value', 'ab'), ('high value', 'zzz')) t(row_id, value);
DESCRIBE test_data_mapping_smoke_char_3_63hssk8sp8;
-- MaterializedResult{rows=[[row_id, varchar, , ], [value, varchar, , ], [another_column, varchar, , ]]}
SELECT value FROM test_data_mapping_smoke_char_3_63hssk8sp8;
-- value='ab '
-- from assertion:
SELECT row_id FROM test_data_mapping_smoke_char_3_63hssk8sp8 WHERE rand() = 42 OR value = 'ab'
-- and expect VALUES 'sample value' -> failure as 'ab' != 'ab 'Changing it here breaks it for other connectors:
Error: TestClickHouseConnectorTest>BaseConnectorTest.testDataMappingSmokeTest:5556->BaseConnectorTest.testDataMapping:5590->AbstractTestQueryFramework.assertQuery:350 For query 20240415_123625_02027_285wm:
SELECT row_id FROM test_data_mapping_smoke_char_3_mhz2ny6ak4 WHERE rand() = 42 OR value = 'ab '
not equal
Actual rows (up to 100 of 0 extra rows shown, 0 rows in total):
Expected rows (up to 100 of 1 missing rows shown, 1 rows in total):
[sample value]
I will use filterDataMappingSmokeTestData and change 'ab' -> 'ab ' just for Iceberg tests.
b52bd02 to
c9020c2
Compare
plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java
Outdated
Show resolved
Hide resolved
8dcd6d9 to
7df5801
Compare
plugin/trino-iceberg/src/test/java/io/trino/plugin/iceberg/BaseIcebergConnectorTest.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
SGTM
Similar to trinodb#13981, extend type coercion support to char type.
7df5801 to
855056f
Compare
Similar to trinodb#21515, extend type coercion support to char type.
Similar to trinodb#21515, extend type coercion support to char type.
Similar to #21515, extend type coercion support to char type.
Description
chartypeAdditional context and related issues
#13981
#20611
Release notes
( ) This is not user-visible or is docs only, and no release notes are required.
( ) Release notes are required. Please propose a release note for me.
( ) Release notes are required, with the following suggested text: