Commit 460eee7
authored
Check kind of type in Python (#909)
Moves the kind of type detection from the query for reflection from
EdgeQL to Python because the computed property use in the query turned
out to be too costly:
```
─────────────────────────── Query ───────────────────────────
analyze
with
module schema
select ➊ Type {
➋ kind := assert_exists(
'Object' IF Type IS ObjectType ELSE
➌ 'Scalar' IF Type IS ScalarType ELSE
➍ 'Array' IF Type IS Array ELSE
'NamedTuple' IF ➎ Type[IS Tuple].named ?? false ELSE
➏ 'Tuple' IF Type IS Tuple ELSE
➐ 'Range' IF Type IS Range ELSE
➑ 'MultiRange' IF Type IS MultiRange ELSE
➒ 'Pseudo' IF Type IS PseudoType ELSE
<str>{},
message := "unexpected type",
),
};
────────────────────────────────────────────── Coarse-grained Query Plan ──────────────────────────────────────────────
│ Time Cost Loops Rows Width │ Relations
root │ 2282.4 837696.69 1.0 248.0 32 │ schema::ArrayExprAlias, schema::Tuple, schema::ScalarType,
│ │ schema::Range, schema::RangeExprAlias, schema::MultiRange,
│ │ schema::TupleExprAlias, schema::PseudoType, schema::ObjectType,
│ │ schema::MultiRangeExprAlias, schema::Array
```
vs
```
──────────────────────── Query ────────────────────────
analyze
with
module schema
select ➊ Type {
➋ is_object := Type IS ObjectType,
➌ is_scalar := Type IS ScalarType,
➍ is_array := Type IS Array,
➎ is_named_tuple := Type[IS Tuple].named ?? false,
➏ is_tuple := Type IS Tuple,
➐ is_range := Type IS Range,
➑ is_multi_range := Type IS MultiRange,
➒ is_pseudo := Type IS PseudoType,
};
────────────────────────────────────────────── Coarse-grained Query Plan ──────────────────────────────────────────────
│ Time Cost Loops Rows Width │ Relations
root │ 210.6 6316.56 1.0 248.0 32 │ schema::ArrayExprAlias, schema::Tuple, schema::ScalarType, schema::Range,
│ │ schema::RangeExprAlias, schema::MultiRange, schema::TupleExprAlias,
│ │ schema::PseudoType, schema::ObjectType, schema::MultiRangeExprAlias,
│ │ schema::Array
```1 parent 3e66fe5 commit 460eee7
3 files changed
+148
-24
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
83 | 83 | | |
84 | 84 | | |
85 | 85 | | |
| 86 | + | |
86 | 87 | | |
87 | 88 | | |
88 | 89 | | |
| |||
147 | 148 | | |
148 | 149 | | |
149 | 150 | | |
| 151 | + | |
150 | 152 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
164 | 164 | | |
165 | 165 | | |
166 | 166 | | |
167 | | - | |
168 | | - | |
169 | | - | |
170 | | - | |
171 | | - | |
172 | | - | |
173 | | - | |
174 | | - | |
175 | | - | |
176 | | - | |
177 | | - | |
178 | | - | |
179 | | - | |
180 | 167 | | |
181 | 168 | | |
182 | 169 | | |
183 | 170 | | |
| 171 | + | |
| 172 | + | |
| 173 | + | |
| 174 | + | |
| 175 | + | |
| 176 | + | |
| 177 | + | |
| 178 | + | |
| 179 | + | |
184 | 180 | | |
185 | 181 | | |
186 | 182 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
52 | 51 | | |
53 | 52 | | |
54 | 53 | | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
55 | 67 | | |
56 | 68 | | |
57 | 69 | | |
| |||
221 | 233 | | |
222 | 234 | | |
223 | 235 | | |
224 | | - | |
| 236 | + | |
| 237 | + | |
| 238 | + | |
| 239 | + | |
| 240 | + | |
| 241 | + | |
| 242 | + | |
| 243 | + | |
| 244 | + | |
| 245 | + | |
| 246 | + | |
| 247 | + | |
225 | 248 | | |
226 | 249 | | |
227 | 250 | | |
| |||
246 | 269 | | |
247 | 270 | | |
248 | 271 | | |
249 | | - | |
250 | 272 | | |
251 | 273 | | |
252 | 274 | | |
253 | 275 | | |
254 | 276 | | |
| 277 | + | |
| 278 | + | |
| 279 | + | |
| 280 | + | |
| 281 | + | |
| 282 | + | |
| 283 | + | |
| 284 | + | |
| 285 | + | |
| 286 | + | |
| 287 | + | |
| 288 | + | |
| 289 | + | |
255 | 290 | | |
256 | 291 | | |
257 | 292 | | |
258 | | - | |
259 | 293 | | |
260 | 294 | | |
261 | 295 | | |
262 | 296 | | |
263 | 297 | | |
264 | 298 | | |
265 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
266 | 313 | | |
267 | 314 | | |
268 | 315 | | |
| |||
506 | 553 | | |
507 | 554 | | |
508 | 555 | | |
509 | | - | |
510 | 556 | | |
511 | 557 | | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
512 | 571 | | |
513 | 572 | | |
514 | 573 | | |
| |||
520 | 579 | | |
521 | 580 | | |
522 | 581 | | |
523 | | - | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
524 | 595 | | |
525 | 596 | | |
526 | 597 | | |
| |||
534 | 605 | | |
535 | 606 | | |
536 | 607 | | |
537 | | - | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
538 | 621 | | |
539 | 622 | | |
540 | 623 | | |
| |||
563 | 646 | | |
564 | 647 | | |
565 | 648 | | |
566 | | - | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
567 | 661 | | |
568 | 662 | | |
569 | 663 | | |
| |||
576 | 670 | | |
577 | 671 | | |
578 | 672 | | |
579 | | - | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
580 | 685 | | |
581 | 686 | | |
582 | 687 | | |
| |||
661 | 766 | | |
662 | 767 | | |
663 | 768 | | |
664 | | - | |
| 769 | + | |
665 | 770 | | |
666 | 771 | | |
667 | 772 | | |
| |||
722 | 827 | | |
723 | 828 | | |
724 | 829 | | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
725 | 851 | | |
726 | 852 | | |
727 | 853 | | |
| |||
752 | 878 | | |
753 | 879 | | |
754 | 880 | | |
755 | | - | |
| 881 | + | |
756 | 882 | | |
757 | 883 | | |
758 | 884 | | |
| |||
0 commit comments