Skip to content

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

Open
@alancai98

Description

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.

Metadata

Assignees

No one assigned

    Labels

    V1This is related to the V1 release of PartiQL.bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions