rednaxelafx commented on a change in pull request #25080: [SPARK-28306][SQL] 
Make NormalizeFloatingNumbers rule idempotent
URL: https://github.com/apache/spark/pull/25080#discussion_r301820102
 
 

 ##########
 File path: 
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/constraintExpressions.scala
 ##########
 @@ -21,15 +21,25 @@ import org.apache.spark.sql.catalyst.InternalRow
 import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, 
ExprCode, FalseLiteral}
 import org.apache.spark.sql.types.DataType
 
-case class KnownNotNull(child: Expression) extends UnaryExpression {
-  override def nullable: Boolean = false
+trait TaggingExpression extends UnaryExpression {
+  override def nullable: Boolean = child.nullable
   override def dataType: DataType = child.dataType
 
   override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): 
ExprCode = {
-    child.genCode(ctx).copy(isNull = FalseLiteral)
+    child.genCode(ctx)
   }
 
   override def eval(input: InternalRow): Any = {
     child.eval(input)
   }
 }
+
+case class KnownNotNull(child: Expression) extends TaggingExpression {
+  override def nullable: Boolean = false
+
+  override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): 
ExprCode = {
+    child.genCode(ctx).copy(isNull = FalseLiteral)
+  }
+}
+
+case class KnownFloatingPointNormalized(child: Expression) extends 
TaggingExpression
 
 Review comment:
   @cloud-fan should it be invisible though? I'd rather leave a trace of the 
marker in the plan, but we could make it less verbose by making it something 
like adding a prefix to the child instead of the regular tostring, e.g. print
   `normalizing-transform(...)`
   instead of 
   `knownfloatingpointnormalized(transform(...))`
   
   WDYT?

----------------------------------------------------------------
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]

Reply via email to