(t *testing.T)
| 177 | } |
| 178 | |
| 179 | func TestClickHouseFinalWithJoin(t *testing.T) { |
| 180 | sql := `SELECT * FROM orders FINAL JOIN users ON orders.user_id = users.id` |
| 181 | tree, err := parser.ParseWithDialect(sql, keywords.DialectClickHouse) |
| 182 | if err != nil { |
| 183 | t.Fatalf("unexpected error parsing FINAL with JOIN: %v", err) |
| 184 | } |
| 185 | if len(tree.Statements) == 0 { |
| 186 | t.Fatal("expected at least one statement") |
| 187 | } |
| 188 | sel, ok := tree.Statements[0].(*ast.SelectStatement) |
| 189 | if !ok { |
| 190 | t.Fatalf("expected SelectStatement, got %T", tree.Statements[0]) |
| 191 | } |
| 192 | if len(sel.From) == 0 || !sel.From[0].Final { |
| 193 | t.Error("expected FINAL=true on first TableReference") |
| 194 | } |
| 195 | if len(sel.Joins) == 0 { |
| 196 | t.Error("expected at least one JOIN clause") |
| 197 | } |
| 198 | } |
| 199 | |
| 200 | func TestClickHouseFinalNotParsedInOtherDialects(t *testing.T) { |
| 201 | // FINAL is a ClickHouse-specific modifier; in generic dialect it is an |
nothing calls this directly
no test coverage detected