kosiew commented on code in PR #25562:
URL: https://github.com/apache/datafusion/pull/25562#discussion_r4281460967


##########
datafusion/sqllogictest/test_files/cast.slt:
##########
@@ -332,3 +332,32 @@ NULL NULL
 
 statement ok
 DROP TABLE narrow_column;
+
+# Casting integer ids to strings in a view and back to integers in the filter
+# must not use string-ordered interval bounds derived from numeric statistics.
+
+statement ok
+COPY (SELECT column1 AS id FROM (VALUES (2), (10)))
+TO 'test_files/scratch/cast/cast_interval_ids.parquet'
+STORED AS PARQUET;
+
+statement ok
+CREATE EXTERNAL TABLE cast_interval_ids
+STORED AS PARQUET
+LOCATION 'test_files/scratch/cast/cast_interval_ids.parquet';
+
+statement ok
+CREATE VIEW cast_interval_text_ids AS
+SELECT CAST(id AS VARCHAR) AS id FROM cast_interval_ids;
+
+query T
+SELECT id FROM cast_interval_text_ids WHERE CAST(id AS INT) > 1 ORDER BY id;

Review Comment:
   Could we also test `CAST(id AS INT) > 5`, expecting only `10`? This would 
add a selective filtering check alongside the existing regression test. It's 
optional since runtime filtering is unchanged by this PR.



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