You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@datafusion.apache.org by "andygrove (via GitHub)" <gi...@apache.org> on 2026/02/09 22:41:23 UTC
[PR] test: Add SQL file tests for left and right expressions [datafusion-comet]
andygrove opened a new pull request, #3463:
URL: https://github.com/apache/datafusion-comet/pull/3463
## Which issue does this PR close?
Follow-up to #3207. Migrates left/right expression tests to the SQL file test framework and adds additional coverage.
## Rationale for this change
The SQL file test framework is the recommended approach for expression testing — no Scala code to write, no recompilation needed when tests change, and automatic constant folding disablement.
## What changes are included in this PR?
**left.sql** — Enhanced with additional test cases:
- Column + literal edge cases: `left(s, 0)`, `left(s, -1)`, `left(s, 10)` (len exceeds string length)
- Unicode test table with multi-byte characters (CJK, emoji, Devanagari)
**right.sql** — New file with comprehensive coverage:
- Column + literal for all edge cases (len=0, -1, positive, exceeds length)
- Null propagation: `right(NULL, 0)` must return NULL not empty string
- Mixed null/non-null values with non-positive length
- Equivalence verification with `substring(s, -3, 3)`
- Unicode characters (CJK, emoji, Devanagari)
- Both-columns and literal+column fallback cases
Note: `right` uses `spark_answer_only` because `Right` is a `RuntimeReplaceable` expression — Spark's optimizer replaces it with `If(IsNull, null, If(len<=0, "", Substring))` before Comet's serde layer sees it.
## How are these changes tested?
All tests run via `CometSqlFileTestSuite` with `ConfigMatrix: parquet.enable.dictionary=false,true`.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] test: Add SQL file tests for left and right expressions [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove merged PR #3463:
URL: https://github.com/apache/datafusion-comet/pull/3463
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] test: Add SQL file tests for left and right expressions [datafusion-comet]
Posted by "comphead (via GitHub)" <gi...@apache.org>.
comphead commented on code in PR #3463:
URL: https://github.com/apache/datafusion-comet/pull/3463#discussion_r2789008793
##########
spark/src/test/resources/sql-tests/expressions/string/left.sql:
##########
@@ -30,10 +30,36 @@ SELECT left(s, n) FROM test_str_left
query
SELECT left(s, 3) FROM test_str_left
+-- column + literal: edge cases
+query
+SELECT left(s, 0) FROM test_str_left
+
+query
+SELECT left(s, -1) FROM test_str_left
+
+query
+SELECT left(s, 10) FROM test_str_left
Review Comment:
would prob nice to mention why 10 is the edge case? I assume it is related to `s` length?
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org
Re: [PR] test: Add SQL file tests for left and right expressions [datafusion-comet]
Posted by "andygrove (via GitHub)" <gi...@apache.org>.
andygrove commented on code in PR #3463:
URL: https://github.com/apache/datafusion-comet/pull/3463#discussion_r2793858443
##########
spark/src/test/resources/sql-tests/expressions/string/left.sql:
##########
@@ -30,10 +30,36 @@ SELECT left(s, n) FROM test_str_left
query
SELECT left(s, 3) FROM test_str_left
+-- column + literal: edge cases
+query
+SELECT left(s, 0) FROM test_str_left
+
+query
+SELECT left(s, -1) FROM test_str_left
+
+query
+SELECT left(s, 10) FROM test_str_left
Review Comment:
Thanks for the review @comphead. I added comments as requested. I'll merge this once CI is green.
--
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-unsubscribe@datafusion.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscribe@datafusion.apache.org
For additional commands, e-mail: github-help@datafusion.apache.org