n-young commented on code in PR #58867:
URL: https://github.com/apache/spark/pull/58867#discussion_r4509788379


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/misc.scala:
##########
@@ -412,6 +418,38 @@ case class CurrentUser()
   final override val nodePatterns: Seq[TreePattern] = Seq(CURRENT_LIKE)
 }
 
+private object AesEncryptDeterminism {
+  def apply(arguments: Seq[Expression]): Boolean = {
+    arguments.forall(_.deterministic) &&
+      (hasNonEmptyFixedValue(arguments(4)) || isEcbFixedValue(arguments(2)))
+  }
+
+  private def fixedValue(expression: Expression): Option[Any] = {
+    if (expression.resolved && expression.foldable && expression.deterministic 
&&

Review Comment:
   Updated fixedValue to apply ReplaceExpressions before checking resolved, 
deterministic and foldable and evaluating the constant. This recognizes 
to_binary/encode IVs, session-variable IVs and computed ECB modes while 
retaining conservative handling of null, empty, per-row and unevaluable values. 
Analyzer and SQL coverage includes GCM/CBC joins and DEFAULT insertion, 
session-variable joins, and generated-column creation/writes. All five focused 
suites pass (215 tests): 
https://github.com/n-young/spark/actions/runs/42577028496.



##########
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/optimizer/RewriteWithExpressionSuite.scala:
##########
@@ -127,20 +127,6 @@ class RewriteWithExpressionSuite extends PlanTest {
     assert(rewritten == (Literal(1) + Literal(1)) * (Literal(1) + Literal(1)))
   }
 
-  test("applyForExpression rejects an impure foldable definition referenced 
more than once") {

Review Comment:
   Retained the purpose-built ImpureFoldable fixture and its multiply 
referenced definition test. Updated the stale AES examples in 
RewriteWithExpression to describe impure foldable invocations and side effects 
instead. RewriteWithExpressionSuite passes all 53 tests.



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

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to