Skip to content

Commit

Permalink
Minor additions to PartiQL types API (#467)
Browse files Browse the repository at this point in the history
Add additional APIs to shape
  • Loading branch information
am357 authored Jun 21, 2024
1 parent 8a12ed6 commit 3165ebd
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions partiql-types/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -208,6 +208,11 @@ impl StaticType {
pub fn is_nullable(&self) -> bool {
self.nullable
}

#[must_use]
pub fn is_not_nullable(&self) -> bool {
!self.nullable
}
}

impl Display for StaticType {
Expand Down Expand Up @@ -272,7 +277,6 @@ impl PartiqlShape {
pub const fn new(ty: StaticTypeVariant) -> PartiqlShape {
PartiqlShape::Static(StaticType { ty, nullable: true })
}

#[must_use]
pub const fn new_non_nullable(ty: StaticTypeVariant) -> PartiqlShape {
PartiqlShape::Static(StaticType {
Expand All @@ -281,6 +285,18 @@ impl PartiqlShape {
})
}

#[must_use]
pub fn as_non_nullable(&self) -> Option<PartiqlShape> {
if let PartiqlShape::Static(stype) = self {
Some(PartiqlShape::Static(StaticType {
ty: stype.ty.clone(),
nullable: false,
}))
} else {
None
}
}

#[must_use]
pub fn new_dynamic() -> PartiqlShape {
PartiqlShape::Dynamic
Expand Down Expand Up @@ -607,8 +623,8 @@ impl StructField {
}

#[must_use]
pub fn is_optional(&self) -> &bool {
&self.optional
pub fn is_optional(&self) -> bool {
self.optional
}
}

Expand Down

1 comment on commit 3165ebd

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PartiQL (rust) Benchmark

Benchmark suite Current: 3165ebd Previous: 8a12ed6 Ratio
arith_agg-avg 765080 ns/iter (± 20313) 764897 ns/iter (± 11708) 1.00
arith_agg-avg_distinct 869072 ns/iter (± 19926) 852499 ns/iter (± 2696) 1.02
arith_agg-count 812004 ns/iter (± 34468) 811565 ns/iter (± 13862) 1.00
arith_agg-count_distinct 848851 ns/iter (± 1785) 843777 ns/iter (± 8580) 1.01
arith_agg-min 821924 ns/iter (± 1881) 817531 ns/iter (± 5082) 1.01
arith_agg-min_distinct 853578 ns/iter (± 3633) 849593 ns/iter (± 4399) 1.00
arith_agg-max 826518 ns/iter (± 3755) 823164 ns/iter (± 3323) 1.00
arith_agg-max_distinct 858887 ns/iter (± 2981) 860020 ns/iter (± 4826) 1.00
arith_agg-sum 819889 ns/iter (± 2350) 819087 ns/iter (± 2677) 1.00
arith_agg-sum_distinct 852680 ns/iter (± 3038) 850804 ns/iter (± 1871) 1.00
arith_agg-avg-count-min-max-sum 966013 ns/iter (± 2511) 960812 ns/iter (± 3411) 1.01
arith_agg-avg-count-min-max-sum-group_by 1263789 ns/iter (± 74251) 1226382 ns/iter (± 20768) 1.03
arith_agg-avg-count-min-max-sum-group_by-group_as 1877974 ns/iter (± 7831) 1812248 ns/iter (± 42641) 1.04
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct 1251345 ns/iter (± 29858) 1221422 ns/iter (± 17797) 1.02
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by 1603792 ns/iter (± 21302) 1555506 ns/iter (± 10833) 1.03
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by-group_as 2211008 ns/iter (± 14009) 2148403 ns/iter (± 8258) 1.03
parse-1 4242 ns/iter (± 204) 4381 ns/iter (± 31) 0.97
parse-15 38562 ns/iter (± 79) 40072 ns/iter (± 130) 0.96
parse-30 75836 ns/iter (± 133) 79358 ns/iter (± 281) 0.96
compile-1 4307 ns/iter (± 43) 4218 ns/iter (± 31) 1.02
compile-15 33187 ns/iter (± 306) 32362 ns/iter (± 107) 1.03
compile-30 68944 ns/iter (± 382) 67065 ns/iter (± 167) 1.03
plan-1 67662 ns/iter (± 944) 67514 ns/iter (± 1186) 1.00
plan-15 1054792 ns/iter (± 17808) 1045666 ns/iter (± 24412) 1.01
plan-30 2109490 ns/iter (± 6932) 2100608 ns/iter (± 29789) 1.00
eval-1 12835001 ns/iter (± 221934) 13460455 ns/iter (± 157257) 0.95
eval-15 88225079 ns/iter (± 866513) 88050839 ns/iter (± 754363) 1.00
eval-30 169301613 ns/iter (± 457580) 168973117 ns/iter (± 2646837) 1.00
join 9923 ns/iter (± 45) 9728 ns/iter (± 57) 1.02
simple 2461 ns/iter (± 20) 2488 ns/iter (± 35) 0.99
simple-no 441 ns/iter (± 10) 434 ns/iter (± 1) 1.02
numbers 57 ns/iter (± 0) 57 ns/iter (± 0) 1
parse-simple 552 ns/iter (± 15) 544 ns/iter (± 4) 1.01
parse-ion 1779 ns/iter (± 5) 1754 ns/iter (± 5) 1.01
parse-group 5754 ns/iter (± 23) 5789 ns/iter (± 20) 0.99
parse-complex 14571 ns/iter (± 406) 14885 ns/iter (± 661) 0.98
parse-complex-fexpr 21477 ns/iter (± 73) 22649 ns/iter (± 120) 0.95

This comment was automatically generated by workflow using github-action-benchmark.

Please sign in to comment.