-
Notifications
You must be signed in to change notification settings - Fork 1
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
Fixes missing arguments tests #118
Conversation
output:$missing::null, | ||
} | ||
name: "ABS(MISSING) null propogation", | ||
statement: "ABS(MISSING)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we can clarify this behavior in the spec or some other document before changing the behavior? As the PartiQL spec is currently written, it's unclear to me if these cases would be an error in strict mode.
For most functions/operations (other than equality, IS MISSING
, and some boolean ops), a data type mismatch would result in an error in strict mode and return MISSING
in permissive. E.g.
ABS('some string')
MISSING
in permissive- error in strict
I guess it's less clear to me if a MISSING
literal denotes the same erroring behavior. E.g.
ABS(MISSING)
MISSING
in permissive- error or
MISSING
in strict?
Following @jpschorr's analogy of signaling and quiet NaNs, the MISSING
would have two different types
- Signaling
MISSING
-> data type mismatches, path expression yielding no field - Quiet
MISSING
-> literalMISSING
in the query text or input data
If we are following this signaling vs quiet model, then I would think quiet MISSING
s as a function argument would return a quiet MISSING
in strict mode.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's interesting that the spec is very explicit for the cases in which strict mode would give an error on MISSING
like Section 5.1.1 Mistyping Cases but is less explicit for function arguments in section 7.
The spec does give a direct example using the MISSING
literal in an operation:
Example 28. Each one of these expressions returns MISSING: 5 + missing
but it's unclear whether this applies to both permissive and strict modes.
Regardless of any of the above, I believe the following must have the same result in permissive and strict modes:
We should add a test to ensure this. |
The crux of the issue here is (as noted above) that the spec talks about 3 sources of 'generated'
For cases 1 & 2, the spec differentiates strict and permissive mode, saying that:
For case 3, the spec says it results in a |
The @partiql/partiql maintainers and @almann discussed this PR. As a summary:
If I have missed anything, please feel free to add more comments. |
Description
Fixes around 100 missing arguments tests. Previous ones didn't fail in EvalModeError when inputs were the missing value.
Example of one of the tests:
From the PartiQL Specification (Section 7.1: Inputs with wrong types):
An important thing to note is the use of "the permissive option of PartiQL has to define semantics for the case where the inputs of a function are not compatible with the function/predicate arguments." It goes on to describe the missing value as inputs, and it defines the behavior in permissive mode. It doesn't explicitly specify what happens in strict mode, however, we may assume the same behavior seen in all other sections of the Specification. See Section 5.1.1 Mistyping Cases, Section 5.2.1 Mistyping cases, Section 4.1 Tuple path evaluation on wrongly typed data, etc.
Another example of throwing errors comes down to the role of schema in type checking. From Section 4.1.1:
NOTE: You should review using "Ignore whitespace". I used auto-formatting on fixed test files using the IDE since the formatting was poor.
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.