-
Notifications
You must be signed in to change notification settings - Fork 61
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
Annotations can be dropped in some circumstances #2
Comments
Changing size to |
dlurton
added a commit
that referenced
this issue
Mar 15, 2021
#2, adds CompilerPipeline interface and makes EvaluatingCompiler internal.
vgapeyev
added a commit
that referenced
this issue
Mar 27, 2023
am357
added a commit
that referenced
this issue
Jul 26, 2024
```SQL CREATE TABLE PETS ( id INT4, breed STRING, tag INT2 ) ``` Tests: ```SQL -- #1 should succeed CAST(true AS INT2) -- -- #2 should fail CAST((s : STRING) AS LIST) -- #3 should succeed CAST((i : INT2) AS INT4) -- #4 should succeed CAST((i : INT4) AS INT2) ``` #### Background context As part of a specification work, we want to make the behavior for the #4 more visible: From SQL-99 Section 6.22: <cast specification>: ``` If SD (source data type) is exact numeric or approximate numeric, then Case: i) If there is a representation of SV (source value) in the data type TD (target data type) that does not lose any leading si-gnificant digits after rounding or truncating if necessary, then TV is that representation. The choice of whether to round or truncate is implementation-defined. ii) Otherwise, an exception condition is raised: data exception — numeric value out of range. ``` We can see this evaluation behavior in PostgresSQL v15: Ref.: https://www.db-fiddle.com/f/vMY3Srd2bG6f3NshvTp3w1/0 ``` -- succeeds SELECT CAST((1::INT4) AS INT2); -- fails: `Query Error: error: smallint out of range` SELECT CAST((327686::INT4) AS INT2); ```
am357
added a commit
that referenced
this issue
Jul 29, 2024
Add more cast tests ```SQL CREATE TABLE PETS ( id INT4, breed STRING, tag INT2 ) ``` Tests: ```SQL -- #1 should succeed CAST(true AS INT2) -- -- #2 should fail CAST((s : STRING) AS LIST) -- #3 should succeed CAST((i : INT2) AS INT4) -- #4 should succeed CAST((i : INT4) AS INT2) ``` #### Background context As part of a specification work, we want to make the behavior for the #4 more visible: From SQL-99 Section 6.22: <cast specification>: ``` If SD (source data type) is exact numeric or approximate numeric, then Case: i) If there is a representation of SV (source value) in the data type TD (target data type) that does not lose any leading si-gnificant digits after rounding or truncating if necessary, then TV is that representation. The choice of whether to round or truncate is implementation-defined. ii) Otherwise, an exception condition is raised: data exception — numeric value out of range. ``` We can see this evaluation behavior in PostgresSQL v15: Ref.: https://www.db-fiddle.com/f/vMY3Srd2bG6f3NshvTp3w1/0 ``` -- succeeds SELECT CAST((1::INT4) AS INT2); -- fails: `Query Error: error: smallint out of range` SELECT CAST((327686::INT4) AS INT2); ```
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
To reproduce, place this test in
org]partiql/eval/NodeMetadataLookupTest.kt
The text was updated successfully, but these errors were encountered: