Comments (8)
Good bug report. Thanks.
This is a bug in the deployed Playground, it's fixed in main and could be rolled into a new release fairly soon
NB I use the Dev Container to stay up to date with the latest, and to test this...
from prql.
@richb-hanover The bug is still here on main
(see #3968)
(a
and b
were indeed good thanks to #3846 but not c
and d
)
from prql.
Yikes! You're right. The addition/subtraction paren's are correct, multiply/divide are not... (See generated SQL below)
@syko Sorry for the misinformation...
SELECT
*,
10 - (10 - 2) AS a,
10 - (10 + 2) AS b,
10 / 10 / 2 AS c,
10 / 10 * 2 AS d
FROM
foo
-- Generated by PRQL compiler version:0.10.2 (https://prql-lang.org)
from prql.
Eeek, I'm looking. Sorry for this...
from prql.
OK, so the root of the issue is that for division, we're using s-strings
prql/prqlc/prql-compiler/src/sql/std.sql.prql
Lines 271 to 272 in 192be60
prql/prqlc/prql-compiler/src/sql/gen_expr.rs
Lines 802 to 846 in cc8adde
I think we can patch this by putting parentheses everywhere β #3969 βΒ but I think we might need to rethink whether we can use s-strings as extensively as we have been for these operators. We could add an annotation for associativity.
from prql.
@max-sixty I tested this in my Dev Container and it works as expected. Thanks.
... but I think we might need to rethink whether we can use s-strings as extensively as we have been for these operators.
Would you give an example or two of where an s-string could run into difficulty?
from prql.
Would you give an example or two of where an s-string could run into difficulty?
I adjusted the approach in #3970, so it's much more reasonable now βΒ check that one out...
from prql.
Nice! That's some fast-action bugfixing π
from prql.
Related Issues (20)
- Release 0.13 HOT 1
- Queries that return nested tuples HOT 1
- Reformatting an alias omits quoting HOT 2
- DevContainer: Need to run `git config ... --add safe.directory` one time HOT 5
- After adding 1500k line of db schema type definition to default_db module, `prqlc compile` takes more than 1G ram & 2 min even for simplest query. HOT 1
- Nightly tests failed HOT 1
- How to abstract table filtering using function? HOT 2
- Nightly tests failed HOT 1
- Nightly tests failed
- Select columns collection is inaccurate HOT 1
- Odd version number in Windows Dev Container HOT 4
- Reformatting a string containing both single and double quotes breaks down HOT 1
- Nightly tests failed HOT 1
- Nightly tests failed HOT 1
- Nightly tests failed HOT 1
- Nightly tests failed
- Converting quotes properly to double quotes in Postgres in custom field name scenario HOT 5
- Nightly tests failed
- RUSTSEC-2024-0370: proc-macro-error is unmaintained HOT 1
- Nightly tests failed HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from prql.