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

Fix Delta INSERT when schema OR table location ends with two slashes #17980

Merged
merged 8 commits into from
Jun 21, 2023

Conversation

findepi
Copy link
Member

@findepi findepi commented Jun 20, 2023

Extracted from #17958

For #17966, but does not fix it fully.

@cla-bot cla-bot bot added the cla-signed label Jun 20, 2023
@findepi findepi changed the title Findepi/delta trailing slashes Fix Delta writes when schema location ends with two slashes Jun 20, 2023
@github-actions github-actions bot added delta-lake Delta Lake connector hive Hive connector iceberg Iceberg connector tests:hive labels Jun 20, 2023
findepi added 6 commits June 20, 2023 23:24
Configure bucket used in `TestIcebergS3AndGlueMetastoreTest` same way as
in other `BaseS3AndGlueMetastoreTest` subclasses. Makes it easier to run
tests locally.

This also changes `TestIcebergGlueCatalogConnectorSmokeTest` for
consistency.
This may be needed when working with MinIO containers where bucket names
can be reused. This is not needed when working with real S3 where bucket
names are unique. Also, it's unclear whether this is a safe operation
when tests execute in parallel.
The `String.contains`-based inclusions/exclusions doesn't allow
distinguishing between hypothetical cases like "trailing_slash" and
"two_trailing_slashes".

This also simplifies generated test locations for schemas. Previously
the schema name was formatted twice into the location string.
Remove constructor which doesn't construct the table.
Since it was randomizing the name, it couldn't even be used for dropping
existing table.
Use try with resources to ensure that test tables are dropped even if
an assertion fails.
@findepi findepi force-pushed the findepi/delta-trailing-slashes branch from ea91f94 to 29963d1 Compare June 20, 2023 21:25
Copy link
Member

@ebyhr ebyhr left a comment

Choose a reason for hiding this comment

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

Looks good except for CI failures.

Comment on lines 164 to 165
// Hive normalizes double slash
.replaceAll("(?<!(s3:))/+", "/");
Copy link
Member

Choose a reason for hiding this comment

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

nit: double slash → multiple slash?

@findinpath
Copy link
Contributor

Build is 🔴

Error:  io.trino.plugin.deltalake.metastore.glue.TestDeltaS3AndGlueMetastoreTest.testBasicOperationsWithProvidedTableLocation[true, TWO_TRAILING_SLASHES](3)  Time elapsed: 2.974 s  <<< FAILURE!
java.lang.AssertionError: 

Expecting code to raise a throwable.
	at io.trino.plugin.hive.BaseS3AndGlueMetastoreTest.testBasicOperationsWithProvidedTableLocation(BaseS3AndGlueMetastoreTest.java:110)
Error:  io.trino.plugin.deltalake.metastore.glue.TestDeltaS3AndGlueMetastoreTest.testBasicOperationsWithProvidedTableLocation[true, TWO_TRAILING_SLASHES](3)  Time elapsed: 2.974 s  <<< FAILURE!
java.lang.AssertionError: 

Expecting code to raise a throwable.
	at io.trino.plugin.hive.BaseS3AndGlueMetastoreTest.testBasicOperationsWithProvidedTableLocation(BaseS3AndGlueMetastoreTest.java:110)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

@findepi findepi force-pushed the findepi/delta-trailing-slashes branch from 29963d1 to ab96466 Compare June 21, 2023 09:11
@findepi
Copy link
Member Author

findepi commented Jun 21, 2023

fixed iceberg test failures, but didn't fix delta yet

@findepi findepi changed the title Fix Delta writes when schema location ends with two slashes Fix Delta INSERT when schema OR table location ends with two slashes Jun 21, 2023
@findepi findepi force-pushed the findepi/delta-trailing-slashes branch from ab96466 to b6c9cf0 Compare June 21, 2023 09:29
@findepi
Copy link
Member Author

findepi commented Jun 21, 2023

CI ci / pt (default, suite-8-non-generic, ) #15187

@findepi
Copy link
Member Author

findepi commented Jun 21, 2023

CI pt (hdp3, suite-1, ) #16315

@findepi findepi merged commit 05b9fc4 into master Jun 21, 2023
@findepi findepi deleted the findepi/delta-trailing-slashes branch June 21, 2023 13:28
@github-actions github-actions bot added this to the 420 milestone Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed delta-lake Delta Lake connector hive Hive connector iceberg Iceberg connector
Development

Successfully merging this pull request may close these issues.

3 participants