File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed
core/src/main/java/com/dtstack/flink/sql/side Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 4747import org .apache .commons .collections .CollectionUtils ;
4848import org .apache .commons .lang3 .StringUtils ;
4949import org .apache .flink .api .java .tuple .Tuple2 ;
50+ import org .apache .flink .table .functions .BuiltInFunctionDefinitions ;
5051
5152import java .util .List ;
5253import java .util .Map ;
5354import java .util .Queue ;
5455import java .util .Set ;
56+ import java .util .stream .Collectors ;
5557
5658import static org .apache .calcite .sql .SqlKind .*;
5759
@@ -608,8 +610,17 @@ private void extractSelectField(SqlNode selectNode,
608610 }else if (selectNode .getKind () == IDENTIFIER ) {
609611 SqlIdentifier sqlIdentifier = (SqlIdentifier ) selectNode ;
610612
611- if (sqlIdentifier .names .size () == 1 ){
612- throw new WithoutTableNameException (sqlIdentifier + " field invalid , please use like t." +sqlIdentifier );
613+ if (sqlIdentifier .names .size () == 1 ) {
614+ List <String > builtInFunctionNames = BuiltInFunctionDefinitions
615+ .getDefinitions ()
616+ .stream ()
617+ .map (e -> e .getName ().toUpperCase ())
618+ .collect (Collectors .toList ());
619+ if (builtInFunctionNames .contains (sqlIdentifier .toString ().toUpperCase ())) {
620+ return ;
621+ } else {
622+ throw new WithoutTableNameException (sqlIdentifier + " field invalid , please use like t." + sqlIdentifier );
623+ }
613624 }
614625
615626 String tableName = sqlIdentifier .names .get (0 );
You can’t perform that action at this time.
0 commit comments