-
Notifications
You must be signed in to change notification settings - Fork 628
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SQL: allow identifier with placeholder such as '${a_1}'
Close #3169. Some? dialects support shell-like variable substitution. HiveQL is one of such dialects. https://cwiki.apache.org/confluence/display/Hive/LanguageManual+VariableSubstitution With this change, the SQL parser accepts '${var}' as a part of an identifier. TODO: `var` itself can be extracted as a reference tag. Signed-off-by: Masatake YAMATO <[email protected]>
- Loading branch information
Showing
4 changed files
with
118 additions
and
8 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
--sort=no |
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,18 @@ | ||
tb_name${dt} input.sql /^create table database.tb_name${dt} as$/;" t | ||
col_a input.sql /^select col_a, col_b from database.tb_name;$/;" E table:tb_name${dt} | ||
col_b input.sql /^select col_a, col_b from database.tb_name;$/;" E table:tb_name${dt} | ||
tb_name${dt}${dt0} input.sql /^create table database.tb_name${dt}${dt0} as$/;" t | ||
col_a input.sql /^select col_a, col_b from database.tb_name;$/;" E table:tb_name${dt}${dt0} | ||
col_b input.sql /^select col_a, col_b from database.tb_name;$/;" E table:tb_name${dt}${dt0} | ||
${dt1}tb_name${dt}${dt0} input.sql /^create table database.${dt1}tb_name${dt}${dt0} as$/;" t | ||
col_a input.sql /^select col_a, col_b from database.tb_name;$/;" E table:${dt1}tb_name${dt}${dt0} | ||
col_b input.sql /^select col_a, col_b from database.tb_name;$/;" E table:${dt1}tb_name${dt}${dt0} | ||
${dt1}tb_name${dt}${dt0}Z input.sql /^create table database.${dt1}tb_name${dt}${dt0}Z as$/;" t | ||
col_a input.sql /^select col_a, col_b from database.tb_name;$/;" E table:${dt1}tb_name${dt}${dt0}Z | ||
col_b input.sql /^select col_a, col_b from database.tb_name;$/;" E table:${dt1}tb_name${dt}${dt0}Z | ||
tb_${dt2}_name input.sql /^create table database.tb_${dt2}_name as$/;" t | ||
col_${key0} input.sql /^select col_${key0}, col_${key1} from database.tb_name;$/;" E table:tb_${dt2}_name | ||
col_${key1} input.sql /^select col_${key0}, col_${key1} from database.tb_name;$/;" E table:tb_${dt2}_name | ||
tb_${${d}${t:h}${i}}_name input.sql /^create table database.tb_${${d}${t:h}${i}}_name as$/;" t | ||
col_${key${n}${m}a} input.sql /^select col_${key${n}${m}a}, col_${key${m}${n}b} from database.tb_name;$/;" E table:tb_${${d}${t:h}${i}}_name | ||
col_${key${m}${n}b} input.sql /^select col_${key${n}${m}a}, col_${key${m}${n}b} from database.tb_name;$/;" E table:tb_${${d}${t:h}${i}}_name |
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,19 @@ | ||
-- Based on issue #3169 opened by @Appalled | ||
|
||
create table database.tb_name${dt} as | ||
select col_a, col_b from database.tb_name; | ||
|
||
create table database.tb_name${dt}${dt0} as | ||
select col_a, col_b from database.tb_name; | ||
|
||
create table database.${dt1}tb_name${dt}${dt0} as | ||
select col_a, col_b from database.tb_name; | ||
|
||
create table database.${dt1}tb_name${dt}${dt0}Z as | ||
select col_a, col_b from database.tb_name; | ||
|
||
create table database.tb_${dt2}_name as | ||
select col_${key0}, col_${key1} from database.tb_name; | ||
|
||
create table database.tb_${${d}${t:h}${i}}_name as | ||
select col_${key${n}${m}a}, col_${key${m}${n}b} from database.tb_name; |
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