-
Notifications
You must be signed in to change notification settings - Fork 2.3k
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
Hive: Add View support for HIVE catalog #9852
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.
Thanks for combining the earlier prs. It's clearer now.
Some preliminary comments.
@nastra please take a look as well to see if there are any major concerns.
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreTableOperations.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveViewOperations.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/inmemory/InMemoryCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveTableOperations.java
Outdated
Show resolved
Hide resolved
core/src/main/java/org/apache/iceberg/BaseMetastoreOperations.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
|
||
HiveViewOperations spyOps = spy(ops); | ||
|
||
failCommitAndThrowException(spyOps); |
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 actually think it's missing calling commit here where it should be expecting the exception that is being set up in failCommitAndThrowException
.
Can you please update the test to
@Test
public void testThriftExceptionUnknownStateIfNotInHistoryFailureOnCommit()
throws TException, InterruptedException {
HiveViewOperations ops = (HiveViewOperations) ((BaseView) view).operations();
ViewMetadata metadataV1 = ops.current();
assertThat(metadataV1.properties()).hasSize(0);
view.updateProperties().set("k1", "v1").commit();
ops.refresh();
ViewMetadata metadataV2 = ops.current();
assertThat(metadataV2.properties()).hasSize(1).containsEntry("k1", "v1");
HiveViewOperations spyOps = spy(ops);
failCommitAndThrowException(spyOps);
assertThatThrownBy(() -> spyOps.commit(metadataV2, metadataV1))
.isInstanceOf(CommitStateUnknownException.class)
.hasMessageStartingWith("Datacenter on fire");
ops.refresh();
assertThat(ops.current()).as("Current metadata should not have changed").isEqualTo(metadataV2);
assertThat(metadataFileExists(metadataV2)).as("Current metadata should still exist").isTrue();
assertThat(metadataFileCount(ops.current()))
.as(
"New metadata files should still exist, new location not in history but"
+ " the commit may still succeed")
.isEqualTo(2);
}
|
||
/** Pretends we throw an error while persisting that actually does commit serverside. */ | ||
@Test | ||
public void testThriftExceptionSuccessOnCommit() throws TException, InterruptedException { |
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.
please update this one to
@Test
public void testThriftExceptionSuccessOnCommit() throws TException, InterruptedException {
HiveViewOperations ops = (HiveViewOperations) ((BaseView) view).operations();
ViewMetadata metadataV1 = ops.current();
assertThat(metadataV1.properties()).hasSize(0);
view.updateProperties().set("k1", "v1").commit();
ops.refresh();
ViewMetadata metadataV2 = ops.current();
assertThat(metadataV2.properties()).hasSize(1).containsEntry("k1", "v1");
HiveViewOperations spyOps = spy(ops);
// Simulate a communication error after a successful commit
commitAndThrowException(ops, spyOps);
// Shouldn't throw because the commit succeeds even though an exception is thrown
spyOps.commit(metadataV2, metadataV1);
assertThat(ops.current()).as("Current metadata should have not changed").isEqualTo(metadataV2);
assertThat(metadataFileExists(ops.current()))
.as("Current metadata file should still exist")
.isTrue();
}
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveViewCommits.java
Show resolved
Hide resolved
dd82f4b
to
7da5812
Compare
7da5812
to
2b88e13
Compare
Build is failing because of flaky issue #11046 |
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.
will wait a bit with merging in case @danielcweeks has some additional comments
thanks @nk1506 for your patience here. Also thanks for everyone that helped out with reviews |
Thanks @nastra and @danielcweeks for your reviews and feedback. |
Hi @nastra @danielcweeks , Is this pull request scheduled for inclusion in the v1.7 release? |
@nqvuong1998 yes that will be shipped with 1.7.0 |
This changes include:
Ref: #9682 , #9461 , #8907