Repository navigation
perf: dialect-regions optimizations, benchmark cleanup and MULTIDIALECT-only trigger - #333
Merged
tkaunlaky-e6 merged 17 commits intoOct 30, 2026
Conversation
…conversion - parser: inline hot helpers (_advance, Expression.__init__, Parser.expression), fast exits in _parse_types, _parse_select_query, _parse_range and _parse_bitwise when no matching token follows, inlined _match_set in operator-precedence loops, faster _match_text_seq and update_positions - helpers: normalize_unicode_spaces as precompiled regexes (fast path when nothing to replace); apply_e6_ast_transforms as an explicit stack walk - e6: build the quote_identifier keyword set once at module level; indent fast path when no line toggles quote state Output is identical on all 1,628 Samsung + Conde Nast queries (both tokenizers, pretty on and off). Test suite unchanged: 937 passed / 4 skipped (Python tokenizer), 940 passed / 1 skipped (Rust tokenizer).
perf: cut parser, cleanup and e6 generator overhead in subquery-tree conversion
…match - parser: return early when the next token can't start what is being probed (alias, set operation, window, lambda tail on ")"/","/end; interval only on INTERVAL; AT TIME ZONE only on AT), inline bracket/look-ahead/comment checks in _parse_bracket, _match, _parse_select and _parse_function - expressions: precompute each class's mandatory arg keys for error_messages - generator: call maybe_comment only for nodes that have comments; e6 cast_sql compares the INTERVAL type directly; e6 indent returns early for single lines - pipeline: LiteParser._skip scans by index and advances once; the e6 transform walk reads node.args directly; plain substring pre-checks before the STRUCT and unicode-space regexes Test suite unchanged: 937 passed / 4 skipped (Python tokenizer), 940 passed / 1 skipped (Rust tokenizer).
They documented the measurements behind the region-token and parser changes; nothing imports them. Keeps the upstream benchmarks/ (bench, optimize, parse).
…e' into codex/experiment-dialect-regions # Conflicts: # converter_api.py
- ruff format the files the subtree/hybrid/region-token work left unformatted - lite_parse: cast the parsed tree to its declared return type - parse_region: name the token-reuse parse result separately so mypy sees the None check - region_tokens: '# type: ignore' the sqlglotrs import, as sqlglot.tokens does - _region_to_e6: from_sql is Optional (the subquery tree passes None) - setup.cfg: skip mypy errors in converter_api, as for guardrail (tests now import it)
SUBQUERY_TREE now only picks the multidialect method (subquery tree vs split_pg_outer); the path itself is triggered by the MULTIDIALECT feature flag (or SAMSUNG_TABLEAU_DASHBOARD). Before, a deployment with SUBQUERY_TREE on sent every request through the subquery tree, plain single-dialect ones included, ignoring from_sql. The corpus tests' subtree mode now sends MULTIDIALECT, and a test pins that SUBQUERY_TREE alone does not reach the tree.
Benchmark for 40c397aClick to view benchmark
|
tkaunlaky-e6
merged commit Oct 30, 2026
cae1417
into
wip/e6-multidialect-subquery-tree
2 checks passed
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Brings the dialect-regions performance work into
wip/e6-multidialect-subquery-tree, removes the benchmark artifacts, and makesSUBQUERY_TREEa method switch instead of a trigger.Commits
)/,/ end; interval only onINTERVAL;AT TIME ZONEonly onAT), inlined look-ahead and comment checks, precomputed mandatory arg keys,maybe_commentonly for nodes with comments, e6indentsingle-line shortcut, index-basedLiteParser._skip, direct e6 transform walk, substring pre-checks before the STRUCT and unicode-space regexes.benchmarks/added on this branch (reports, scripts,results/). Nothing imports them; the upstreambenchmarks/files stay.wip/e6-multidialect-subquery-tree— one conflict inconverter_api.py: wip's HYBRID layout is kept and the subquery-tree call usesemit_tokensso region tokens are reused.lite_parser,subquery_tree,region_tokens,_region_to_e6, andconverter_apiadded to the mypy ignore list next toguardrail(the corpus tests import it).SUBQUERY_TREEnow only picks the method (subquery tree vssplit_pg_outer); the path is triggered by theMULTIDIALECTfeature flag orSAMSUNG_TABLEAU_DASHBOARD. Before, a deployment withSUBQUERY_TREEon sent every request through the tree, plain single-dialect ones included.Flags
MULTIDIALECTENABLE_MULTIDIALECT_TRANSPILEis on)SUBQUERY_TREEtrue= subquery tree,false= old splitSAMSUNG_TABLEAU_DASHBOARDHYBRID_MULTIDIALECTTesting
make check: style (ruff, ruff-format, mypy) passes;make testandmake test-rspass.SUBQUERY_TREEon withoutMULTIDIALECTdoes not reach the tree.Performance vs
wip/e6-multidialect-subquery-treeMeasured on this PR's head in Docker: 1 CPU per container, 3 repeats, the same 1,628 Samsung + Condé Nast queries; output identical on all 1,628.
Samsung only (704 queries), Rust, pretty on:
Peak RSS is about 20 MB higher (271 → 292 MiB).