-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Relates to: https://github.com/partiql/partiql-spec/issues/49 Adds the code for typing a query using the current `LogicalPlan` as an `IR`. This PR includes the changes to enable simple SFW queries as the following in both `Strict` and `Permissive` typing modes with `Open` and `Closed` schemas. #### Closed schema with `Strict` typing mode. ```SQL -- customers: <<{'id': INT, 'name': STRING, age: ANY}>> SELECT customers.id, customers.name FROM customers; -- Output schema: <<{'id': INT, 'name': STRING}>> ``` #### Open schema with `Strict` typing mode and `age` non-existent projection. ```SQL -- customers: <<{'id': INT, 'name': STRING}>> SELECT customers.id, customers.name, customers.age FROM customers; -- Output schema: <<{'id': INT, 'name': STRING, 'age': ANY}>> ``` #### Closed Schema with `Permissive` typing mode and `age` non-existent projection. ```SQL -- customers: <<{'id': INT, 'name': STRING>> SELECT customers.id, customers.name, customers.age FROM customers; -- Output schema: <<{'id': INT, 'name': STRING, 'age': NULL}>> ``` See: partiql/partiql-spec#64 #### Open Schema with `Strict` typing mode and `age` in nested attribute. ```SQL -- customers: <<{'id': INT, 'name': STRING, 'details': {'age': INT}}>> SELECT customers.id, customers.name, customers.details.age FROM customers; -- Output schema: <<{'id': INT, 'name': STRING, 'age': INT}>> ``` #### Open Schema (`customers and details`) with `Strict` typing mode. ```SQL -- customers: <<{'id': INT, 'name': STRING, 'details': {'age': INT}}>> SELECT customers.id, customers.name, customers.details.age, customers.details.foo.bar FROM customers; -- Output schema: <<{'id': INT, 'name': STRING, 'age': INT, 'bar': ANY}>> ``` #### Open Schema (`customers and details`) with `Strict` typing mode and `age` in nested attribute with Path in `FROM` with alias. ```SQL -- customers: <<{'id': INT, 'name': STRING, 'details': {'age': INT}}>> SELECT d.age FROM customers.details AS d; -- Output schema: <<{'age': INT}>> ``` See: partiql/partiql-spec#65 #### Closed Schema with `Strict` typing mode with `FROM` and `Projection` aliases. ```SQL -- customers: <<{'id': INT, 'name': STRING, 'age': ANY}>> SELECT c.id AS my_id, customers.name AS my_name FROM customers AS c; -- Output schema: <<{'my_id': INT, 'my_name': STRING}>> ``` In addition: - fixes some issues with the current `partiql_types` macros, changes the model for some of the types, and adds some helper methods to `PartiqlType`. - moves constraints to set - uses ` BTreeSet` for constraints and `AnyOf` to be able to support ordering on the these types; since we're not expecting large number of elements for these types the performance hit seems negligible. Upon merging this commit we need to add: - Support for operators (E.g., unary, binary). - Support for the rest of the Binding Operators (E.g., `Filter`, `OrderBy`). - Support for functions. - Related Conformance Tests.
- Loading branch information
Showing
9 changed files
with
1,101 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
fbaac0f
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.
PartiQL (rust) Benchmark
arith_agg-avg
1212926
ns/iter (± 19035
)1213220
ns/iter (± 12508
)1.00
arith_agg-avg_distinct
1582179
ns/iter (± 27164
)1572893
ns/iter (± 16767
)1.01
arith_agg-count
1511903
ns/iter (± 14718
)1522868
ns/iter (± 23537
)0.99
arith_agg-count_distinct
1533225
ns/iter (± 31524
)1559692
ns/iter (± 22208
)0.98
arith_agg-min
1488384
ns/iter (± 19863
)1521911
ns/iter (± 21203
)0.98
arith_agg-min_distinct
1553106
ns/iter (± 17910
)1579583
ns/iter (± 17113
)0.98
arith_agg-max
1524643
ns/iter (± 56117
)1550883
ns/iter (± 8125
)0.98
arith_agg-max_distinct
1560447
ns/iter (± 21059
)1578388
ns/iter (± 16666
)0.99
arith_agg-sum
1523670
ns/iter (± 12597
)1517316
ns/iter (± 24189
)1.00
arith_agg-sum_distinct
1576659
ns/iter (± 13738
)1557248
ns/iter (± 31386
)1.01
arith_agg-avg-count-min-max-sum
1851634
ns/iter (± 8243
)1851214
ns/iter (± 26914
)1.00
arith_agg-avg-count-min-max-sum-group_by
2244821
ns/iter (± 29424
)2214797
ns/iter (± 57988
)1.01
arith_agg-avg-count-min-max-sum-group_by-group_as
3273668
ns/iter (± 36373
)3307202
ns/iter (± 158680
)0.99
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct
2096917
ns/iter (± 21530
)2092775
ns/iter (± 81306
)1.00
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by
2501800
ns/iter (± 30606
)2505991
ns/iter (± 37844
)1.00
arith_agg-avg_distinct-count_distinct-min_distinct-max_distinct-sum_distinct-group_by-group_as
3480626
ns/iter (± 39961
)3488942
ns/iter (± 42833
)1.00
parse-1
6232
ns/iter (± 117
)6871
ns/iter (± 532
)0.91
parse-15
59143
ns/iter (± 912
)65207
ns/iter (± 33597
)0.91
parse-30
118572
ns/iter (± 1759
)122542
ns/iter (± 4017
)0.97
compile-1
6634
ns/iter (± 98
)6536
ns/iter (± 206
)1.01
compile-15
50958
ns/iter (± 392
)51136
ns/iter (± 1518
)1.00
compile-30
103772
ns/iter (± 924
)110807
ns/iter (± 7807
)0.94
plan-1
79923
ns/iter (± 1133
)77594
ns/iter (± 1283
)1.03
plan-15
1281174
ns/iter (± 23005
)1238399
ns/iter (± 60424
)1.03
plan-30
2552074
ns/iter (± 36714
)2444791
ns/iter (± 68665
)1.04
eval-1
23547100
ns/iter (± 629248
)23777220
ns/iter (± 782446
)0.99
eval-15
128954574
ns/iter (± 1564430
)132054690
ns/iter (± 948550
)0.98
eval-30
245984294
ns/iter (± 3999203
)247631799
ns/iter (± 4043217
)0.99
join
15317
ns/iter (± 283
)15542
ns/iter (± 392
)0.99
simple
4070
ns/iter (± 77
)4204
ns/iter (± 129
)0.97
simple-no
685
ns/iter (± 14
)682
ns/iter (± 28
)1.00
numbers
62
ns/iter (± 0
)52
ns/iter (± 1
)1.19
parse-simple
937
ns/iter (± 7
)920
ns/iter (± 125
)1.02
parse-ion
2832
ns/iter (± 23
)2630
ns/iter (± 34
)1.08
parse-group
8551
ns/iter (± 127
)8681
ns/iter (± 539
)0.99
parse-complex
23275
ns/iter (± 464
)23262
ns/iter (± 466
)1.00
parse-complex-fexpr
34548
ns/iter (± 779
)33925
ns/iter (± 968
)1.02
This comment was automatically generated by workflow using github-action-benchmark.