MCPcopy Create free account
hub / github.com/ajitpratap0/GoSQLX / TestClickHouseFinalWithJoin

Function TestClickHouseFinalWithJoin

pkg/sql/parser/clickhouse_test.go:179–198  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

177}
178
179func 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
200func TestClickHouseFinalNotParsedInOtherDialects(t *testing.T) {
201 // FINAL is a ClickHouse-specific modifier; in generic dialect it is an

Callers

nothing calls this directly

Calls 3

ParseWithDialectFunction · 0.92
FatalfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected