forked from google/zetasql
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
1. map type available in `type` and `table_column_schema`. 2. construct map value with `map(key1, value1, ...)` function construct by map literal, like `{key1: value1, ... }` is not supported, since usage of `{` & `:` is undetermined, possible compatibility issue with JavaCC. 3. access value in map with `[]` or `.`(dot) operator
- Loading branch information
1 parent
3c9cf36
commit 55be108
Showing
11 changed files
with
233 additions
and
9 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
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
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
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,72 @@ | ||
# construct map data type from map function | ||
# access map value by []operator | ||
# | ||
# we represent '[]' in syntax tree with ArrayElement, but it can | ||
# also apply to map values | ||
select map("k", "v")["k"] | ||
-- | ||
QueryStatement [0-25] | ||
Query [0-25] | ||
Select [0-25] | ||
SelectList [7-25] | ||
SelectColumn [7-25] | ||
ArrayElement [20-25] | ||
FunctionCall [7-20] | ||
PathExpression [7-10] | ||
Identifier(`map`) [7-10] | ||
StringLiteral("k") [11-14] | ||
StringLiteral("v") [16-19] | ||
StringLiteral("k") [21-24] | ||
-- | ||
SELECT | ||
`map`("k", "v")["k"] | ||
== | ||
|
||
select map("k", "v").k | ||
-- | ||
QueryStatement [0-22] | ||
Query [0-22] | ||
Select [0-22] | ||
SelectList [7-22] | ||
SelectColumn [7-22] | ||
DotIdentifier [20-22] | ||
FunctionCall [7-20] | ||
PathExpression [7-10] | ||
Identifier(`map`) [7-10] | ||
StringLiteral("k") [11-14] | ||
StringLiteral("v") [16-19] | ||
Identifier(k) [21-22] | ||
-- | ||
SELECT | ||
`map`("k", "v").k | ||
== | ||
|
||
# casting to map type | ||
select cast(col as MAP<STRING, TIMESTAMP>) | ||
-- | ||
QueryStatement [0-42] | ||
Query [0-42] | ||
Select [0-42] | ||
SelectList [7-42] | ||
SelectColumn [7-42] | ||
CastExpression [7-42] | ||
PathExpression [12-15] | ||
Identifier(col) [12-15] | ||
MapType [19-41] | ||
SimpleType [23-29] | ||
PathExpression [23-29] | ||
Identifier(STRING) [23-29] | ||
SimpleType [31-40] | ||
PathExpression [31-40] | ||
Identifier(TIMESTAMP) [31-40] | ||
-- | ||
SELECT | ||
CAST(col AS MAP< STRING, TIMESTAMP >) | ||
== | ||
|
||
select cast(col as MAP<>) | ||
-- | ||
ERROR: Syntax error: Unexpected ">" [at 1:24] | ||
select cast(col as MAP<>) | ||
^ | ||
== |
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
Oops, something went wrong.