Skip to content

Commit

Permalink
Review comments Oct 18.
Browse files Browse the repository at this point in the history
  • Loading branch information
Dmitriy Fingerman committed Oct 18, 2024
1 parent afced96 commit b8cf574
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ public class TestIcebergLlapLocalCompactorCliDriver {

static CliAdapter adapter = new CliConfigs.IcebergLlapLocalCompactorCliConfig().getCliAdapter();
private static final AtomicBoolean stop = new AtomicBoolean();
private static final String defaultPoolName = null;
private static final String icebergPoolName = "iceberg";
private static final String DEFAULT_POOL_NAME = null;
private static final String ICEBERG_POOL_NAME = "iceberg";
private static Worker worker;

@Parameters(name ="{0}")
Expand All @@ -52,8 +52,8 @@ public static List<Object[]> getParameters() throws Exception {

@BeforeClass
public static void setup() throws Exception {
setupWorker(defaultPoolName);
setupWorker(icebergPoolName);
setupWorker(DEFAULT_POOL_NAME);
setupWorker(ICEBERG_POOL_NAME);
}

private static void setupWorker(String poolName) throws Exception {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public class TestParseOptimizeTable {
@Test
public void testOptimizeTableWithWhere() throws Exception {

String EXPECTED_WHERE_FILTER = "\n" +
String expectedWhereFilter = "\n" +
"nil\n" +
" TOK_ALTERTABLE\n" +
" TOK_TABNAME\n" +
Expand All @@ -52,13 +52,13 @@ public void testOptimizeTableWithWhere() throws Exception {

ASTNode tree = parseDriver.parse(
" optimize table tbl0 rewrite data where (col01 in ('A', 'B') and col02 < '2024-09-17 00:00:00')", null).getTree();
assertThat(tree.dump(), is(EXPECTED_WHERE_FILTER));
assertThat(tree.dump(), is(expectedWhereFilter));
}

@Test
public void testOptimizeTableWithOrderBy() throws Exception {

String EXPECTED_ORDER_BY = "\n" +
String expectedOrderBy = "\n" +
"nil\n" +
" TOK_ALTERTABLE\n" +
" TOK_TABNAME\n" +
Expand All @@ -75,13 +75,13 @@ public void testOptimizeTableWithOrderBy() throws Exception {

ASTNode tree = parseDriver.parse(
" optimize table tbl0 rewrite data order by col01 desc", null).getTree();
assertThat(tree.dump(), is(EXPECTED_ORDER_BY));
assertThat(tree.dump(), is(expectedOrderBy));
}

@Test
public void testOptimizeTableWithPool() throws Exception {

String EXPECTED_WITH_COMPACT_POOL = "\n" +
String expectedWithCompactPool = "\n" +
"nil\n" +
" TOK_ALTERTABLE\n" +
" TOK_TABNAME\n" +
Expand All @@ -95,6 +95,6 @@ public void testOptimizeTableWithPool() throws Exception {

ASTNode tree = parseDriver.parse(
" optimize table tbl0 rewrite data pool 'iceberg'", null).getTree();
assertThat(tree.dump(), is(EXPECTED_WITH_COMPACT_POOL));
assertThat(tree.dump(), is(expectedWithCompactPool));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -92,8 +92,10 @@ else if (desc.getPartitionSpec() != null) {
CompactionRequest compactionRequest = new CompactionRequest(table.getDbName(), table.getTableName(),
compactionTypeStr2ThriftType(desc.getCompactionType()));

compactionRequest.setPoolName(ObjectUtils.defaultIfNull(desc.getPoolName(),
CompactorUtil.getPoolName(context.getConf(), table.getTTable(), metadataCache)));
String poolName = ObjectUtils.defaultIfNull(desc.getPoolName(),
CompactorUtil.getPoolName(context.getConf(), table.getTTable(), metadataCache));

compactionRequest.setPoolName(poolName);
compactionRequest.setProperties(desc.getProperties());
compactionRequest.setInitiatorId(JavaUtils.hostname() + "-" + HiveMetaStoreClient.MANUALLY_INITIATED_COMPACTION);
compactionRequest.setInitiatorVersion(HiveMetaStoreClient.class.getPackage().getImplementationVersion());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,8 @@

import com.google.common.annotations.VisibleForTesting;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.StringUtils;
import org.apache.hadoop.hive.common.ServerUtils;
import org.apache.hadoop.hive.common.ValidTxnList;
import org.apache.hadoop.hive.conf.Constants;
import org.apache.hadoop.hive.conf.HiveConf;
import org.apache.hadoop.hive.metastore.api.*;
import org.apache.hadoop.hive.metastore.conf.MetastoreConf;
Expand Down

0 comments on commit b8cf574

Please sign in to comment.