Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/11792#discussion_r56592392
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala ---
@@ -110,23 +114,34 @@ case class Filter(condition: Expression, child:
SparkPlan)
override def doConsume(ctx: CodegenContext, input: Seq[ExprCode], row:
String): String = {
val numOutput = metricTerm(ctx, "numOutputRows")
- // filter out the nulls
- val filterOutNull = notNullAttributes.map { a =>
- val idx = child.output.indexOf(a)
- s"if (${input(idx).isNull}) continue;"
- }.mkString("\n")
+ val conjuncts = splitConjunctivePredicates(condition)
+ val evaluatedVars = new Array[ExprCode](input.length)
- ctx.currentVars = input
- val predicates = otherPreds.map { e =>
- val bound = ExpressionCanonicalizer.execute(
- BindReferences.bindReference(e, output))
- val ev = bound.gen(ctx)
+ // Generate the code to evaluate each filter.
+ val generated = conjuncts.map { c =>
+ // Collect the referenced attributes and make sure they are
evaluated.
+ val bound = BindReferences.bindReference(c, output)
--- End diff --
nwm, it's nice trick to use `output` here, since we already generate the
code for BoundReference, the nullablity of it does not matter, but help to
simplify the code of expressions.
Could you add a comment for that?
---
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]