Skip to content

Commit 04f8aaa

Browse files
committed
Address comments
1 parent 9c3402b commit 04f8aaa

File tree

3 files changed

+13
-11
lines changed

3 files changed

+13
-11
lines changed

presto-docs/src/main/sphinx/connector/iceberg.rst

+2-2
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ Property Name Description
389389
``metrics_max_inferred_column`` Optionally specifies the maximum number of columns for which ``100``
390390
metrics are collected.
391391

392-
``read.target.split-size`` The target size for an individual split when generating splits ``134217728`` (128MB)
392+
``read.split.target-size`` The target size for an individual split when generating splits ``134217728`` (128MB)
393393
for a table scan. Must be specified in bytes.
394394
======================================= =============================================================== =========================
395395

@@ -426,7 +426,7 @@ Property Name Description
426426
session.
427427
``iceberg.target_split_size`` Overrides the target split size for all tables in a query in bytes.
428428
Set to 0 to use the value in each Iceberg table's
429-
``read.target.split-size`` property.
429+
``read.split.target-size`` property.
430430
===================================================== ======================================================================
431431

432432
Caching Support

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

+4-3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@
159159
import static com.google.common.collect.Streams.stream;
160160
import static io.airlift.slice.Slices.utf8Slice;
161161
import static io.airlift.slice.Slices.wrappedBuffer;
162+
import static io.airlift.units.DataSize.succinctBytes;
162163
import static java.lang.Double.doubleToRawLongBits;
163164
import static java.lang.Double.longBitsToDouble;
164165
import static java.lang.Double.parseDouble;
@@ -1284,9 +1285,9 @@ public static Long getSplitSize(Table table)
12841285

12851286
public static DataSize getTargetSplitSize(long sessionValueProperty, long icebergScanTargetSplitSize)
12861287
{
1287-
return Optional.of(DataSize.succinctBytes(sessionValueProperty))
1288-
.filter(size -> !size.equals(DataSize.succinctBytes(0)))
1289-
.orElse(DataSize.succinctBytes(icebergScanTargetSplitSize));
1288+
return sessionValueProperty == 0 ?
1289+
succinctBytes(icebergScanTargetSplitSize) :
1290+
succinctBytes(sessionValueProperty);
12901291
}
12911292

12921293
public static DataSize getTargetSplitSize(ConnectorSession session, Scan<?, ?, ?> scan)

presto-iceberg/src/test/java/com/facebook/presto/iceberg/procedure/TestSetTablePropertyProcedure.java

+7-6
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import static com.facebook.presto.iceberg.IcebergQueryRunner.createIcebergQueryRunner;
3434
import static com.facebook.presto.iceberg.IcebergQueryRunner.getIcebergDataDirectoryPath;
3535
import static java.lang.String.format;
36+
import static org.apache.iceberg.TableProperties.SPLIT_SIZE_DEFAULT;
3637
import static org.testng.Assert.assertEquals;
3738

3839
public class TestSetTablePropertyProcedure
@@ -64,21 +65,21 @@ public void testSetTablePropertyProcedurePositionalArgs()
6465
String tableName = "table_property_table_test";
6566
createTable(tableName);
6667
try {
67-
String propertyKey = "read.split.planning-lookback";
68+
String propertyKey = "read.split.target-size";
6869
String propertyValue = "268435456";
6970
assertUpdate("INSERT INTO " + tableName + " VALUES (1, 'a')", 1);
7071

7172
Table table = loadTable(tableName);
7273
table.refresh();
7374

7475
assertEquals(table.properties().size(), 8);
75-
assertEquals(table.properties().get(propertyKey), null);
76+
assertEquals(Long.parseLong(table.properties().get(propertyKey)), SPLIT_SIZE_DEFAULT);
7677

7778
assertUpdate(format("CALL system.set_table_property('%s', '%s', '%s', '%s')", TEST_SCHEMA, tableName, propertyKey, propertyValue));
7879
table.refresh();
7980

8081
// now the table property read.split.target-size should have new value
81-
assertEquals(table.properties().size(), 9);
82+
assertEquals(table.properties().size(), 8);
8283
assertEquals(table.properties().get(propertyKey), propertyValue);
8384
}
8485
finally {
@@ -92,22 +93,22 @@ public void testSetTablePropertyProcedureNamedArgs()
9293
String tableName = "table_property_table_arg_test";
9394
createTable(tableName);
9495
try {
95-
String propertyKey = "read.split.planning-lookback";
96+
String propertyKey = "read.split.target-size";
9697
String propertyValue = "268435456";
9798
assertUpdate("INSERT INTO " + tableName + " VALUES (1, 'a')", 1);
9899

99100
Table table = loadTable(tableName);
100101
table.refresh();
101102

102103
assertEquals(table.properties().size(), 8);
103-
assertEquals(table.properties().get(propertyKey), null);
104+
assertEquals(Long.parseLong(table.properties().get(propertyKey)), SPLIT_SIZE_DEFAULT);
104105

105106
assertUpdate(format("CALL system.set_table_property(schema => '%s', key => '%s', value => '%s', table_name => '%s')",
106107
TEST_SCHEMA, propertyKey, propertyValue, tableName));
107108
table.refresh();
108109

109110
// now the table property read.split.target-size should have new value
110-
assertEquals(table.properties().size(), 9);
111+
assertEquals(table.properties().size(), 8);
111112
assertEquals(table.properties().get(propertyKey), propertyValue);
112113
}
113114
finally {

0 commit comments

Comments
 (0)