Skip to content
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

[v1] Function data type mismatches (known at compile-time) return missing in strict mode #1680

Open
alancai98 opened this issue Dec 13, 2024 · 2 comments
Labels
bug Something isn't working V1 This is related to the V1 release of PartiQL.

Comments

@alancai98
Copy link
Member

Description

Currently, PError.FUNCTION_TYPE_MISMATCH has a default severity of warning. Because of this, the standard error listener used during planning will not give an error in strict mode when there's a function data type mismatch. The function data type mismatch will create a RexError node --

false -> PErrors.functionTypeMismatch(null, node.identifier, argTypes, candidates)
}
return errorRexAndReport(_listener, problem)
. After planning, that error node will be converted into an ExprMissing node.

To Reproduce

Run the following query in strict mode

'foo' || 123

^ will output missing

If the type involved in the function/operation is not always a data type mismatch, the query will give the expected error at evaluation time:

SELECT v.a + 2 FROM [{'a':1}, {'a':'foo'}] v

^ will error:

org.partiql.errors.TypeCheckException: Could not find function plus with types: [STRING, INTEGER].

Expected Behavior

  • Expect the query 'foo' || 123 to give an error in strict mode
  • I think we should also make function data type mismatches (PError.FUNCTION_TYPE_MISMATCH) an error by default so the standard error listener will give an error at plan-time

Additional Context

  • Java version: 11
  • PartiQL version: v1 rc.3
  • Add any other context about the problem here.
@alancai98 alancai98 added bug Something isn't working V1 This is related to the V1 release of PartiQL. labels Dec 13, 2024
@RCHowell
Copy link
Member

We will need to re-enable the spec tests so this gets caught now that we better understand the desired behavior here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working V1 This is related to the V1 release of PartiQL.
Projects
None yet
Development

No branches or pull requests

2 participants