-
Notifications
You must be signed in to change notification settings - Fork 5.4k
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
Add views support in iceberg connector #19872
Conversation
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.
@pratyakshsharma Can you please add the cherry-pick information in the commit and PR messages as stated in https://github.com/prestodb/presto/wiki/Review-and-Commit-guidelines#example-commit-message ?
Hi @pratyakshsharma, thanks for your nice contribution! |
ebceeb2
to
d94093a
Compare
@ChunxuTang this PR only supports views via hive catalog. |
b67abc4
to
243c9c1
Compare
@yingsu00 This is good to review, all the tests are passing, I will retrigger the cancelled test after your review. |
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.
- Could you please add the original PR(s) link and original authors in the PR message as well?
- Add another commit to back port trinodb/trino@52a2534 before backporting the views changes
- The TestIcebergMetadataListing tests change was not backported.
- TestIcebergHiveMetadataListing was not backported. Please find the original PR/commit that creates this test and backport it as separate commit(s) before this one.
presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedTestCase.java
Outdated
Show resolved
Hide resolved
fe95211
to
5c8dc37
Compare
MetastoreContext metastoreContext = getMetastoreContext(session); | ||
ColumnConverter columnConverter = metastoreContext.getColumnConverter(); | ||
|
||
for (ColumnMetadata column : viewMetadata.getColumns()) { |
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.
Where does this part of code come from? Strangely, I saw the original commit just added a dummy column. @imjalpreet @agrawalreetika Can you please confirm if this is correct?
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.
@pratyakshsharma Are we adding actual column names here, to keep metadata updated in HMS for views? Or for any other reason?
Do we know in the original commit since its adding dummy column in Table object, how does the metadata looks like there?
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.
So I have followed the way views are created in hive connector in presto. Ultimately, both (view from trino and presto) have the same metadata in HMS as checked in iceberg.information_schema.columns table
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/test/java/com/facebook/presto/iceberg/TestIcebergMetadataListing.java
Show resolved
Hide resolved
@@ -206,6 +207,10 @@ public TableMetadata refresh() | |||
throw new UnknownTableTypeException(getSchemaTableName()); | |||
} | |||
|
|||
if ("true".equalsIgnoreCase(table.getParameters().get(PRESTO_VIEW_FLAG))) { |
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.
Are these test failures from previous commits? If so, these fixes need to be in the same commit that introduces the test failure. A general good practice is that there should not be any commit breaks the tests.
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.
Good point, have taken care of it.
row(storageTable, "_string"), | ||
row(storageTable, "_integer")); | ||
} | ||
} |
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.
@pratyakshsharma Could you please confirm, why are we adding IcebergHiveMetadataListing related tests in this PR?
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.
The original trino commit which is backported for adding views support had changes in this class. Hence I had to backport this class as well so as to have proper test coverage. Also Ying had suggested doing that here #19872 (review).
.iterator()); | ||
onPresto().executeQuery("CREATE TABLE hive.default.hive_table (_double DOUBLE)"); | ||
onPresto().executeQuery("CREATE VIEW hive.default.hive_view AS SELECT * FROM hive.default.hive_table"); | ||
} |
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.
Why are we creating hive tables and hive views here? Shouldn't it be iceberg tables & views for Iceberg testing?
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.
This is a backport from trinodb/trino@3531676#diff-d45108e44a12da55f3fbda8c8cb9f3ea323ae3caa7f4dddd20fa2535b499a31e
MetastoreContext metastoreContext = getMetastoreContext(session); | ||
ColumnConverter columnConverter = metastoreContext.getColumnConverter(); | ||
|
||
for (ColumnMetadata column : viewMetadata.getColumns()) { |
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.
@pratyakshsharma Are we adding actual column names here, to keep metadata updated in HMS for views? Or for any other reason?
Do we know in the original commit since its adding dummy column in Table object, how does the metadata looks like there?
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
Based on the test suite logs, it is failing when trying to run the profile |
.../etc/environment-specific-catalogs/singlenode-kerberos-hdfs-impersonation/iceberg.properties
Show resolved
Hide resolved
63ddf55
to
75af12b
Compare
.add(row("iceberg_table1", "_integer")) | ||
.add(row("iceberg_view", "_string")) | ||
.add(row("iceberg_view", "_integer")) | ||
.add(row("hive_view", "_double")) |
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.
@imjalpreet Thank you for the valuable suggestions, product tests are passing finally. I need to verify if we want hive_view to be listed as part of the above query? I feel this is not the desired behaviour.
Trino takes care of this already - https://github.com/trinodb/trino/pull/8153/files#diff-d45108e44a12da55f3fbda8c8cb9f3ea323ae3caa7f4dddd20fa2535b499a31e
@yingsu00 TestIcebergHiveMetadataListing was introduced as part of this commit in trino - https://github.com/trinodb/trino/pull/8153/commits/35316765099272863f009bbb2ced5d6b4d08aee4#diff-d45108e44a12da55f3fbd[…]3caa7f4dddd20fa2535b499a31e. I have added this as a separate commit but have not included the cherry pick information since I did not backport it completely. |
35653fb
to
6e8ec0c
Compare
@wanglinsong Do you know how to start the 3 yellow tests? |
Looks like tests are stuck on circle ci. I don’t have that access. |
I think we can do a final review and force push to retrigger the tests. These tests were not triggered in circle ci from what I can see. |
0a99fa5
to
c0f8f3e
Compare
@yingsu00 @agrawalreetika @imjalpreet Test failures are unrelated. Please take a pass. |
807fdd3
to
b95158d
Compare
Please make sure all tests pass before requesting reviews. Thank you. I reran the tests for you this time, in the future, you can try to re-push to trigger the new run. |
4c7e7aa
to
a3d39ba
Compare
@yingsu00 All checks have passed. |
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.
Apart from minor nits, overall looks good to me now.
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergHiveMetadata.java
Outdated
Show resolved
Hide resolved
presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java
Outdated
Show resolved
Hide resolved
7d1c9ed
to
8262d80
Compare
The product tests failed with "failed to register layer: write /usr/libexec/mysqld: no space left on device" |
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.
Pending production tests
@yingsu00 this is a required fix for all enterprise presto consumers |
@pratyakshsharma Rebase your PR on master, this #21000 may help for product case space related failures. |
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.
I have a couple of small suggestions to consider for the docs. Let me know what you think of them, please.
Cherry-pick of trinodb/trino@4b6297e Co-authored-by: electrum
35459ce
to
74569fe
Compare
Cherry-pick of trinodb/trino@4b4e4f1 Co-authored-by: losipiuk
74569fe
to
b11870b
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.
Requested docs change present and verified in local docs build.
LGTM! (docs)
Cherry-pick of trinodb/trino@4b4e4f1
Co-authored-by: losipiuk