karuppayya commented on code in PR #16088:
URL: https://github.com/apache/iceberg/pull/16088#discussion_r3242771867
##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/SparkSQLProperties.java:
##########
@@ -110,6 +110,14 @@ private SparkSQLProperties() {}
// Prefix for custom snapshot properties
public static final String SNAPSHOT_PROPERTY_PREFIX =
"spark.sql.iceberg.snapshot-property.";
+ // Controls whether adaptive split sizing is enabled
+ public static final String READ_ADAPTIVE_SPLIT_SIZE_ENABLED =
+ "spark.sql.iceberg.read.adaptive-split-size.enabled";
+
+ // Overrides the parallelism used for adaptive split sizing. When unset, the
parallelism
+ // defaults to max(spark.default.parallelism, spark.sql.shuffle.partitions).
+ public static final String READ_SPLIT_PARALLELISM =
"spark.sql.iceberg.read.split-parallelism";
Review Comment:
done.
On a different note, wonder if this could be misunderstood as something
thats related to Spark AQE while it is not. just flagging it in case it's worth
revisiting the prefix later.
##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/TestSparkReadConf.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.spark;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+
+import org.apache.iceberg.ParameterizedTestExtension;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.spark.sql.internal.SQLConf;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestSparkReadConf extends TestBaseWithCatalog {
+
+ @BeforeEach
+ public void before() {
+ super.before();
+ sql("CREATE TABLE %s (id BIGINT, data STRING) USING iceberg", tableName);
+ }
+
+ @AfterEach
+ public void after() {
+ sql("DROP TABLE IF EXISTS %s", tableName);
+ }
+
+ @TestTemplate
+ public void testAdaptiveSplitSizeSessionConf() {
+ Table table = validationCatalog.loadTable(tableIdent);
+ withSQLConf(
+ ImmutableMap.of(SparkSQLProperties.READ_ADAPTIVE_SPLIT_SIZE_ENABLED,
"false"),
+ () -> {
+ SparkReadConf conf = new SparkReadConf(spark, table,
CaseInsensitiveStringMap.empty());
+ assertThat(conf.adaptiveSplitSizeEnabled()).isFalse();
+ });
+ }
+
+ @TestTemplate
+ public void testSplitParallelismDefault() {
+ Table table = validationCatalog.loadTable(tableIdent);
+ withSQLConf(
+ ImmutableMap.of(SQLConf.SHUFFLE_PARTITIONS().key(), "999"),
+ () -> {
+ SparkReadConf conf = new SparkReadConf(spark, table,
CaseInsensitiveStringMap.empty());
+ assertThat(conf.splitParallelism()).isEqualTo(999);
+ });
+ }
+
+ @TestTemplate
+ public void testSplitParallelismSessionConf() {
+ Table table = validationCatalog.loadTable(tableIdent);
+ withSQLConf(
Review Comment:
done
##########
spark/v4.1/spark/src/test/java/org/apache/iceberg/spark/TestSparkReadConf.java:
##########
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.iceberg.spark;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static
org.assertj.core.api.Assertions.assertThatIllegalArgumentException;
+
+import org.apache.iceberg.ParameterizedTestExtension;
+import org.apache.iceberg.Table;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.apache.spark.sql.internal.SQLConf;
+import org.apache.spark.sql.util.CaseInsensitiveStringMap;
+import org.junit.jupiter.api.AfterEach;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.TestTemplate;
+import org.junit.jupiter.api.extension.ExtendWith;
+
+@ExtendWith(ParameterizedTestExtension.class)
+public class TestSparkReadConf extends TestBaseWithCatalog {
+
+ @BeforeEach
+ public void before() {
+ super.before();
+ sql("CREATE TABLE %s (id BIGINT, data STRING) USING iceberg", tableName);
+ }
+
+ @AfterEach
+ public void after() {
+ sql("DROP TABLE IF EXISTS %s", tableName);
+ }
+
+ @TestTemplate
+ public void testAdaptiveSplitSizeSessionConf() {
+ Table table = validationCatalog.loadTable(tableIdent);
+ withSQLConf(
+ ImmutableMap.of(SparkSQLProperties.READ_ADAPTIVE_SPLIT_SIZE_ENABLED,
"false"),
Review Comment:
The default for ADAPTIVE_SPLIT_SIZE_ENABLED is actually true, but makes
sense to make it explicit. But think again, i dont think this test is needed as
part of this chnage. I have removed it .
--
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]