Skip to content

Commit b79154e

Browse files
committed
[fix-33011][core]exception prompt optimization
1 parent 02bde94 commit b79154e

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

core/src/main/java/com/dtstack/flink/sql/side/JoinNodeDealer.java

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,13 @@
4747
import org.apache.commons.collections.CollectionUtils;
4848
import org.apache.commons.lang3.StringUtils;
4949
import org.apache.flink.api.java.tuple.Tuple2;
50+
import org.apache.flink.table.functions.BuiltInFunctionDefinitions;
5051

5152
import java.util.List;
5253
import java.util.Map;
5354
import java.util.Queue;
5455
import java.util.Set;
56+
import java.util.stream.Collectors;
5557

5658
import 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);

0 commit comments

Comments
 (0)