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

Partitioned table tests and fixed #9757

Merged
merged 8 commits into from
Oct 25, 2021

Conversation

findepi
Copy link
Member

@findepi findepi commented Oct 25, 2021

Includes

Convert from Iceberg to Trino representation strictly

Fills outstanding TODO in PartitionedTable.convert (method moved)

Fix handling of Iceberg timestamptz partition key

Before the change, partition key of timestamp with time zone type was
returned in session zone, unlike regular data columns. This caused
representability problems for values within session zone's DST change
backwards. This commit makes partition values to be returned with UTC
zone, just like regular data columns are.

Fixes #9704
Fixes #9703

@cla-bot cla-bot bot added the cla-signed label Oct 25, 2021
@findepi findepi force-pushed the findepi/iceberg-convert-carefully branch 2 times, most recently from 5c41002 to 0664901 Compare October 25, 2021 10:50
@findepi findepi changed the title Convert type representation strictly Partitioned table tests and fixed Oct 25, 2021
" 'a_short_decimal', " +
" 'a_long_decimal', " +
" 'a_varchar', " +
// " 'a_varbinary', " + TODO (https://github.com/trinodb/trino/issues/9755) this yields incorrect query results
Copy link
Member

Choose a reason for hiding this comment

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

when those are fixed it would be (maybe) nice to merge testCreatePartitionedTable and testAllAvailableTypes and just paramtrize with boolean partitioned.

Copy link
Member Author

Choose a reason for hiding this comment

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

yeah, maybe. the assertions will be different...

and since we already cover all iceberg types except "fixed", it won't add much more value

@findepi findepi force-pushed the findepi/iceberg-convert-carefully branch 2 times, most recently from 4c33ce5 to 93f35a7 Compare October 25, 2021 11:15
@@ -76,7 +75,7 @@ public static Object convertIcebergValueToTrino(Type icebergType, Object value)
if (icebergType instanceof Types.TimestampType) {
long epochMicros = (long) value;
if (((Types.TimestampType) icebergType).shouldAdjustToUTC()) {
return timestampTzFromMicros(epochMicros, TimeZoneKey.UTC_KEY);
return timestampTzFromMicros(epochMicros);
Copy link
Member

Choose a reason for hiding this comment

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

what does shouldAdjustToUTC mean here?

Copy link
Member Author

Choose a reason for hiding this comment

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

i think it means "this is timestamptz, not timestamp type".
seems the two are conflated into Types.TimestampType class

Since it's reused, it doesn't belong to `PartitionTable`.

This also sorts the cases in the method.
* merge `testPartitionedTableWithNullValues` into
  `testCreatePartitionedTable`. This not only reduces test verbosity,
  but also improves coverage for predicate application.
* synchronize `testAllAvailableTypes` and `testCreatePartitionedTable`
  -- use consistent column naming, use consistent style for SQL, use
  consistent test structure
* cover all supported types in these tests
* exercise time/timestamp microsecond precision
This also adds test coverage for `SHOW STATS` and `$partitions` for all
types in Iceberg.
Do not assume that unrecognized type has same Iceberg and Trino
representation, under all circumstances.
Before the change, partition key of `timestamp with time zone` type was
returned in session zone, unlike regular data columns. This caused
representability  problems for values within session zone's DST change
backwards. This commit makes partition values to be returned with UTC
zone, just like regular data columns are.
@findepi findepi force-pushed the findepi/iceberg-convert-carefully branch from d43ec65 to 73e214b Compare October 25, 2021 15:37
@findepi
Copy link
Member Author

findepi commented Oct 25, 2021

previous CI run -- #8432

@findepi findepi merged commit 79ab945 into trinodb:master Oct 25, 2021
@findepi findepi deleted the findepi/iceberg-convert-carefully branch October 25, 2021 19:53
@findepi findepi mentioned this pull request Oct 25, 2021
12 tasks
@github-actions github-actions bot added this to the 364 milestone Oct 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
3 participants