viirya commented on code in PR #7967:
URL: https://github.com/apache/arrow-datafusion/pull/7967#discussion_r1375374153


##########
datafusion/sqllogictest/test_files/scalar.slt:
##########
@@ -1878,3 +1878,51 @@ query T
 SELECT CONCAT('Hello', 'World')
 ----
 HelloWorld
+
+statement ok
+CREATE TABLE simple_string(
+  letter STRING,
+  letter2 STRING
+) as VALUES
+  ('A', 'APACHE'),
+  ('B', 'APACHE'),
+  ('C', 'APACHE'),
+  ('D', 'APACHE')
+;
+
+query TT
+EXPLAIN SELECT letter, letter = LEFT('APACHE', 1) FROM simple_string;
+----
+logical_plan
+Projection: simple_string.letter, simple_string.letter = Utf8("A") AS 
simple_string.letter = left(Utf8("APACHE"),Int64(1))

Review Comment:
   The end-to-end tests are not failed, but I think it is good to have it to be 
clear.
   
   For end-to-end execution, `LEFT('APACHE', 1)` is a foldable literal. So 
expression optimizer optimizes it to a scalar literal.
   
   But if developers use the API `create_physical_expr` directly, the reported 
error will happen.



-- 
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: github-unsubscr...@arrow.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to