How should PRQL deal with operands of different data types? #4305
vanillajonathan
started this conversation in
General
Replies: 2 comments
Oh gosh!! Nice example. Yes, I think raising an error where possible makes sense with these. There's an issue of "values in the columns act differently to literal values" — i.e. But I don't think this presents the same problems as #4289, since I don't think there's ever a reason to need |
0 replies
|
In the Playground, DuckDB does throw errors for both of these; from [{a=1}]
select {
b = "foo" + 7,
c = "7" + 7,
}However it would be great if PRQL was strongly typed and could point this out to you ahead of time as well as in the LSP. |
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
In SQL
"foo" + 7became""while"7" + 7became14.In JavaScript:
"foo" + 7becomes"foo7""7" + 7becomes77"foo" - 7becomesNaN"7" - 7becomes0.In Python you get a
TypeError.Implicit type conversion can be convenient but it can also be a source of bugs. Explicit type conversions could be an alternative.
All reactions