-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Filter operation (GT AND LT) on Float type result error #13078
Comments
It may be that the literal (500.2) should be cast to float32. I think |
datafusion/datafusion/sql/src/planner.rs Line 451 in 3f3a0cf
datafusion/datafusion/sql/src/expr/value.rs Lines 89 to 92 in 3f3a0cf
Try: SELECT * FROM droneinfo_test_where WHERE signal_strength >= 80 AND speed <= 500.2::float; DataFusion CLI v42.0.0
> CREATE TABLE droneinfo_test_where (ts timestamp, signal_strength INT, speed FLOAT, calibration_method STRING);
0 row(s) fetched.
Elapsed 0.021 seconds.
> INSERT INTO droneinfo_test_where VALUES(NOW(),80,500.2,'method2');
+-------+
| count |
+-------+
| 1 |
+-------+
1 row(s) fetched.
Elapsed 0.020 seconds.
> SELECT * FROM droneinfo_test_where WHERE signal_strength >= 80 AND speed <= 500.2;
+----+-----------------+-------+--------------------+
| ts | signal_strength | speed | calibration_method |
+----+-----------------+-------+--------------------+
+----+-----------------+-------+--------------------+
0 row(s) fetched.
Elapsed 0.013 seconds.
> SELECT * FROM droneinfo_test_where WHERE signal_strength >= 80 AND speed <= 500.2::float;
+----------------------------+-----------------+-------+--------------------+
| ts | signal_strength | speed | calibration_method |
+----------------------------+-----------------+-------+--------------------+
| 2024-10-24T02:57:17.767451 | 80 | 500.2 | method2 |
+----------------------------+-----------------+-------+--------------------+
1 row(s) fetched.
Elapsed 0.009 seconds. |
take |
Also, worth noting that the parser is incorrect (at least not ANSI SQL compliant) when parsing numeric literals. It should be parsing them as Decimal rather than Float64. |
Describe the bug
SQL Query: Drone Information Table Operations
Create Table
Insert Data
Select Query
Expected Result
This result should match the output in DuckDB.
To Reproduce
run datadusion-cli
input
CREATE TABLE droneinfo_test_where (ts timestamp, signal_strength INT, speed FLOAT, calibration_method STRING);
INSERT INTO droneinfo_test_where VALUES(NOW(),80,500.2,'method2');
SELECT * FROM droneinfo_test_where WHERE signal_strength >= 80 AND speed <= 500.2;
Expected behavior
Same sql excute on duckdb
Additional context
No response
The text was updated successfully, but these errors were encountered: