-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement EXCEPT and REPLACE in select item (#196)
* Implement EXCEPT and REPLACE * Update testdata * Fix lookaheadSetOperatorExcept * Add comment * Rename to StarModifierExcept, StarModifierReplace * Fix DotStar.end * Make IF and GRAPH_TABLE as a keyword, and add IfExpr * Update testdata
- Loading branch information
Showing
37 changed files
with
1,989 additions
and
12 deletions.
There are no files selected for viewing
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT (SELECT T.* EXCEPT (s)) AS n FROM (SELECT 1 AS n, "foo" AS s) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT (SELECT T.* EXCEPT ALL SELECT T.*) AS n FROM (SELECT 1 AS n) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT (SELECT T.* EXCEPT DISTINCT SELECT T.*) AS n FROM (SELECT 1 AS n) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT T.* FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT T.* EXCEPT (vegetable) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT T.* EXCEPT (vegetable) REPLACE ("orange" AS fruit) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT T.* REPLACE ("orange" AS fruit) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) AS T |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT * FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT * EXCEPT (vegetable) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT * EXCEPT (vegetable) REPLACE ("orange" AS fruit) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
SELECT * REPLACE ("orange" AS fruit) FROM (SELECT "apple" AS fruit, "carrot" AS vegetable) |
101 changes: 101 additions & 0 deletions
101
testdata/result/query/edge_case_dot_star_except.sql.txt
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,101 @@ | ||
--- edge_case_dot_star_except.sql | ||
SELECT (SELECT T.* EXCEPT (s)) AS n FROM (SELECT 1 AS n, "foo" AS s) AS T | ||
--- AST | ||
&ast.QueryStatement{ | ||
Query: &ast.Select{ | ||
Results: []ast.SelectItem{ | ||
&ast.Alias{ | ||
Expr: &ast.ScalarSubQuery{ | ||
Lparen: 7, | ||
Rparen: 29, | ||
Query: &ast.Select{ | ||
Select: 8, | ||
Results: []ast.SelectItem{ | ||
&ast.DotStar{ | ||
Star: 17, | ||
Expr: &ast.Ident{ | ||
NamePos: 15, | ||
NameEnd: 16, | ||
Name: "T", | ||
}, | ||
Except: &ast.StarModifierExcept{ | ||
Except: 19, | ||
Rparen: 28, | ||
Columns: []*ast.Ident{ | ||
&ast.Ident{ | ||
NamePos: 27, | ||
NameEnd: 28, | ||
Name: "s", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
As: &ast.AsAlias{ | ||
As: 31, | ||
Alias: &ast.Ident{ | ||
NamePos: 34, | ||
NameEnd: 35, | ||
Name: "n", | ||
}, | ||
}, | ||
}, | ||
}, | ||
From: &ast.From{ | ||
From: 36, | ||
Source: &ast.SubQueryTableExpr{ | ||
Lparen: 41, | ||
Rparen: 67, | ||
Query: &ast.Select{ | ||
Select: 42, | ||
Results: []ast.SelectItem{ | ||
&ast.Alias{ | ||
Expr: &ast.IntLiteral{ | ||
ValuePos: 49, | ||
ValueEnd: 50, | ||
Base: 10, | ||
Value: "1", | ||
}, | ||
As: &ast.AsAlias{ | ||
As: 51, | ||
Alias: &ast.Ident{ | ||
NamePos: 54, | ||
NameEnd: 55, | ||
Name: "n", | ||
}, | ||
}, | ||
}, | ||
&ast.Alias{ | ||
Expr: &ast.StringLiteral{ | ||
ValuePos: 57, | ||
ValueEnd: 62, | ||
Value: "foo", | ||
}, | ||
As: &ast.AsAlias{ | ||
As: 63, | ||
Alias: &ast.Ident{ | ||
NamePos: 66, | ||
NameEnd: 67, | ||
Name: "s", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
As: &ast.AsAlias{ | ||
As: 69, | ||
Alias: &ast.Ident{ | ||
NamePos: 72, | ||
NameEnd: 73, | ||
Name: "T", | ||
}, | ||
}, | ||
}, | ||
}, | ||
}, | ||
} | ||
|
||
--- SQL | ||
SELECT (SELECT T.* EXCEPT (s)) AS n FROM (SELECT 1 AS n, "foo" AS s) AS T |
Oops, something went wrong.