deniskuzZ commented on code in PR #14236:
URL: https://github.com/apache/iceberg/pull/14236#discussion_r2398800068
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -504,6 +504,142 @@ public void testChangeLockWithAlterTable() throws
Exception {
.hasSameClassAs(initialLock);
}
+ @Test
+ public void testCreateTableWithNoLockEndToEnd() throws Exception {
+ TableIdentifier newTableIdentifier = TableIdentifier.of(DB_NAME,
"new_table_no_lock_e2e");
+
+ try {
+ // Create table with NoLock enabled via catalog
+ catalog.createTable(
+ newTableIdentifier,
+ SCHEMA,
+ PartitionSpec.unpartitioned(),
+ ImmutableMap.of(HIVE_LOCK_ENABLED, "false"));
+
+ // Load the table and verify the lock type
+ Table table = catalog.loadTable(newTableIdentifier);
+ HiveTableOperations ops = (HiveTableOperations) ((HasTableOperations)
table).operations();
+ TableMetadata metadata = ops.current();
+
+ HiveLock lock = ops.lockObject(metadata);
+ assertThat(lock)
+ .as("Table created with HIVE_LOCK_ENABLED=false should use NoLock")
+ .isInstanceOf(NoLock.class);
+ } finally {
+ catalog.dropTable(newTableIdentifier, true);
+ }
+ }
+
+ @Test
+ public void testCreateTableWithLockEndToEnd() throws Exception {
Review Comment:
`testCreateTableWithNoLockEndToEnd` & `testCreateTableWithLockEndToEnd` are
the same except the HIVE_LOCK_ENABLED flag. Why not create a generic test
method?
##########
hive-metastore/src/test/java/org/apache/iceberg/hive/TestHiveCommits.java:
##########
@@ -504,6 +504,142 @@ public void testChangeLockWithAlterTable() throws
Exception {
.hasSameClassAs(initialLock);
}
+ @Test
+ public void testCreateTableWithNoLockEndToEnd() throws Exception {
+ TableIdentifier newTableIdentifier = TableIdentifier.of(DB_NAME,
"new_table_no_lock_e2e");
+
+ try {
+ // Create table with NoLock enabled via catalog
+ catalog.createTable(
+ newTableIdentifier,
+ SCHEMA,
+ PartitionSpec.unpartitioned(),
+ ImmutableMap.of(HIVE_LOCK_ENABLED, "false"));
+
+ // Load the table and verify the lock type
+ Table table = catalog.loadTable(newTableIdentifier);
+ HiveTableOperations ops = (HiveTableOperations) ((HasTableOperations)
table).operations();
+ TableMetadata metadata = ops.current();
+
+ HiveLock lock = ops.lockObject(metadata);
+ assertThat(lock)
+ .as("Table created with HIVE_LOCK_ENABLED=false should use NoLock")
+ .isInstanceOf(NoLock.class);
+ } finally {
+ catalog.dropTable(newTableIdentifier, true);
+ }
+ }
+
+ @Test
+ public void testCreateTableWithLockEndToEnd() throws Exception {
Review Comment:
`testCreateTableWithNoLockEndToEnd` & `testCreateTableWithLockEndToEnd` are
the same except the HIVE_LOCK_ENABLED flag.
Why not create a generic test method?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]