9898import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OnDuplicateKeyClauseContext ;
9999import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OrderByClauseContext ;
100100import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OrderByItemContext ;
101- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OwnerContext ;
102101import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OutfilePropertyContext ;
103- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectFieldsIntoContext ;
104- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectIntoExpressionContext ;
105- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectLinesIntoContext ;
102+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .OwnerContext ;
106103import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ParameterMarkerContext ;
107104import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .PositionFunctionContext ;
108105import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .PrecisionContext ;
121118import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ReplaceValuesClauseContext ;
122119import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .RowConstructorListContext ;
123120import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectContext ;
121+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectFieldsIntoContext ;
122+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectIntoExpressionContext ;
123+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectLinesIntoContext ;
124124import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectSpecificationContext ;
125125import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SelectWithIntoContext ;
126126import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .SetAssignmentsClauseContext ;
151151import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .UserVariableContext ;
152152import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ValuesFunctionContext ;
153153import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .VariableContext ;
154+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewColumnDefinitionContext ;
155+ import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewColumnDefinitionsContext ;
154156import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewNameContext ;
155157import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewNamesContext ;
156158import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .WeightStringFunctionContext ;
157159import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .WhereClauseContext ;
158160import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .WithClauseContext ;
159- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewColumnDefinitionContext ;
160- import org .apache .shardingsphere .sql .parser .autogen .DorisStatementParser .ViewColumnDefinitionsContext ;
161- import org .apache .shardingsphere .sql .parser .statement .core .segment .ddl .view .ViewColumnSegment ;
162- import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileColumnsSegment ;
163- import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileLinesSegment ;
164- import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileSegment ;
165161import org .apache .shardingsphere .sql .parser .statement .core .enums .AggregationType ;
166162import org .apache .shardingsphere .sql .parser .statement .core .enums .CombineType ;
167163import org .apache .shardingsphere .sql .parser .statement .core .enums .JoinType ;
173169import org .apache .shardingsphere .sql .parser .statement .core .segment .ddl .engine .EngineSegment ;
174170import org .apache .shardingsphere .sql .parser .statement .core .segment .ddl .index .IndexNameSegment ;
175171import org .apache .shardingsphere .sql .parser .statement .core .segment .ddl .index .IndexSegment ;
172+ import org .apache .shardingsphere .sql .parser .statement .core .segment .ddl .view .ViewColumnSegment ;
176173import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .assignment .ColumnAssignmentSegment ;
177174import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .assignment .InsertValuesSegment ;
178175import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .assignment .SetAssignmentSegment ;
214211import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .order .item .ExpressionOrderByItemSegment ;
215212import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .order .item .IndexOrderByItemSegment ;
216213import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .order .item .OrderByItemSegment ;
214+ import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileColumnsSegment ;
215+ import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileLinesSegment ;
216+ import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .outfile .OutfileSegment ;
217217import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .pagination .PaginationValueSegment ;
218218import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .pagination .limit .LimitSegment ;
219219import org .apache .shardingsphere .sql .parser .statement .core .segment .dml .pagination .limit .NumberLiteralLimitValueSegment ;
257257import java .util .ArrayList ;
258258import java .util .Collection ;
259259import java .util .Collections ;
260+ import java .util .LinkedHashMap ;
260261import java .util .LinkedList ;
261262import java .util .List ;
262- import java .util .stream .Collectors ;
263263import java .util .Map ;
264- import java .util .LinkedHashMap ;
264+ import java .util .stream . Collectors ;
265265
266266/**
267267 * Statement visitor for Doris.
@@ -1161,7 +1161,6 @@ public final ASTNode visitSpecialFunction(final SpecialFunctionContext ctx) {
11611161
11621162 @ Override
11631163 public final ASTNode visitGroupConcatFunction (final GroupConcatFunctionContext ctx ) {
1164- calculateParameterCount (ctx .expr ());
11651164 FunctionSegment result = new FunctionSegment (ctx .getStart ().getStartIndex (), ctx .getStop ().getStopIndex (), ctx .GROUP_CONCAT ().getText (), getOriginalText (ctx ));
11661165 for (ExprContext each : getTargetRuleContextFromParseTree (ctx , ExprContext .class )) {
11671166 result .getParameters ().add ((ExpressionSegment ) visit (each ));
@@ -1263,7 +1262,6 @@ public final ASTNode visitConvertFunction(final ConvertFunctionContext ctx) {
12631262
12641263 @ Override
12651264 public final ASTNode visitPositionFunction (final PositionFunctionContext ctx ) {
1266- calculateParameterCount (ctx .expr ());
12671265 FunctionSegment result = new FunctionSegment (ctx .getStart ().getStartIndex (), ctx .getStop ().getStopIndex (), ctx .POSITION ().getText (), getOriginalText (ctx ));
12681266 result .getParameters ().add ((ExpressionSegment ) visit (ctx .expr (0 )));
12691267 result .getParameters ().add ((ExpressionSegment ) visit (ctx .expr (1 )));
@@ -1283,7 +1281,6 @@ public final ASTNode visitSubstringFunction(final SubstringFunctionContext ctx)
12831281
12841282 @ Override
12851283 public final ASTNode visitExtractFunction (final ExtractFunctionContext ctx ) {
1286- calculateParameterCount (Collections .singleton (ctx .expr ()));
12871284 FunctionSegment result = new FunctionSegment (ctx .getStart ().getStartIndex (), ctx .getStop ().getStopIndex (), ctx .EXTRACT ().getText (), getOriginalText (ctx ));
12881285 result .getParameters ().add (new LiteralExpressionSegment (ctx .intervalUnit ().getStart ().getStartIndex (), ctx .intervalUnit ().getStop ().getStopIndex (), ctx .intervalUnit ().getText ()));
12891286 result .getParameters ().add ((ExpressionSegment ) visit (ctx .expr ()));
@@ -1292,7 +1289,6 @@ public final ASTNode visitExtractFunction(final ExtractFunctionContext ctx) {
12921289
12931290 @ Override
12941291 public final ASTNode visitCharFunction (final CharFunctionContext ctx ) {
1295- calculateParameterCount (ctx .expr ());
12961292 FunctionSegment result = new FunctionSegment (ctx .getStart ().getStartIndex (), ctx .getStop ().getStopIndex (), ctx .CHAR ().getText (), getOriginalText (ctx ));
12971293 for (ExprContext each : ctx .expr ()) {
12981294 ASTNode expr = visit (each );
@@ -1324,7 +1320,6 @@ public final ASTNode visitTrimFunction(final TrimFunctionContext ctx) {
13241320
13251321 @ Override
13261322 public final ASTNode visitWeightStringFunction (final WeightStringFunctionContext ctx ) {
1327- calculateParameterCount (Collections .singleton (ctx .expr ()));
13281323 FunctionSegment result = new FunctionSegment (ctx .getStart ().getStartIndex (), ctx .getStop ().getStopIndex (), ctx .WEIGHT_STRING ().getText (), getOriginalText (ctx ));
13291324 result .getParameters ().add ((ExpressionSegment ) visit (ctx .expr ()));
13301325 return result ;
@@ -1464,13 +1459,6 @@ public final ASTNode visitMatchExpression(final MatchExpressionContext ctx) {
14641459 return result ;
14651460 }
14661461
1467- // TODO :FIXME, sql case id: insert_with_str_to_date
1468- private void calculateParameterCount (final Collection <ExprContext > exprContexts ) {
1469- for (ExprContext each : exprContexts ) {
1470- visit (each );
1471- }
1472- }
1473-
14741462 @ Override
14751463 public final ASTNode visitDataType (final DataTypeContext ctx ) {
14761464 DataTypeSegment result = new DataTypeSegment ();
@@ -1978,12 +1966,10 @@ public ASTNode visitTableReferences(final TableReferencesContext ctx) {
19781966 }
19791967 return result ;
19801968 }
1981- // DORIS ADDED BEGIN
19821969 if (null != ctx .regularFunction ()) {
19831970 FunctionSegment functionSegment = (FunctionSegment ) visit (ctx .regularFunction ());
19841971 return new FunctionTableSegment (ctx .start .getStartIndex (), ctx .stop .getStopIndex (), functionSegment );
19851972 }
1986- // DORIS ADDED END
19871973 return result ;
19881974 }
19891975
0 commit comments