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

Function TestClickHouseFinalWithWhere

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

Source from the content-addressed store, hash-verified

118}
119
120func TestClickHouseFinalWithWhere(t *testing.T) {
121 sql := `SELECT * FROM orders FINAL WHERE id > 5`
122 tree, err := parser.ParseWithDialect(sql, keywords.DialectClickHouse)
123 if err != nil {
124 t.Fatalf("unexpected error parsing FINAL with WHERE: %v", err)
125 }
126 if len(tree.Statements) == 0 {
127 t.Fatal("expected at least one statement")
128 }
129 sel, ok := tree.Statements[0].(*ast.SelectStatement)
130 if !ok {
131 t.Fatalf("expected SelectStatement, got %T", tree.Statements[0])
132 }
133 if len(sel.From) == 0 || !sel.From[0].Final {
134 t.Error("expected FINAL=true on first TableReference")
135 }
136 if sel.Where == nil {
137 t.Error("expected WHERE clause to be set")
138 }
139}
140
141func TestClickHouseFinalWithAlias(t *testing.T) {
142 t.Run("ExplicitAlias", func(t *testing.T) {

Callers

nothing calls this directly

Calls 3

ParseWithDialectFunction · 0.92
FatalfMethod · 0.65
ErrorMethod · 0.45

Tested by

no test coverage detected