-
Notifications
You must be signed in to change notification settings - Fork 9
Adds PartiqlShapeBuilder
with NodeId
generation for the StaticType
#485
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
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #485 +/- ##
==========================================
- Coverage 81.00% 80.98% -0.03%
==========================================
Files 69 69
Lines 18704 18796 +92
Branches 18704 18796 +92
==========================================
+ Hits 15152 15221 +69
- Misses 3110 3131 +21
- Partials 442 444 +2 ☔ View full report in Codecov by Sentry. |
Conformance comparison report
Number passing in both: 5731 Number failing in both: 612 Number passing in Base (e5b8ce7) but now fail: 0 Number failing in Base (e5b8ce7) but now pass: 0 |
This PR - adds `NodeId` to `StaticType`. - makes `AutoNodeIdGenerator` thread-safe - adds `PartiqlShapeBuilder` and moves some `PartiqlShape` APIs to it; this is to be able to generate unique `NodeId`s for a `PartiqlShape` that includes static types that themselves can include other static types. - adds a static thread safe `shape_builder` function that provides a convenient way for using `PartiqlShapeBuilder` for creating new shapes. - prepends existing type macros with `type` such as `type_int!` to make macro names more friendly. - removes `const` PartiQL types under `partiql-types` in favor of `PartiqlShapeBuilder`.
0801a40
to
b40fdc6
Compare
0955cfd
to
fd3badd
Compare
fd3badd
to
1b946b4
Compare
PartiqlShapeBuilder
with NodeId
generation for to the StaticType
PartiqlShapeBuilder
with NodeId
generation for the StaticType
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.
PartiqlShapeBuilder.any_of
:
pub fn any_of<I>(&self, types: I) -> PartiqlShape
where
I: IntoIterator<Item = PartiqlShape>,
{
let any_of = AnyOf::from_iter(types);
match any_of.types.len() {
0 => type_dynamic!(),
1 => {
let AnyOf { types } = any_of;
types.into_iter().next().unwrap()
}
// TODO figure out what does it mean for a Union to be nullable or not
_ => PartiqlShape::AnyOf(any_of),
}
}
The AnyOf::from_iter(types)
uses an IndexSet
internally to deduplicate types, thus the match on any_of.types.len()
could "flatten" AnyOf
s that had duplicates. With the addition of IDs, this deduplication no longer happens...
Description of changes:
This PR
NodeId
toStaticType
; this is to be able to use theid
as a reference to add additional data to the types out of band.AutoNodeIdGenerator
thread-safePartiqlShapeBuilder
and moves somePartiqlShape
APIs to it; this is to be able to generate uniqueNodeId
s for aPartiqlShape
that includes static types that themselves can include other static types.shape_builder
function that provides a convenient way for usingPartiqlShapeBuilder
for creating new shapes.type
such astype_int!
to make macro names more friendly.const
PartiQL types underpartiql-types
in favor ofPartiqlShapeBuilder
.The majority of the diffs are related to the macro renames or replacement with the previous
const
types. The main change is inpartiql-types/src/lib.rs
file.By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.