Fix table listing in Iceberg to skip non-Iceberg tables#1354
Fix table listing in Iceberg to skip non-Iceberg tables#1354findepi merged 3 commits intotrinodb:masterfrom
Conversation
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/RecordingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/RecordingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/cache/CachingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/HiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/glue/GlueHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Is the match case-sensitive or case-insensitive?
On our side we do case-insensitive, file metastore it's case-sensitive and HMS thrift call may be case-sensitive (or it may actually depend on hms backend db collation).
There was a problem hiding this comment.
@findepi @linxingyuan1102 The change introduces the problematic behavior as AFAIK case-sensitivity depends on HMS backend db collation and for derby db it is case-sensitive. This leads to iceberg tables that are created in spark using an upper case 'ICEBERG' type become hidden in show tables while still valid and usable in queries.
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/RecordingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/cache/CachingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/cache/CachingHiveMetastore.java
Outdated
Show resolved
Hide resolved
c67062e to
3685028
Compare
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/RecordingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/cache/CachingHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
3685028 to
2ef434b
Compare
|
@findepi Thanks for the review. Comments addressed. |
findepi
left a comment
There was a problem hiding this comment.
Looks good to me!
Minor comments + a question to David.
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/file/FileHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
...to-hive/src/test/java/io/prestosql/plugin/hive/metastore/thrift/InMemoryThriftMetastore.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
2ef434b to
e412b9f
Compare
|
Thanks. Comments addressed. |
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Is these a reference to what are the safe values for HMS?
There was a problem hiding this comment.
I don't think there is one. See #1354 (comment).
There was a problem hiding this comment.
@phd3 this is documented in the code (where the constant is actually used, so there is a little bit more context).
Could you please check that explanation there? If it's not sufficient for a reader, we should improve it.
There was a problem hiding this comment.
I'd rather create a different class for <databaseName, parameterKey, parameterValue> than using a list to key the cache.
There was a problem hiding this comment.
nit: we can name it something liketableNamesCacheForPattern for consistency with tableNamesCache. both of them fetch tables for a database, the later one takes a filter into account.
There was a problem hiding this comment.
nit: we can name it something like
tableNamesCacheForPatternfor consistency withtableNamesCache. both of them fetch tables for a database, the later one takes a filter into account.
"Pattern" might not be very accurate because we use both = and LIKE when constructing the filter and we restrict the filter value to be alphanumeric. And I think it should be better if we just name the cache field after the method whose results it is caching. So I'd rather stay with tablesWithParameterCache here.
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/RecordingHiveMetastore.java
Outdated
Show resolved
Hide resolved
electrum
left a comment
There was a problem hiding this comment.
A few minor comments, otherwise looks good
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/thrift/ThriftHiveMetastore.java
Outdated
Show resolved
Hide resolved
...to-hive/src/test/java/io/prestosql/plugin/hive/metastore/thrift/InMemoryThriftMetastore.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/io/prestosql/plugin/iceberg/IcebergMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/io/prestosql/plugin/iceberg/TestIcebergMetadataListing.java
Outdated
Show resolved
Hide resolved
37ee2dc to
f5185b6
Compare
214e4f4 to
a086e9d
Compare
|
I've rebased the changes against master to resolve conflicts. Do we want to merge this if everything is okay? |
presto-hive/src/main/java/io/prestosql/plugin/hive/metastore/cache/CachingHiveMetastore.java
Outdated
Show resolved
Hide resolved
a086e9d to
495770f
Compare
findepi
left a comment
There was a problem hiding this comment.
LGTM, I will merge when Travis passes
(please ping me if I don't)
...to-hive/src/test/java/io/prestosql/plugin/hive/metastore/thrift/InMemoryThriftMetastore.java
Outdated
Show resolved
Hide resolved
electrum
left a comment
There was a problem hiding this comment.
Thanks for splitting this up into multiple commits. Very easy to review and see the different changes.
This is mainly used in tests.
Table listing in the Iceberg catalog should not include non-Iceberg tables.
495770f to
ac43013
Compare
|
Merged, thanks! |
#1324
Tests done:
mvn clean installbuilds successfully inpresto-hivedirectory.TestIcebergMetadataListing.mvn clean installbuilds successfully inpresto-icebergdirectory.