Skip to content

Commit 6a4b671

Browse files
committed
Add option to avoid binding operators expressions automatically.
1 parent 92cca08 commit 6a4b671

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/BoundAttribute.scala

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,11 +48,17 @@ case class BoundReference(ordinal: Int, baseReference: Attribute)
4848
override def apply(input: Row): Any = input(ordinal)
4949
}
5050

51+
/**
52+
* Used to denote operators that do their own binding of attributes internally.
53+
*/
54+
trait NoBind { self: trees.TreeNode[_] => }
55+
5156
class BindReferences[TreeNode <: QueryPlan[TreeNode]] extends Rule[TreeNode] {
5257
import BindReferences._
5358

5459
def apply(plan: TreeNode): TreeNode = {
5560
plan.transform {
61+
case n: NoBind => n.asInstanceOf[TreeNode]
5662
case leafNode if leafNode.children.isEmpty => leafNode
5763
case unaryNode if unaryNode.children.size == 1 => unaryNode.transformExpressions { case e =>
5864
bindReference(e, unaryNode.children.head.output)

0 commit comments

Comments
 (0)