Skip to content

Commit 19b2e45

Browse files
committed
[ToBeSquashed]Address imjalpreet's comments
1 parent ad40b8e commit 19b2e45

File tree

6 files changed

+26
-21
lines changed

6 files changed

+26
-21
lines changed

presto-iceberg/pom.xml

+12-12
Original file line numberDiff line numberDiff line change
@@ -263,18 +263,6 @@
263263
</exclusions>
264264
</dependency>
265265

266-
<dependency>
267-
<groupId>org.testcontainers</groupId>
268-
<artifactId>testcontainers</artifactId>
269-
<scope>test</scope>
270-
<exclusions>
271-
<exclusion>
272-
<groupId>org.slf4j</groupId>
273-
<artifactId>slf4j-api</artifactId>
274-
</exclusion>
275-
</exclusions>
276-
</dependency>
277-
278266
<dependency>
279267
<groupId>com.amazonaws</groupId>
280268
<artifactId>aws-java-sdk-core</artifactId>
@@ -620,6 +608,18 @@
620608
<scope>test</scope>
621609
</dependency>
622610

611+
<dependency>
612+
<groupId>org.testcontainers</groupId>
613+
<artifactId>testcontainers</artifactId>
614+
<scope>test</scope>
615+
<exclusions>
616+
<exclusion>
617+
<groupId>org.slf4j</groupId>
618+
<artifactId>slf4j-api</artifactId>
619+
</exclusion>
620+
</exclusions>
621+
</dependency>
622+
623623
<dependency>
624624
<groupId>org.apache.iceberg</groupId>
625625
<artifactId>iceberg-core</artifactId>

presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergAbstractMetadata.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -1035,15 +1035,15 @@ public void setTableProperties(ConnectorSession session, ConnectorTableHandle ta
10351035

10361036
protected Map<String, String> populateTableProperties(ConnectorTableMetadata tableMetadata, com.facebook.presto.iceberg.FileFormat fileFormat, ConnectorSession session, CatalogType catalogType)
10371037
{
1038-
ImmutableMap.Builder<String, String> propertiesBuilder = ImmutableMap.builderWithExpectedSize(5);
1038+
ImmutableMap.Builder<String, String> propertiesBuilder = ImmutableMap.builderWithExpectedSize(16);
10391039

10401040
String writeDataLocation = IcebergTableProperties.getWriteDataLocation(tableMetadata.getProperties());
10411041
if (!Strings.isNullOrEmpty(writeDataLocation)) {
10421042
if (catalogType.equals(CatalogType.HADOOP)) {
10431043
propertiesBuilder.put(WRITE_DATA_LOCATION, writeDataLocation);
10441044
}
10451045
else {
1046-
throw new PrestoException(NOT_SUPPORTED, "Not support set write_data_path on catalog: " + catalogType);
1046+
throw new PrestoException(NOT_SUPPORTED, "Table property write_data_path is not supported with catalog type: " + catalogType);
10471047
}
10481048
}
10491049
else {

presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergCommonModule.java

+5
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@
9595
import static com.facebook.airlift.concurrent.Threads.daemonThreadsNamed;
9696
import static com.facebook.airlift.configuration.ConfigBinder.configBinder;
9797
import static com.facebook.airlift.json.JsonCodecBinder.jsonCodecBinder;
98+
import static com.facebook.presto.common.Utils.checkArgument;
99+
import static com.facebook.presto.iceberg.CatalogType.HADOOP;
98100
import static com.facebook.presto.orc.StripeMetadataSource.CacheableRowGroupIndices;
99101
import static com.facebook.presto.orc.StripeMetadataSource.CacheableSlice;
100102
import static com.google.common.util.concurrent.MoreExecutors.newDirectExecutorService;
@@ -137,6 +139,9 @@ protected void setup(Binder binder)
137139

138140
configBinder(binder).bindConfig(IcebergConfig.class);
139141

142+
IcebergConfig icebergConfig = buildConfigObject(IcebergConfig.class);
143+
checkArgument(icebergConfig.getCatalogType().equals(HADOOP) || icebergConfig.getCatalogWarehouseDataDir() == null, "'iceberg.catalog.warehouse.datadir' can only be specified in Hadoop catalog");
144+
140145
binder.bind(IcebergSessionProperties.class).in(Scopes.SINGLETON);
141146
newOptionalBinder(binder, IcebergNessieConfig.class); // bind optional Nessie config to IcebergSessionProperties
142147

presto-iceberg/src/main/java/com/facebook/presto/iceberg/IcebergConfig.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ public String getCatalogWarehouseDataDir()
134134
}
135135

136136
@Config("iceberg.catalog.warehouse.datadir")
137-
@ConfigDescription("Iceberg catalog default root data writing directory")
137+
@ConfigDescription("Iceberg catalog default root data writing directory. This is only supported with Hadoop catalog.")
138138
public IcebergConfig setCatalogWarehouseDataDir(String catalogWarehouseDataDir)
139139
{
140140
this.catalogWarehouseDataDir = catalogWarehouseDataDir;

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

+5-5
Original file line numberDiff line numberDiff line change
@@ -158,16 +158,16 @@ public void testTableWithSpecifiedWriteDataLocation()
158158
{
159159
String dataWriteLocation = Files.createTempDirectory("test_table_with_specified_write_data_location2").toAbsolutePath().toString();
160160
assertQueryFails(String.format("create table test_table_with_specified_write_data_location2(a int, b varchar) with (write_data_path = '%s')", dataWriteLocation),
161-
"Not support set write_data_path on catalog: " + catalogType);
161+
"Table property write_data_path is not supported with catalog type: " + catalogType);
162162
}
163163

164164
@Test
165165
public void testPartitionedTableWithSpecifiedWriteDataLocation()
166166
throws IOException
167167
{
168-
String dataWriteLocation = Files.createTempDirectory("test_table_with_specified_write_data_location3").toAbsolutePath().toString();
169-
assertQueryFails(String.format("create table test_table_with_specified_write_data_location3(a int, b varchar) with (write_data_path = '%s')", dataWriteLocation),
170-
"Not support set write_data_path on catalog: " + catalogType);
168+
String dataWriteLocation = Files.createTempDirectory("test_partitioned_table_with_specified_write_data_location").toAbsolutePath().toString();
169+
assertQueryFails(String.format("create table test_partitioned_table_with_specified_write_data_location(a int, b varchar) with (write_data_path = '%s', partitioning = ARRAY['a'])", dataWriteLocation),
170+
"Table property write_data_path is not supported with catalog type: " + catalogType);
171171
}
172172

173173
@Test
@@ -177,7 +177,7 @@ public void testShowCreateTableWithSpecifiedWriteDataLocation()
177177
String tableName = "test_table_with_specified_write_data_location";
178178
String dataWriteLocation = java.nio.file.Files.createTempDirectory("test1").toAbsolutePath().toString();
179179
assertQueryFails(format("CREATE TABLE %s(a int, b varchar) with (write_data_path = '%s')", tableName, dataWriteLocation),
180-
"Not support set write_data_path on catalog: " + catalogType);
180+
"Table property write_data_path is not supported with catalog type: " + catalogType);
181181
}
182182

183183
@Test

presto-iceberg/src/test/java/com/facebook/presto/iceberg/hadoop/TestIcebergSmokeHadoop.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ public void testTableWithSpecifiedWriteDataLocation()
9999
public void testPartitionedTableWithSpecifiedWriteDataLocation()
100100
throws IOException
101101
{
102-
String tableName = "test_table_with_specified_write_data_location3";
102+
String tableName = "test_partitioned_table_with_specified_write_data_location";
103103
String dataWriteLocation = Files.createTempDirectory(tableName).toAbsolutePath().toString();
104104
try {
105105
assertUpdate(format("create table %s(a int, b varchar) with (partitioning = ARRAY['a'], write_data_path = '%s')", tableName, dataWriteLocation));

0 commit comments

Comments
 (0)