Skip to content

Commit 8dc3c89

Browse files
Merge pull request taozhi8833998#2109 from taozhi8833998/refactor-function-loc-all-dialects
refactor: add loc property to func_call in all dialects
2 parents 1dc6f55 + 11bd1bc commit 8dc3c89

15 files changed

+245
-94
lines changed

pegjs/athena.pegjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -953,7 +953,8 @@ call_stmt
953953
ast: {
954954
type: 'call',
955955
expr: e
956-
}
956+
},
957+
...getLocationObject(),
957958
}
958959
}
959960

@@ -2044,15 +2045,17 @@ func_call
20442045
type: 'function',
20452046
name: { name: [{ type: 'origin', value: name }] },
20462047
args: l ? l: { type: 'expr_list', value: [] },
2047-
over: bc
2048+
over: bc,
2049+
...getLocationObject(),
20482050
};
20492051
}
20502052
/ extract_func
20512053
/ f:scalar_time_func __ up:on_update_current_timestamp? {
20522054
return {
20532055
type: 'function',
20542056
name: { name: [{ type: 'origin', value: f }] },
2055-
over: up
2057+
over: up,
2058+
...getLocationObject(),
20562059
}
20572060
}
20582061
/ name:(KW_DATE / KW_TIME / KW_TIMESTAMP / 'AT TIME ZONE'i) __ l:or_and_where_expr? __ bc:over_partition? {
@@ -2063,6 +2066,7 @@ func_call
20632066
args: l ? l: { type: 'expr_list', value: [] },
20642067
over: bc,
20652068
args_parentheses: false,
2069+
...getLocationObject(),
20662070
};
20672071
}
20682072
/ name:proc_func_name __ LPAREN __ l:or_and_where_expr? __ RPAREN __ bc:over_partition? {
@@ -2071,7 +2075,8 @@ func_call
20712075
type: 'function',
20722076
name: name,
20732077
args: l ? l: { type: 'expr_list', value: [] },
2074-
over: bc
2078+
over: bc,
2079+
...getLocationObject(),
20752080
};
20762081
}
20772082
extract_filed
@@ -2088,7 +2093,8 @@ extract_func
20882093
field: f,
20892094
cast_type: t,
20902095
source: s,
2091-
}
2096+
},
2097+
...getLocationObject(),
20922098
}
20932099
}
20942100
/ kw:KW_EXTRACT __ LPAREN __ f:extract_filed __ KW_FROM __ s:expr __ RPAREN {
@@ -2098,7 +2104,8 @@ extract_func
20982104
args: {
20992105
field: f,
21002106
source: s,
2101-
}
2107+
},
2108+
...getLocationObject(),
21022109
}
21032110
}
21042111
scalar_time_func
@@ -2657,14 +2664,16 @@ proc_func_call
26572664
args: {
26582665
type: 'expr_list',
26592666
value: l
2660-
}
2667+
},
2668+
...getLocationObject(),
26612669
};
26622670
}
26632671
/ name:proc_func_name {
26642672
return {
26652673
type: 'function',
26662674
name: name,
2667-
args: null
2675+
args: null,
2676+
...getLocationObject(),
26682677
};
26692678
}
26702679

pegjs/bigquery.pegjs

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -516,14 +516,16 @@ proc_func_call
516516
args: {
517517
type: 'expr_list',
518518
value: l
519-
}
519+
},
520+
...getLocationObject(),
520521
};
521522
}
522523
/ name:proc_func_name {
523524
return {
524525
type: 'function',
525526
name: name,
526-
args: null
527+
args: null,
528+
...getLocationObject(),
527529
};
528530
}
529531

@@ -2656,14 +2658,16 @@ func_call
26562658
type: 'function',
26572659
name: { name: [{ type: 'default', value: name }] },
26582660
args: l ? l: { type: 'expr_list', value: [] },
2659-
over: bc
2661+
over: bc,
2662+
...getLocationObject(),
26602663
};
26612664
}
26622665
/ f:scalar_time_func __ up:on_update_current_timestamp? {
26632666
return {
26642667
type: 'function',
26652668
name: { name: [{ type: 'origin', value: f }] },
2666-
over: up
2669+
over: up,
2670+
...getLocationObject(),
26672671
}
26682672
}
26692673
/ name:proc_func_name __ LPAREN __ l:or_and_where_expr? __ RPAREN __ bc:over_partition? {
@@ -2672,7 +2676,8 @@ func_call
26722676
type: 'function',
26732677
name: name,
26742678
args: l ? l: { type: 'expr_list', value: [] },
2675-
over: bc
2679+
over: bc,
2680+
...getLocationObject(),
26762681
};
26772682
}
26782683

