-
Notifications
You must be signed in to change notification settings - Fork 2.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
Hive: Introduce HiveMetastoreExtension for Hive tests #9282
Conversation
hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveTableBaseTest.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Outdated
Show resolved
Hide resolved
681ede8
to
c59e4d3
Compare
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Outdated
Show resolved
Hide resolved
hive-metastore/src/test/java/org/apache/iceberg/hive/TestCachedClientPool.java
Outdated
Show resolved
Hide resolved
c59e4d3
to
13fde54
Compare
13fde54
to
cde7dd8
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.
thanks @nk1506, this LGTM
Let me take a look |
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveMetastoreExtension.java
Outdated
Show resolved
Hide resolved
@BeforeEach | ||
public void createTableLocation() throws IOException { | ||
catalog = |
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 think we should initialize the catalog only once. Not for each tests as nothing changes between tests related to catalog config.
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.
Also can we move this to HiveMetastoreExtension
and get the catalog from there? It can help in duplicating this code in each test class which uses this extension.
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.
As consistency with other catalog tests which initialise before each test and drop the catalog after every test. For Hive also the idea is same.
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.
Also can we move this to
HiveMetastoreExtension
and get the catalog from there? It can help in duplicating this code in each test class which uses this extension.
I don't think the catalog initialization should be moved into HiveMetastoreExtension
. The sole purpose of HiveMetastoreExtension
is to provide the metastore part
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.
@nastra: Thoughts?
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've replied already above
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.
Sorry, I wanted your thoughts on this comment
#9282 (comment)
hive-metastore/src/test/java/org/apache/iceberg/hive/HiveMetastoreExtension.java
Outdated
Show resolved
Hide resolved
@BeforeEach | ||
public void createTableLocation() throws IOException { | ||
catalog = |
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.
Also can we move this to HiveMetastoreExtension
and get the catalog from there? It can help in duplicating this code in each test class which uses this extension.
TimeUnit.MILLISECONDS.sleep(EVICTION_INTERVAL - TimeUnit.SECONDS.toMillis(2)); | ||
HiveClientPool clientPool2 = clientPool.clientPool(); | ||
assertThat(clientPool2).isSameAs(clientPool1); | ||
TimeUnit.MILLISECONDS.sleep(EVICTION_INTERVAL + TimeUnit.SECONDS.toMillis(5)); | ||
assertThat( | ||
CachedClientPool.clientPoolCache() | ||
.getIfPresent(CachedClientPool.extractKey(null, hiveConf))) | ||
.getIfPresent( | ||
CachedClientPool.extractKey(null, HIVE_METASTORE_EXTENSION.hiveConf()))) |
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.
nit: some test we are extracting to a variable and in some test we are using directly. Let us have a unified style.
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.
At other test hiveConf
was being used at multiple places, that's the reason I created a local variable.
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommitLocks.java
Outdated
Show resolved
Hide resolved
cde7dd8
to
d1f48bf
Compare
1825954
to
521fde4
Compare
521fde4
to
c81e2b3
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.
Now it is LGTM.
Co-authored-by: Eduard Tudenhoefner <[email protected]>
Co-authored-by: Eduard Tudenhoefner <[email protected]>
Co-authored-by: Eduard Tudenhoefner <[email protected]>
CC: @nastra