|
| 1 | +# TODO: Remaining Parser and Explain Issues |
| 2 | + |
| 3 | +## Current State |
| 4 | + |
| 5 | +- **Tests passing:** 5,197 (76.2%) |
| 6 | +- **Tests skipped:** 1,627 (23.8%) |
| 7 | + - Parser issues: ~675 |
| 8 | + - Explain mismatches: ~637 |
| 9 | + |
| 10 | +## Parser Issues |
| 11 | + |
| 12 | +These require changes to `parser/parser.go`: |
| 13 | + |
| 14 | +### Table/Database Names Starting with Numbers |
| 15 | +Tables and databases with names starting with digits fail to parse: |
| 16 | +```sql |
| 17 | +DROP TABLE IF EXISTS 03657_gby_overflow; |
| 18 | +DROP DATABASE IF EXISTS 03710_database; |
| 19 | +``` |
| 20 | + |
| 21 | +### FORMAT Null |
| 22 | +The `FORMAT Null` clause is not recognized: |
| 23 | +```sql |
| 24 | +SELECT ... FORMAT Null; |
| 25 | +``` |
| 26 | + |
| 27 | +### FETCH FIRST ... ROW ONLY |
| 28 | +SQL standard fetch syntax is not supported: |
| 29 | +```sql |
| 30 | +SELECT ... FETCH FIRST 1 ROW ONLY; |
| 31 | +``` |
| 32 | + |
| 33 | +### INSERT INTO FUNCTION |
| 34 | +Function-based inserts are not supported: |
| 35 | +```sql |
| 36 | +INSERT INTO FUNCTION file('file.parquet') SELECT ...; |
| 37 | +``` |
| 38 | + |
| 39 | +### WITH ... AS Subquery Aliases |
| 40 | +Subquery aliases in FROM clauses with keyword `AS`: |
| 41 | +```sql |
| 42 | +SELECT * FROM (SELECT 1 x) AS alias; |
| 43 | +``` |
| 44 | + |
| 45 | +### String Concatenation Operator || |
| 46 | +The `||` operator in some contexts: |
| 47 | +```sql |
| 48 | +SELECT currentDatabase() || '_test' AS key; |
| 49 | +``` |
| 50 | + |
| 51 | +### MOD/DIV Operators |
| 52 | +The MOD and DIV keywords as operators: |
| 53 | +```sql |
| 54 | +SELECT number MOD 3, number DIV 3 FROM ...; |
| 55 | +``` |
| 56 | + |
| 57 | +### Reserved Keyword Handling |
| 58 | +Keywords like `LEFT`, `RIGHT` used as table aliases: |
| 59 | +```sql |
| 60 | +SELECT * FROM numbers(10) AS left RIGHT JOIN ...; |
| 61 | +``` |
| 62 | + |
| 63 | +### Parameterized Settings |
| 64 | +Settings with `$` parameters: |
| 65 | +```sql |
| 66 | +SET param_$1 = 'Hello'; |
| 67 | +``` |
| 68 | + |
| 69 | +### Incomplete CASE Expression |
| 70 | +CASE without END: |
| 71 | +```sql |
| 72 | +SELECT CASE number -- missing END |
| 73 | +``` |
| 74 | + |
| 75 | +## Explain Output Issues |
| 76 | + |
| 77 | +These require changes to `internal/explain/`: |
| 78 | + |
| 79 | +### Double Equals (==) Operator |
| 80 | +The `==` operator creates extra nested equals/tuple nodes: |
| 81 | +```sql |
| 82 | +SELECT value == '127.0.0.1:9181' |
| 83 | +``` |
| 84 | +Expected: `Function equals` with `Identifier` and `Literal` |
| 85 | +Got: Nested `Function equals` with extra `Function tuple` |
| 86 | + |
| 87 | +### CreateQuery Spacing |
| 88 | +Some ClickHouse versions output extra space before `(children`: |
| 89 | +``` |
| 90 | +CreateQuery d1 (children 1) -- two spaces |
| 91 | +CreateQuery d1 (children 1) -- one space (our output) |
| 92 | +``` |
| 93 | + |
| 94 | +### Server Error Messages in Expected Output |
| 95 | +Some test expected outputs include trailing messages: |
| 96 | +``` |
| 97 | +The query succeeded but the server error '42' was expected |
| 98 | +``` |
| 99 | +These are not part of the actual EXPLAIN output. |
| 100 | + |
| 101 | +## Lower Priority |
| 102 | + |
| 103 | +### DateTime64 with Timezone |
| 104 | +Type parameters with string timezone: |
| 105 | +```sql |
| 106 | +DateTime64(3,'UTC') |
| 107 | +``` |
| 108 | + |
| 109 | +### Complex Type Expressions |
| 110 | +Nested type expressions in column definitions: |
| 111 | +```sql |
| 112 | +CREATE TABLE t (c LowCardinality(UUID)); |
| 113 | +``` |
| 114 | + |
| 115 | +### Parameterized Views |
| 116 | +View definitions with parameters: |
| 117 | +```sql |
| 118 | +CREATE VIEW v AS SELECT ... WHERE x={parity:Int8}; |
| 119 | +``` |
| 120 | + |
| 121 | +## Testing Notes |
| 122 | + |
| 123 | +Run tests with timeout to catch infinite loops: |
| 124 | +```bash |
| 125 | +go test ./parser -timeout 5s -v |
| 126 | +``` |
| 127 | + |
| 128 | +Count test results: |
| 129 | +```bash |
| 130 | +go test ./parser -timeout 5s -v 2>&1 | grep -E 'PASS:|SKIP:' | cut -d':' -f1 | sort | uniq -c |
| 131 | +``` |
| 132 | + |
| 133 | +View explain mismatches: |
| 134 | +```bash |
| 135 | +go test ./parser -timeout 5s -v 2>&1 | grep -A 30 "TODO: Explain output mismatch" | head -100 |
| 136 | +``` |
0 commit comments