ShreyeshArangath commented on code in PR #2124:
URL: https://github.com/apache/auron/pull/2124#discussion_r3001756401
##########
spark-extension/src/main/java/org/apache/auron/spark/configuration/SparkAuronConfiguration.java:
##########
@@ -411,6 +411,11 @@ public class SparkAuronConfiguration extends
AuronConfiguration {
.withDescription("Enable AggregateExec operation conversion to
native Auron implementations.")
.withDefaultValue(true);
+ public static final ConfigOption<Boolean> ENABLE_COALESEC = new
SQLConfOption<>(Boolean.class)
+ .withKey("auron.enable.coalesce")
+ .withCategory("Operator Supports")
+ .withDescription("Enable CoalesceExec operation conversion to
native Auron implementations.")
+ .withDefaultValue(true);
Review Comment:
nit: needs a new line here
##########
spark-extension/src/main/java/org/apache/auron/spark/configuration/SparkAuronConfiguration.java:
##########
@@ -411,6 +411,11 @@ public class SparkAuronConfiguration extends
AuronConfiguration {
.withDescription("Enable AggregateExec operation conversion to
native Auron implementations.")
.withDefaultValue(true);
+ public static final ConfigOption<Boolean> ENABLE_COALESEC = new
SQLConfOption<>(Boolean.class)
Review Comment:
```suggestion
public static final ConfigOption<Boolean> ENABLE_COALESCE = new
SQLConfOption<>(Boolean.class)
```
##########
spark-extension-shims-spark/src/main/scala/org/apache/spark/sql/auron/ShimsImpl.scala:
##########
@@ -283,6 +283,9 @@ class ShimsImpl extends Shims with Logging {
override def createNativeFilterExec(condition: Expression, child:
SparkPlan): NativeFilterBase =
NativeFilterExec(condition, child)
+ def createNativeCoalesceExec(numPartitions: Int, child: SparkPlan):
NativeCoalesceBase =
Review Comment:
Should this also be an override def?
```suggestion
override def createNativeCoalesceExec(numPartitions: Int, child:
SparkPlan): NativeCoalesceBase =
```
##########
spark-extension-shims-spark/src/test/scala/org/apache/auron/AuronNativeCoalesceExecSuite.scala:
##########
@@ -0,0 +1,41 @@
+/*
+ * 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.auron
+
+import org.apache.spark.sql.{AuronQueryTest, Row}
+import org.apache.spark.sql.execution.auron.plan.NativeCoalesceExec
+
+class AuronNativeCoalesceExecSuite extends AuronQueryTest with
BaseAuronSQLSuite {
+ import testImplicits._
+
+ test("test CoalesceExec to native") {
Review Comment:
We should improve the testing here, some cases I can think about
1. numPartitions > inputPartitions (no-op or expansion)
2. numPartitions = 1, numPartitions = 0
3. empty dataset
##########
spark-extension/src/main/scala/org/apache/spark/sql/auron/AuronConverters.scala:
##########
@@ -201,6 +202,10 @@ object AuronConverters extends Logging {
}
convertedAgg
+ case e: CoalesceExec if enableCoalesec => // coalesec
Review Comment:
```suggestion
case e: CoalesceExec if enableCoalesce => // coalesce
```
##########
spark-extension/src/main/scala/org/apache/spark/sql/execution/auron/plan/NativeCoalesceBase.scala:
##########
@@ -0,0 +1,303 @@
+/*
+ * 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.spark.sql.execution.auron.plan
+
+import scala.collection.mutable
+import scala.collection.mutable.ArrayBuffer
+
+import org.apache.spark.Partition
+import org.apache.spark.rdd.{CoalescedRDDPartition, PartitionCoalescer,
PartitionGroup, RDD}
+import org.apache.spark.sql.auron.{CoalesceNativeRDD, EmptyNativeRDD,
NativeHelper, NativeRDD, NativeSupports}
+import org.apache.spark.sql.catalyst.InternalRow
+import org.apache.spark.sql.execution.{SparkPlan, UnaryExecNode}
+
+abstract class NativeCoalesceBase(numPartitions: Int, child: SparkPlan)
+ extends UnaryExecNode
+ with NativeSupports {
+
+ override val nodeName: String = "NativeCoalesce"
+
+ lazy val inputRDD: RDD[InternalRow] = if (NativeHelper.isNative(child)) {
+ NativeHelper.executeNative(child)
+ } else {
+ child.execute()
+ }
+
+ val partitions: Array[Partition] = {
Review Comment:
Should this be a lazy val instead for lazy computation. The way it is set up
right now, I think it will try to compute this eagerly during planning.
--
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]