0lai0 commented on code in PR #3647:
URL: https://github.com/apache/datafusion-comet/pull/3647#discussion_r2902978794


##########
native/spark-expr/src/predicate_funcs/rlike.rs:
##########
@@ -140,8 +140,30 @@ impl PhysicalExpr for RLike {
                 let array = self.is_match(inputs);
                 Ok(ColumnarValue::Array(Arc::new(array)))
             }
-            ColumnarValue::Scalar(_) => {
-                internal_err!("non scalar regexp patterns are not supported")
+            ColumnarValue::Scalar(scalar) => {
+                // Handle scalar input (all-literal RLIKE expressions)
+                // This case occurs when ConstantFolding is disabled and both
+                // the input string and pattern are literals
+                if scalar.is_null() {
+                    // NULL RLIKE pattern -> NULL result
+                    return 
Ok(ColumnarValue::Scalar(ScalarValue::Boolean(None)));
+                }
+
+                // Extract string value from scalar and match pattern
+                // We handle each type separately to avoid lifetime issues 
with Utf8View
+                let is_match = match scalar {
+                    ScalarValue::Utf8(Some(s)) => 
self.pattern.is_match(s.as_str()),
+                    ScalarValue::LargeUtf8(Some(s)) => 
self.pattern.is_match(s.as_str()),
+                    ScalarValue::Utf8View(Some(s)) => 
self.pattern.is_match(s.as_str()),

Review Comment:
   Yes, On the current Spark -> Comet proto -> native planner path, string 
literals are deserialized as ScalarValue::Utf8. So I think keeping Utf8 
handling here is necessary. 
   Let me know if I missed anything.



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