Github user nongli commented on a diff in the pull request:
https://github.com/apache/spark/pull/11585#discussion_r55734434
--- Diff:
sql/core/src/main/scala/org/apache/spark/sql/execution/basicOperators.scala ---
@@ -90,20 +109,41 @@ case class Filter(condition: Expression, child:
SparkPlan) extends UnaryNode wit
override def doConsume(ctx: CodegenContext, input: Seq[ExprCode]):
String = {
val numOutput = metricTerm(ctx, "numOutputRows")
- val expr = ExpressionCanonicalizer.execute(
- BindReferences.bindReference(condition, child.output))
+
+ // filter out the nulls
+ val filterOutNull = notNullAttributes.map { a =>
+ val idx = child.output.indexOf(a)
+ s"if (${input(idx).isNull}) continue;"
+ }.mkString("\n")
+
ctx.currentVars = input
- val eval = expr.gen(ctx)
- val nullCheck = if (expr.nullable) {
- s"!${eval.isNull} &&"
- } else {
- s""
+ val predicates = otherPreds.map { e =>
+ val bound = ExpressionCanonicalizer.execute(
+ BindReferences.bindReference(e, output))
+ val ev = bound.gen(ctx)
+ val nullCheck = if (bound.nullable) {
+ s"${ev.isNull} || "
+ } else {
+ s""
+ }
+ s"""
+ |${ev.code}
+ |if (${nullCheck}!${ev.value}) continue;
+ """.stripMargin
+ }.mkString("\n")
+
+ // Reset the isNull to false for the not-null columns.
--- End diff --
comment why
---
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]