@@ -2709,7 +2714,8 @@ any_value_func
27092714
expr: e,
27102715
having: h
27112716
},
2712-
over: bc
2717+
over: bc,
2718+
...getLocationObject(),
27132719
}
27142720
}
27152721

@@ -2728,7 +2734,8 @@ extract_func
27282734
field: f,
27292735
cast_type: t,
27302736
source: s,
2731-
}
2737+
},
2738+
...getLocationObject(),
27322739
}
27332740
}
27342741
/ kw:KW_EXTRACT __ LPAREN __ f:extract_filed __ KW_FROM __ s:expr __ RPAREN {
@@ -2737,7 +2744,8 @@ extract_func
27372744
args: {
27382745
field: f,
27392746
source: s,
2740-
}
2747+
},
2748+
...getLocationObject(),
27412749
}
27422750
}
27432751
/ 'DATE_TRUNC'i __ LPAREN __ e:expr __ COMMA __ f:extract_filed __ RPAREN {
@@ -2746,6 +2754,7 @@ extract_func
27462754
name: { name: [{ type: 'origin', value: 'date_trunc' }]},
27472755
args: { type: 'expr_list', value: [e, { type: 'origin', value: f }] },
27482756
over: null,
2757+
...getLocationObject(),
27492758
};
27502759
}
27512760

pegjs/db2.pegjs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2028,14 +2028,16 @@ func_call
20282028
type: 'function',
20292029
name: { name: [{ type: 'default', value: name }] },
20302030
args: l ? l: { type: 'expr_list', value: [] },
2031-
over: bc
2031+
over: bc,
2032+
...getLocationObject(),
20322033
};
20332034
}
20342035
/ f:scalar_time_func __ up:on_update_current_timestamp? {
20352036
return {
20362037
type: 'function',
20372038
name: { name: [{ type: 'origin', value: f }] },
2038-
over: up
2039+
over: up,
2040+
...getLocationObject(),
20392041
}
20402042
}
20412043
/ name:proc_func_name __ LPAREN __ l:or_and_where_expr? __ RPAREN __ bc:over_partition? {
@@ -2045,6 +2047,7 @@ func_call
20452047
name: name,
20462048
args: l ? l: { type: 'expr_list', value: [] },
20472049
over: bc,
2050+
...getLocationObject(),
20482051
};
20492052
}
20502053
scalar_time_func
@@ -2585,14 +2588,16 @@ proc_func_call
25852588
args: {
25862589
type: 'expr_list',
25872590
value: l
2588-
}
2591+
},
2592+
...getLocationObject(),
25892593
};
25902594
}
25912595
/ name:proc_func_name {
25922596
return {
25932597
type: 'function',
25942598
name: name,
2595-
args: null
2599+
args: null,
2600+
...getLocationObject(),
25962601
};
25972602
}
25982603

pegjs/flinksql.pegjs

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2929,6 +2929,7 @@ position_func_clause
29292929
name: { name: [{ type: 'origin', value: 'position' }]},
29302930
separator: ' ',
29312931
args,
2932+
...getLocationObject(),
29322933
};
29332934
}
29342935

@@ -2955,6 +2956,7 @@ json_object_func_clause
29552956
type: 'function',
29562957
name: { name: [{ type: 'origin', value: 'json_object' }]},
29572958
args,
2959+
...getLocationObject(),
29582960
};
29592961
}
29602962

@@ -2983,6 +2985,7 @@ trim_func_clause
29832985
type: 'function',
29842986
name: { name: [{ type: 'origin', value: 'trim' }]},
29852987
args,
2988+
...getLocationObject(),
29862989
};
29872990
}
29882991

@@ -3008,6 +3011,7 @@ overlay_func_clause
30083011
name: { name: [{ type: 'origin', value: 'overlay' }]},
30093012
separator: ' ',
30103013
args,
3014+
...getLocationObject(),
30113015
};
30123016
}
30133017

