srowen commented on a change in pull request #23976: [SPARK-27057][SQL] Common
trait for limit exec operators
URL: https://github.com/apache/spark/pull/23976#discussion_r263012586
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/limit.scala
##########
@@ -27,13 +27,21 @@ import org.apache.spark.sql.catalyst.util.truncatedString
import org.apache.spark.sql.execution.exchange.ShuffleExchangeExec
import org.apache.spark.sql.execution.metric.{SQLShuffleReadMetricsReporter,
SQLShuffleWriteMetricsReporter}
+/**
+ * The operator takes limited number of elements from its child operator.
+ */
+trait LimitExec extends UnaryExecNode {
+ /** Number of element should be taken from child operator */
+ def limit: Int
+}
+
/**
* Take the first `limit` elements and collect them to a single partition.
*
* This operator will be used when a logical `Limit` operation is the final
operator in an
* logical plan, which happens when the user is collecting results back to the
driver.
*/
-case class CollectLimitExec(limit: Int, child: SparkPlan) extends
UnaryExecNode {
+case class CollectLimitExec(limit: Int, child: SparkPlan) extends LimitExec {
Review comment:
I'm not 100% sure how Scala works here, but is `limit: Int` going to
implement `def limit: Int` in the trait? I assume so or else this won't
compile, so OK.
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]