Skip to content

Commit 6417020

Browse files
committed
query_details parser: stop matching leading \b
1 parent f306c00 commit 6417020

File tree

2 files changed

+5
-6
lines changed

2 files changed

+5
-6
lines changed

presto/plan_node/details.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ type (
2424
var (
2525
planNodeDetailLexer = lexer.MustStateful(lexer.Rules{
2626
"Root": {
27-
{"DataType", `(?i)\b(BIGINT|INTEGER|SMALLINT|TINYINT|REAL|DECIMAL|VARCHAR|DATE|TIMESTAMP)\b`, nil},
28-
{"Cast", `(?i)\bCAST\b`, nil},
29-
{"As", `(?i)\bAS\b`, nil},
27+
{"DataType", `(?i)(BIGINT|INTEGER|SMALLINT|TINYINT|REAL|DECIMAL|VARCHAR|DATE|TIMESTAMP)\b`, nil},
28+
{"Cast", `(?i)CAST\b`, nil},
29+
{"As", `(?i)AS\b`, nil},
3030
{"Ident", `[a-zA-Z_$][\w.$]*`, nil},
3131
{"Int", `-?\d+`, nil},
3232
{"Assign", `:=`, nil},
@@ -41,7 +41,7 @@ var (
4141
PlanNodeDetailParserOptions = []participle.Option{
4242
participle.Lexer(planNodeDetailLexer),
4343
participle.CaseInsensitive("DataType", "Cast", "As"),
44-
participle.Elide("Whitespace", "EOL"),
44+
participle.Elide("Whitespace"),
4545
participle.Union[Value](
4646
&HiveColumnHandle{},
4747
&FunctionCall{},

presto/plan_node/details_test.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,8 +179,7 @@ func TestParseAssignment(t *testing.T) {
179179
`array_agg_51 := "presto.default.array_agg"((name_35)) ORDER BY OrderingScheme {orderBy='[Ordering {variable='name_35', sortOrder='ASC_NULLS_LAST'}]', orderings='{name_35=ASC_NULLS_LAST}'} (6:21)`,
180180
`branded_car_enrollment.target_id := car_id (22:5)`,
181181
`expr_5 := ((b) + (INTEGER'1')) - ((INTEGER'2') * (abs(c))) (10:6)`,
182-
`date_format_5 := date_format(CAST(CAST(period_hour_local_date AS date) AS timestamp), VARCHAR'%Y-%m-%d') (8:12)
183-
`,
182+
`date_format_5 := date_format(CAST(CAST(period_hour_local_date AS date) AS timestamp), VARCHAR'%Y-%m-%d') (8:12)`,
184183
},
185184
[]plan_node.Assignment{
186185
{ // case 0

0 commit comments

Comments
 (0)