partiql / partiql-lang-kotlin

PartiQL libraries and tools in Kotlin.
https://partiql.org/
Apache License 2.0
536 stars 60 forks source link

[DRAFT] Initializes PartiQL Shape #1408

Open johnedquinn opened 3 months ago

johnedquinn commented 3 months ago

THIS IS A DRAFT

Description

Overview

For the purposes of showing what PartiQL Shape could potentially look like, I've written this POC. Some of the prevalent aspects of this POC include:

At this stage of the POC, PartiQL Shape has been able to successfully replace StaticType with all of the PlanTyperTestsPorted. The function outcome tests are failing (due to lack of support for nullable types, but that is a quick fix).

What is the impact?

We now can fully conform to SQL:1999 with parameterized types. Also, our type semantics can also match what SQL:1999 prescribes. Gone are the days of converting StaticType to a runtime type for function resolution -- this had many issues. We now just use the runtime type directly for function resolution -- why wouldn't we? Also, we now support nullable types -- the lack of this also previously caused issues with type inference, function resolution, and aggregate function resolution. We've fully supported the DYNAMIC type and have made the distinction from the ALL type clear. ALL is now gone.

What is next?

There is a lot to go, namely:

How can I (the reviewer) read this PR?

Well, I'd first take a look at package org.partiql.shape under the partiql-types sub-project. You may see many similarities to Ion Schema -- as it was used as a guide in several situations. I'd also look at org.partiql.value under the same sub-project to see the new runtime types.

Other Information

License Information

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