[feature-wip](array-type) add function array_slice (#11054)
array_slice function returns a slice of the array.
This commit is contained in:
@ -394,6 +394,7 @@ nonterminal AnalyticWindow.Type window_type;
|
||||
nonterminal AnalyticWindow.Boundary window_boundary;
|
||||
nonterminal SlotRef column_ref;
|
||||
nonterminal FunctionCallExpr column_subscript;
|
||||
nonterminal FunctionCallExpr column_slice;
|
||||
nonterminal ArrayList<TableRef> table_ref_list, base_table_ref_list;
|
||||
nonterminal ArrayList<LateralViewRef> opt_lateral_view_ref_list, lateral_view_ref_list;
|
||||
nonterminal FromClause from_clause;
|
||||
@ -4969,6 +4970,8 @@ non_pred_expr ::=
|
||||
{: RESULT = c; :}
|
||||
| column_subscript:c
|
||||
{: RESULT = c; :}
|
||||
| column_slice:c
|
||||
{: RESULT = c; :}
|
||||
| timestamp_arithmetic_expr:e
|
||||
{: RESULT = e; :}
|
||||
| arithmetic_expr:e
|
||||
@ -5331,6 +5334,22 @@ column_subscript ::=
|
||||
:}
|
||||
;
|
||||
|
||||
column_slice ::=
|
||||
expr:e LBRACKET expr:offset COLON RBRACKET
|
||||
{: ArrayList<Expr> list = new ArrayList<Expr>();
|
||||
list.add(e);
|
||||
list.add(offset);
|
||||
RESULT = new FunctionCallExpr("%element_slice%", list);
|
||||
:}
|
||||
| expr:e LBRACKET expr:offset COLON expr:length RBRACKET
|
||||
{: ArrayList<Expr> list = new ArrayList<Expr>();
|
||||
list.add(e);
|
||||
list.add(offset);
|
||||
list.add(length);
|
||||
RESULT = new FunctionCallExpr("%element_slice%", list);
|
||||
:}
|
||||
;
|
||||
|
||||
privilege_type ::=
|
||||
ident:name
|
||||
{:
|
||||
|
||||
@ -457,6 +457,7 @@ import org.apache.doris.qe.SqlModeHelper;
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.RPAREN), ")");
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.LBRACKET), "[");
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.RBRACKET), "]");
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.COLON), ":");
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.SEMICOLON), ";");
|
||||
tokenIdMap.put(new Integer(SqlParserSymbols.FLOATINGPOINT_LITERAL),
|
||||
"FLOATING POINT LITERAL");
|
||||
@ -600,6 +601,7 @@ EndOfLineComment = "--" !({HintContent}|{ContainsLineTerminator}) {LineTerminato
|
||||
"@" { return newToken(SqlParserSymbols.AT, null); }
|
||||
"(" { return newToken(SqlParserSymbols.LPAREN, null); }
|
||||
")" { return newToken(SqlParserSymbols.RPAREN, null); }
|
||||
":" { return newToken(SqlParserSymbols.COLON, null); }
|
||||
";" { return newToken(SqlParserSymbols.SEMICOLON, null); }
|
||||
"[" { return newToken(SqlParserSymbols.LBRACKET, null); }
|
||||
"]" { return newToken(SqlParserSymbols.RBRACKET, null); }
|
||||
|
||||
Reference in New Issue
Block a user