partiql / partiql-tests

Test data for checking conformance to the PartiQL specification.
Apache License 2.0
7 stars 1 forks source link

Fixes several tests #122

Closed johnedquinn closed 2 weeks ago

johnedquinn commented 1 month ago

Description

In the below sections, I'll elaborate on the tests fixed.

Fixes FROM Mistyping Cases

In the following cases the expression in the FROM clause item has the wrong type. Under the type checking option, all of these cases raise an error and the query fails. Under the permissive option, the cases proceed as follows: Iteration over a scalar value: Consider the query: FROM s AS v AT p or the query: FROM s AS v where s is a scalar value. Then s coerces into the bag << s >>, i.e., the bag that has a single element, the s. The rest of the semantics is identical to what happens when the lhs of the FROM item is a bag.

-- PartiQL Specification Section 5.1.1

Fixes UNPIVOT Mistyping Cases

In the following cases the expression in the FROM UNPIVOT clause item has the “wrong” type, i.e., it is not a tuple. Under the type checking option, all of these cases raise an error and the query fails. Under the permissive option, the cases proceed as follows: ...

-- PartiQL Specification Section 5.2.1

Fixes undefined variable tests

Similarly, for a given 𝑞 at compile (i.e. planning) time, a database type environment... and variables type environment ... are defined. The type environment is a binding tuple ... where each 𝑥𝑖 is a name that is unique and binds to the PartiQL type𝜏𝑖. For schema-less values, 𝜏 can be considered the union of any possible type (for which all operations are potentially applicable).

-- PartiQL Specification Section 3.2

Fixes Join Null Output Cases

For example, LEFT JOIN should make the RHS null if the LHS is not matched.

Fixes Outer Union Mistyping Cases

See https://github.com/partiql/partiql-lang/issues/76

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.