shivadarshan-devadiga commented on code in PR #60750:
URL: https://github.com/apache/spark/pull/60750#discussion_r4651094205


##########
sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/analysis/ApplyCharTypePaddingHelper.scala:
##########
@@ -161,35 +192,48 @@ object ApplyCharTypePaddingHelper {
       case other => other
     }
 
+  private def isStringConstant(e: Expression): Boolean =
+    e.foldable && e.dataType.isInstanceOf[StringType]
+
+  /**
+   * Evaluates a foldable string expression: Some(value), with a null value 
for NULL, or None if
+   * it fails. The comparison may be in a branch that is never evaluated, so 
as in
+   * ConstantFolding, the failure is left to the evaluation of the query.
+   */
+  private def tryEvalString(e: Expression): Option[Option[UTF8String]] = {
+    try {
+      Some(Option(e.eval().asInstanceOf[UTF8String]))
+    } catch {
+      case NonFatal(_) => None
+    }
+  }
+
   private def padAttrLitCmp(
       expr: Expression,
-      metadata: Metadata,
+      c: CharType,
       padCharCol: Boolean,
       lit: Expression): Option[Seq[Expression]] = {
     if (expr.dataType.isInstanceOf[StringType]) {

Review Comment:
   Removed: the `StringType` check and its `else None` in `padAttrLitCmp`, the 
`StringType` guard of the IN case, and the `ordinal < current.length` guard. 
The `StringType` check now lives only in `RawTypedRef`, for CHAR. The double 
blank line is gone too.



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