@@ -3033,6 +3037,7 @@ substring_func_clause
30333037
name: { name: [{ type: 'origin', value: 'substring' }]},
30343038
separator: ' ',
30353039
args,
3040+
...getLocationObject(),
30363041
};
30373042
}
30383043

@@ -3047,7 +3052,8 @@ func_call
30473052
type: 'function',
30483053
name: { name: [{ type: 'default', value: name }] },
30493054
args: l ? l: { type: 'expr_list', value: [] },
3050-
over: bc
3055+
over: bc,
3056+
...getLocationObject(),
30513057
};
30523058
}
30533059
/ extract_func
@@ -3056,7 +3062,8 @@ func_call
30563062
return {
30573063
type: 'function',
30583064
name: { name: [{ type: 'origin', value: f }] },
3059-
over: up
3065+
over: up,
3066+
...getLocationObject(),
30603067
}
30613068
}
30623069
/ name:proc_func_name __ LPAREN __ l:or_and_where_expr? __ RPAREN __ bc:over_partition? {
@@ -3067,6 +3074,7 @@ func_call
30673074
name: name,
30683075
args: l ? l: { type: 'expr_list', value: [] },
30693076
over: bc,
3077+
...getLocationObject(),
30703078
};
30713079
}
30723080

@@ -3084,7 +3092,8 @@ extract_func
30843092
field: f,
30853093
cast_type: t,
30863094
source: s,
3087-
}
3095+
},
3096+
...getLocationObject(),
30883097
}
30893098
}
30903099
/ kw:KW_EXTRACT __ LPAREN __ f:extract_filed __ KW_FROM __ s:expr __ RPAREN {
@@ -3093,7 +3102,8 @@ extract_func
30933102
args: {
30943103
field: f,
30953104
source: s,
3096-
}
3105+
},
3106+
...getLocationObject(),
30973107
}
30983108
}
30993109
scalar_time_func
@@ -3715,15 +3725,17 @@ proc_func_call
37153725
args: {
37163726
type: 'expr_list',
37173727
value: l
3718-
}
3728+
},
3729+
...getLocationObject(),
37193730
};
37203731
}
37213732
/ name:proc_func_name {
37223733
// => IGNORE
37233734
return {
37243735
type: 'function',
37253736
name: name,
3726-
args: null
3737+
args: null,
3738+
...getLocationObject(),
37273739
};
37283740
}
37293741

pegjs/hive.pegjs

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2020,14 +2020,16 @@ func_call
20202020
type: 'function',
20212021
name: { name: [{ type: 'default', value: name }] },
20222022
args: l ? l: { type: 'expr_list', value: [] },
2023-
over: bc
2023+
over: bc,
2024+
...getLocationObject(),
20242025
};
20252026
}
20262027
/ f:scalar_time_func __ up:on_update_current_timestamp? {
20272028
return {
20282029
type: 'function',
20292030
name: { name: [{ type: 'origin', value: f }] },
2030-
over: up
2031+
over: up,
2032+
...getLocationObject(),
20312033
}
20322034
}
20332035
/ name:(KW_DATE / KW_TIME / KW_TIMESTAMP / 'AT TIME ZONE'i) __ l:or_and_where_expr? __ bc:over_partition? {
@@ -2038,6 +2040,7 @@ func_call
20382040
args: l ? l: { type: 'expr_list', value: [] },
20392041
over: bc,
20402042
args_parentheses: false,
2043+
...getLocationObject(),
20412044
};
20422045
}
20432046
/ name:proc_func_name __ LPAREN __ l:or_and_where_expr? __ RPAREN __ bc:over_partition? {
@@ -2046,7 +2049,8 @@ func_call
20462049
type: 'function',
20472050
name: name,
20482051
args: l ? l: { type: 'expr_list', value: [] },
2049-
over: bc
2052+
over: bc,
2053+
...getLocationObject(),
20502054
};
20512055
}
20522056
scalar_time_func
@@ -2591,14 +2595,16 @@ proc_func_call
25912595
args: {
25922596
type: 'expr_list',
25932597
value: l
2594-
}
2598+
},
2599+
...getLocationObject(),
25952600
};
25962601
}
25972602
/ name:proc_func_name {
25982603
return {
25992604
type: 'function',
26002605
name: name,
2601-
args: null
2606+
args: null,
2607+
...getLocationObject(),
26022608
};
26032609
}
26042610

0 commit comments

Comments
 (0)