appletreeisyellow opened a new issue, #10258:
URL: https://github.com/apache/datafusion/issues/10258

   ### Describe the bug
   
   When upgrading DataFusion in InfluxData IOx, we found a regression 
https://github.com/apache/datafusion/commit/fc34dacdb9842cde4d056d5a659796ede4ae5e74
 brought in, which comes from the PR below:
   * https://github.com/apache/datafusion/pull/10137
   
   For example, querying `substring("region", 1, 2)` errors with the following 
message:
   
   `Unsupported ast node in sqltorel: Substring { expr: Identifier(Ident { 
value: "region", quote_style: None }), substring_from: Some(Value(Number("1", 
false))), substring_for: Some(Value(Number("2", false))), special: true }`
   
   I verified that previous commit 
(https://github.com/apache/datafusion/commit/eb72debc2abb3fb2f132c56da8986794d523e39d)
 doesn't have this bug
   
   ### To Reproduce
   
   1. on the latest [`apache/datafusion`](https://github.com/apache/datafusion) 
main branch
   ```
   git co fc34dacdb9842cde4d056d5a659796ede4ae5e74
   ```
   
   2. build datafusion-cli locally
   ```
   cd datafusion-cli
   cargo build
   ```
   
   3. run datafusion-cli locally 
   ```
   ./target/debug/datafusion-cli
   ```
   
   4. Then in `datafusion-cli`
   ```shell
   DataFusion CLI v37.1.0
   
   # create a table with one column
   CREATE TABLE fruits (name VARCHAR(100));
   INSERT INTO fruits (name) VALUES ('banana');
   INSERT INTO fruits (name) VALUES ('apple');
   0 row(s) fetched.
   Elapsed 0.004 seconds.
   
   +-------+
   | count |
   +-------+
   | 1     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.004 seconds.
   
   +-------+
   | count |
   +-------+
   | 1     |
   +-------+
   1 row(s) fetched.
   Elapsed 0.004 seconds.
   
   > select * from fruits;
   +--------+
   | name   |
   +--------+
   | banana |
   | apple  |
   +--------+
   2 row(s) fetched.
   Elapsed 0.011 seconds.
   
   > select substring("name", 1, 2) from fruits;
   This feature is not implemented: Unsupported ast node in sqltorel: Substring 
{ expr: Identifier(Ident { value: "name", quote_style: Some('"') }), 
substring_from: Some(Value(Number("1", false))), substring_for: 
Some(Value(Number("2", false))), special: true }
   ```
   
   ### Expected behavior
   
   ```shell
   > select substring("name", 1, 2) from fruits;
   +---------------------------------------+
   | substr(fruits.name,Int64(1),Int64(2)) |
   +---------------------------------------+
   | ba                                    |
   | ap                                    |
   +---------------------------------------+
   2 row(s) fetched.
   Elapsed 0.015 seconds.
   ```
   
   ### Additional context
   
   _No response_


-- 
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...@datafusion.apache.org.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to