Commit e3780a9
authored
vef: add stateful encoder to Field/Item (#66)
TypeEncoder ia a per-Field or Item object that holds encoding state
across rows. Previously, every encode call allocated a new output buffer
from mem_root; now a single scratch buffer (sized to persisted_length)
is allocated once and reused for the lifetime of the Field's TABLE or
the Item's query execution.
For VDF-based encode ops, the VDF call structures (vef_invalue_t,
vef_vdf_args_t, vef_vdf_result_t) are pre-filled at construction time,
so only the per-row fields (input pointer/length, result type) are
touched on each call.
TypeEncoder is lazily created via GetTypeEncoderFor and cached on the
Field or Item. Item::cleanup() nulls the pointer between
prepared-statement re-executions so a fresh encoder is allocated on the
new thd->mem_root next execution. Temporary table encoders are tied to
the TABLE_SHARE::mem_root of the temporary table.
The public encode API in util.h is simplified: callers no longer pass
MEM_ROOT, field_name, or TypeContext — the encoder resolves these from
the Field or Item itself.1 parent 53fd68f commit e3780a9
17 files changed
Lines changed: 485 additions & 159 deletions
File tree
- mysql-test/suite/villagesql
- ps
- r
- t
- select
- r
- t
- sql
- villagesql/types
Lines changed: 18 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
Lines changed: 31 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
Lines changed: 9 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
Lines changed: 33 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
Lines changed: 19 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
63 | 63 | | |
64 | 64 | | |
65 | 65 | | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
66 | 70 | | |
67 | 71 | | |
68 | 72 | | |
| |||
1885 | 1889 | | |
1886 | 1890 | | |
1887 | 1891 | | |
| 1892 | + | |
1888 | 1893 | | |
| 1894 | + | |
1889 | 1895 | | |
1890 | 1896 | | |
1891 | 1897 | | |
1892 | 1898 | | |
1893 | 1899 | | |
1894 | 1900 | | |
1895 | 1901 | | |
| 1902 | + | |
| 1903 | + | |
| 1904 | + | |
| 1905 | + | |
| 1906 | + | |
1896 | 1907 | | |
1897 | 1908 | | |
1898 | 1909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4331 | 4331 | | |
4332 | 4332 | | |
4333 | 4333 | | |
4334 | | - | |
4335 | | - | |
| 4334 | + | |
4336 | 4335 | | |
4337 | 4336 | | |
4338 | 4337 | | |
| |||
4492 | 4491 | | |
4493 | 4492 | | |
4494 | 4493 | | |
4495 | | - | |
4496 | | - | |
| 4494 | + | |
| 4495 | + | |
4497 | 4496 | | |
4498 | 4497 | | |
4499 | 4498 | | |
| |||
7062 | 7061 | | |
7063 | 7062 | | |
7064 | 7063 | | |
7065 | | - | |
7066 | | - | |
7067 | | - | |
| 7064 | + | |
| 7065 | + | |
7068 | 7066 | | |
7069 | 7067 | | |
7070 | 7068 | | |
| |||
7113 | 7111 | | |
7114 | 7112 | | |
7115 | 7113 | | |
7116 | | - | |
7117 | | - | |
| 7114 | + | |
| 7115 | + | |
7118 | 7116 | | |
7119 | 7117 | | |
7120 | 7118 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
82 | 86 | | |
83 | 87 | | |
84 | 88 | | |
| |||
1277 | 1281 | | |
1278 | 1282 | | |
1279 | 1283 | | |
1280 | | - | |
| 1284 | + | |
| 1285 | + | |
| 1286 | + | |
| 1287 | + | |
1281 | 1288 | | |
1282 | 1289 | | |
1283 | 1290 | | |
| |||
3748 | 3755 | | |
3749 | 3756 | | |
3750 | 3757 | | |
| 3758 | + | |
3751 | 3759 | | |
3752 | 3760 | | |
3753 | 3761 | | |
3754 | 3762 | | |
3755 | 3763 | | |
3756 | 3764 | | |
3757 | 3765 | | |
| 3766 | + | |
| 3767 | + | |
| 3768 | + | |
| 3769 | + | |
3758 | 3770 | | |
3759 | 3771 | | |
3760 | 3772 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1482 | 1482 | | |
1483 | 1483 | | |
1484 | 1484 | | |
1485 | | - | |
1486 | | - | |
1487 | | - | |
| 1485 | + | |
| 1486 | + | |
1488 | 1487 | | |
1489 | 1488 | | |
1490 | 1489 | | |
| |||
1733 | 1732 | | |
1734 | 1733 | | |
1735 | 1734 | | |
1736 | | - | |
1737 | | - | |
1738 | | - | |
| 1735 | + | |
| 1736 | + | |
1739 | 1737 | | |
1740 | 1738 | | |
1741 | 1739 | | |
| |||
0 commit comments