Skip to content

Commit 15afc5c

Browse files
committed
Use builder pattern for IcebergQueryRunner
Additionally, add support for tracking catalog properties added to iceberg. This can be useful for tests that may require their own catalogs
1 parent a766a3a commit 15afc5c

30 files changed

+340
-325
lines changed

presto-iceberg/src/test/java/com/facebook/presto/iceberg/BenchmarkIcebergHadoopCatalog.java

+5-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package com.facebook.presto.iceberg;
1515

1616
import com.facebook.presto.tests.DistributedQueryRunner;
17-
import com.google.common.collect.ImmutableMap;
1817
import org.openjdk.jmh.annotations.BenchmarkMode;
1918
import org.openjdk.jmh.annotations.Fork;
2019
import org.openjdk.jmh.annotations.Measurement;
@@ -27,12 +26,9 @@
2726
import org.openjdk.jmh.runner.options.OptionsBuilder;
2827
import org.openjdk.jmh.runner.options.VerboseMode;
2928

30-
import java.util.Optional;
3129
import java.util.OptionalInt;
3230

3331
import static com.facebook.presto.iceberg.CatalogType.HADOOP;
34-
import static com.facebook.presto.iceberg.FileFormat.PARQUET;
35-
import static com.facebook.presto.iceberg.IcebergQueryRunner.createIcebergQueryRunner;
3632
import static java.util.concurrent.TimeUnit.MILLISECONDS;
3733
import static org.openjdk.jmh.annotations.Mode.AverageTime;
3834
import static org.openjdk.jmh.annotations.Scope.Benchmark;
@@ -50,14 +46,11 @@ public class BenchmarkIcebergHadoopCatalog
5046
public DistributedQueryRunner getQueryRunner()
5147
{
5248
try {
53-
return createIcebergQueryRunner(
54-
ImmutableMap.of(),
55-
ImmutableMap.of("iceberg.catalog.type", HADOOP.name()),
56-
PARQUET,
57-
false,
58-
true,
59-
OptionalInt.of(1),
60-
Optional.empty());
49+
return IcebergQueryRunner.builder()
50+
.setCatalogType(HADOOP)
51+
.setNodeCount(OptionalInt.of(4))
52+
.build()
53+
.getQueryRunner();
6154
}
6255
catch (Exception e) {
6356
e.printStackTrace();

presto-iceberg/src/test/java/com/facebook/presto/iceberg/BenchmarkIcebergHiveCatalog.java

+5-12
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package com.facebook.presto.iceberg;
1515

1616
import com.facebook.presto.tests.DistributedQueryRunner;
17-
import com.google.common.collect.ImmutableMap;
1817
import org.openjdk.jmh.annotations.BenchmarkMode;
1918
import org.openjdk.jmh.annotations.Fork;
2019
import org.openjdk.jmh.annotations.Measurement;
@@ -27,11 +26,9 @@
2726
import org.openjdk.jmh.runner.options.OptionsBuilder;
2827
import org.openjdk.jmh.runner.options.VerboseMode;
2928

30-
import java.util.Optional;
3129
import java.util.OptionalInt;
3230

33-
import static com.facebook.presto.iceberg.FileFormat.PARQUET;
34-
import static com.facebook.presto.iceberg.IcebergQueryRunner.createIcebergQueryRunner;
31+
import static com.facebook.presto.iceberg.CatalogType.HIVE;
3532
import static java.util.concurrent.TimeUnit.MILLISECONDS;
3633
import static org.openjdk.jmh.annotations.Mode.AverageTime;
3734
import static org.openjdk.jmh.annotations.Scope.Benchmark;
@@ -49,14 +46,10 @@ public class BenchmarkIcebergHiveCatalog
4946
public DistributedQueryRunner getQueryRunner()
5047
{
5148
try {
52-
return createIcebergQueryRunner(
53-
ImmutableMap.of(),
54-
ImmutableMap.of(),
55-
PARQUET,
56-
false,
57-
true,
58-
OptionalInt.of(1),
59-
Optional.empty());
49+
return IcebergQueryRunner.builder()
50+
.setCatalogType(HIVE)
51+
.setNodeCount(OptionalInt.of(1))
52+
.build().getQueryRunner();
6053
}
6154
catch (Exception e) {
6255
e.printStackTrace();

presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedSmokeTestBase.java

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import com.facebook.presto.testing.QueryRunner;
2424
import com.facebook.presto.testing.assertions.Assert;
2525
import com.facebook.presto.tests.AbstractTestIntegrationSmokeTest;
26-
import com.google.common.collect.ImmutableMap;
2726
import org.apache.iceberg.Table;
2827
import org.apache.iceberg.UpdateProperties;
2928
import org.intellij.lang.annotations.Language;
@@ -74,7 +73,7 @@ protected IcebergDistributedSmokeTestBase(CatalogType catalogType)
7473
protected QueryRunner createQueryRunner()
7574
throws Exception
7675
{
77-
return IcebergQueryRunner.createIcebergQueryRunner(ImmutableMap.of(), catalogType);
76+
return IcebergQueryRunner.builder().setCatalogType(catalogType).build().getQueryRunner();
7877
}
7978

8079
@Test

presto-iceberg/src/test/java/com/facebook/presto/iceberg/IcebergDistributedTestBase.java

+4-1
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,10 @@ protected IcebergDistributedTestBase(CatalogType catalogType)
193193
protected QueryRunner createQueryRunner()
194194
throws Exception
195195
{
196-
return IcebergQueryRunner.createIcebergQueryRunner(ImmutableMap.of(), catalogType, extraConnectorProperties);
196+
return IcebergQueryRunner.builder()
197+
.setCatalogType(catalogType)
198+
.setExtraConnectorProperties(extraConnectorProperties)
199+
.build().getQueryRunner();
197200
}
198201

199202
@Test

0 commit comments

Comments
 (0)