PHILO-HE commented on code in PR #8518:
URL: https://github.com/apache/incubator-gluten/pull/8518#discussion_r1952070087


##########
backends-clickhouse/src/main/scala/org/apache/gluten/backendsapi/clickhouse/CHIteratorApi.scala:
##########
@@ -230,16 +230,18 @@ class CHIteratorApi extends IteratorApi with Logging with 
LogLevelUtil {
   override def genPartitions(
       wsCtx: WholeStageTransformContext,
       splitInfos: Seq[Seq[SplitInfo]],
-      scans: Seq[BasicScanExecTransformer]): Seq[BaseGlutenPartition] = {
+      leafs: Seq[LeafTransformSupport]): Seq[BaseGlutenPartition] = {

Review Comment:
   ->leaves



##########
backends-velox/src/main/scala/org/apache/gluten/backendsapi/velox/VeloxIteratorApi.scala:
##########
@@ -91,7 +91,7 @@ class VeloxIteratorApi extends IteratorApi with Logging {
   override def genPartitions(
       wsCtx: WholeStageTransformContext,
       splitInfos: Seq[Seq[SplitInfo]],
-      scans: Seq[BasicScanExecTransformer]): Seq[BaseGlutenPartition] = {
+      leafs: Seq[LeafTransformSupport]): Seq[BaseGlutenPartition] = {

Review Comment:
   Ditto



##########
gluten-substrait/src/main/scala/org/apache/gluten/backendsapi/IteratorApi.scala:
##########
@@ -43,7 +43,7 @@ trait IteratorApi {
   def genPartitions(
       wsCtx: WholeStageTransformContext,
       splitInfos: Seq[Seq[SplitInfo]],
-      scans: Seq[BasicScanExecTransformer]): Seq[BaseGlutenPartition]
+      leafs: Seq[LeafTransformSupport]): Seq[BaseGlutenPartition]

Review Comment:
   Ditto.



##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala:
##########
@@ -363,22 +366,21 @@ case class WholeStageTransformer(child: SparkPlan, 
materializeInput: Boolean = f
           GlutenConfig.get.substraitPlanLogLevel,
           s"$nodeName generating the substrait plan took: $t ms."))
     val inputRDDs = new ColumnarInputRDDsWrapper(columnarInputRDDs)
-    // Check if BatchScan exists.
-    val basicScanExecTransformers = findAllScanTransformers()
 
-    if (basicScanExecTransformers.nonEmpty) {
+    val leafTransformers = findAllLeafTransformers()
+    if (leafTransformers.nonEmpty) {
 
       /**
        * If containing scan exec transformer this "whole stage" generates a 
RDD which itself takes
        * care of SCAN there won't be any other RDD for SCAN. As a result, 
genFirstStageIterator
        * rather than genFinalStageIterator will be invoked

Review Comment:
   Please also modify this part of comment.



##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/GlutenWholeStageColumnarRDD.scala:
##########
@@ -36,7 +36,9 @@ case class GlutenPartition(
     index: Int,
     plan: Array[Byte],
     splitInfosByteArray: Array[Array[Byte]] = Array.empty[Array[Byte]],
-    locations: Array[String] = Array.empty[String]
+    locations: Array[String] = Array.empty[String],
+    files: Array[String] =
+      Array.empty[String] // touched files, for implementing UDF 
input_file_name

Review Comment:
   Is this a relevant change? If not, better to include this change in another 
pr.



##########
cpp-ch/local-engine/local_engine_jni.cpp:
##########
@@ -315,6 +315,7 @@ JNIEXPORT jstring 
Java_org_apache_gluten_vectorized_BatchIterator_nativeFetchMet
     const local_engine::LocalExecutor * executor = 
reinterpret_cast<local_engine::LocalExecutor *>(executor_address);
     const auto metric = executor->getMetric();
     const String metrics_json = metric ? 
local_engine::RelMetricSerializer::serializeRelMetric(metric) : "";
+    // std::cout << "metrics_json: " << metrics_json << std::endl;

Review Comment:
   Looks like debug code. Remove it.



##########
gluten-substrait/src/main/scala/org/apache/gluten/execution/WholeStageTransformer.scala:
##########
@@ -322,33 +324,34 @@ case class WholeStageTransformer(child: SparkPlan, 
materializeInput: Boolean = f
   }
 
   /** Find all BasicScanExecTransformer in one WholeStageTransformer */

Review Comment:
   Please also modify the comment to align with the code.



##########
backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHRangeExecTransformer.scala:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.gluten.execution
+
+import org.apache.gluten.backendsapi.BackendsApiManager
+import org.apache.gluten.expression.ConverterUtils
+import org.apache.gluten.extension.ValidationResult
+import org.apache.gluten.metrics.{CHRangeMetricsUpdater, MetricsUpdater}
+import org.apache.gluten.substrait.`type`._
+import org.apache.gluten.substrait.SubstraitContext
+import org.apache.gluten.substrait.extensions.ExtensionBuilder
+import org.apache.gluten.substrait.rel.{RelBuilder, SplitInfo}
+
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.connector.read.InputPartition
+import org.apache.spark.sql.execution.SparkPlan
+import 
org.apache.spark.sql.execution.datasources.clickhouse.ExtensionTableBuilder
+import org.apache.spark.sql.execution.metric.{SQLMetric, SQLMetrics}
+
+import com.google.protobuf.StringValue
+import io.substrait.proto.NamedStruct
+
+import scala.collection.JavaConverters;
+
+case class CHRangeExecTransformer(
+    start: Long,
+    end: Long,
+    step: Long,
+    numSlices: Int,
+    numElements: BigInt,
+    outputAttributes: Seq[Attribute],
+    child: Seq[SparkPlan])
+  extends ColumnarRangeBaseExec(start, end, step, numSlices, numElements, 
outputAttributes, child)
+  with LeafTransformSupport {
+
+  override def output: Seq[Attribute] = outputAttributes

Review Comment:
   We can remove this as it is as same as that in base class.



##########
backends-clickhouse/src/main/scala/org/apache/gluten/execution/CHRangeExecTransformer.scala:
##########
@@ -0,0 +1,109 @@
+/*
+ * 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.gluten.execution
+
+import org.apache.gluten.backendsapi.BackendsApiManager
+import org.apache.gluten.expression.ConverterUtils
+import org.apache.gluten.extension.ValidationResult
+import org.apache.gluten.metrics.{CHRangeMetricsUpdater, MetricsUpdater}
+import org.apache.gluten.substrait.`type`._
+import org.apache.gluten.substrait.SubstraitContext
+import org.apache.gluten.substrait.extensions.ExtensionBuilder
+import org.apache.gluten.substrait.rel.{RelBuilder, SplitInfo}
+
+import org.apache.spark.sql.catalyst.expressions.Attribute
+import org.apache.spark.sql.connector.read.InputPartition
+import org.apache.spark.sql.execution.SparkPlan
+import 
org.apache.spark.sql.execution.datasources.clickhouse.ExtensionTableBuilder
+import org.apache.spark.sql.execution.metric.{SQLMetric, SQLMetrics}
+
+import com.google.protobuf.StringValue
+import io.substrait.proto.NamedStruct
+
+import scala.collection.JavaConverters;
+
+case class CHRangeExecTransformer(
+    start: Long,
+    end: Long,
+    step: Long,
+    numSlices: Int,
+    numElements: BigInt,
+    outputAttributes: Seq[Attribute],
+    child: Seq[SparkPlan])
+  extends ColumnarRangeBaseExec(start, end, step, numSlices, numElements, 
outputAttributes, child)
+  with LeafTransformSupport {

Review Comment:
   Can we directly let `ColumnarRangeBaseExec` extend `LeafTransformSupport`?



-- 
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]

Reply via email to