Github user andrewor14 commented on a diff in the pull request:
https://github.com/apache/spark/pull/8535#discussion_r39195019
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/local/LocalNode.scala ---
@@ -73,17 +85,78 @@ abstract class LocalNode extends TreeNode[LocalNode] {
}
result
}
+
+ protected def newMutableProjection(
+ expressions: Seq[Expression],
+ inputSchema: Seq[Attribute]): () => MutableProjection = {
+ log.debug(
+ s"Creating MutableProj: $expressions, inputSchema: $inputSchema,
codegen:$codegenEnabled")
+ if (codegenEnabled) {
+ try {
+ GenerateMutableProjection.generate(expressions, inputSchema)
+ } catch {
+ case NonFatal(e) =>
+ if (isTesting) {
+ throw e
+ } else {
+ log.error("Failed to generate mutable projection, fallback to
interpreted", e)
+ () => new InterpretedMutableProjection(expressions,
inputSchema)
+ }
+ }
+ } else {
+ () => new InterpretedMutableProjection(expressions, inputSchema)
+ }
+ }
+
}
-abstract class LeafLocalNode extends LocalNode {
+abstract class LeafLocalNode(conf: SQLConf) extends LocalNode(conf) {
override def children: Seq[LocalNode] = Seq.empty
}
-abstract class UnaryLocalNode extends LocalNode {
+abstract class UnaryLocalNode(conf: SQLConf) extends LocalNode(conf) {
def child: LocalNode
override def children: Seq[LocalNode] = Seq(child)
}
+
+abstract class BinaryLocalNode(conf: SQLConf) extends LocalNode(conf) {
+
+ def left: LocalNode
+
+ def right: LocalNode
+
+ override def children: Seq[LocalNode] = Seq(left, right)
+}
+
+/**
+ * An thin wrapper around a [[LocalNode]] that provides an `Iterator`
interface.
+ */
+private[local] class LocalNodeIterator(localNode: LocalNode) extends
Iterator[InternalRow] {
--- End diff --
we should add tests for this :) Let's do it in a follow-up patch.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]