Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.26.0
Description
hi community, when I use SqlToRelConverter to convertExpression,I found it does not registery subQuery before convertExpression, so the convertExpression throw npe.
here is the executable example
// code placeholder CalciterHelper calciterHelper = new CalciterHelper(config); SqlNode parse = calciterHelper.parseExpression("ID IN (1, 2, 3)"); HashMap<String, RexNode> nameToNodeMap = new HashMap<>(); nameToNodeMap.put("ID",new RexInputRef(0, calciterHelper.getTypeFactory().createSqlType(SqlTypeName.INTEGER))); final Map<String, RelDataType> nameToTypeMap = new HashMap<>(); for (Map.Entry<String, RexNode> entry : nameToNodeMap.entrySet()) { nameToTypeMap.put(entry.getKey(), entry.getValue().getType()); } SqlValidatorImpl orCreateValidator = calciterHelper.getOrCreateValidator(); orCreateValidator.validateCall((SqlCall) parse,new ParameterScope(orCreateValidator,nameToTypeMap)); SqlToRelConverter orCreateSqlToRelConverter = calciterHelper.getOrCreateSqlToRelConverter(); orCreateSqlToRelConverter.convertExpression(parse,nameToNodeMap);
and the npe,
// code placeholder Exception in thread "main" java.lang.NullPointerExceptionException in thread "main" java.lang.NullPointerException at java.util.Objects.requireNonNull(Objects.java:203) at org.apache.calcite.sql2rel.SqlToRelConverter$Blackboard.convertExpression(SqlToRelConverter.java:4914)
Attachments
Issue Links
- causes
-
FLINK-21613 Parse Compute Column with `IN` expression throws NPE
- Open
-
FLINK-20884 NullPointerException in create statements with computed columns which the subQuery is SqlNodeList
- Closed
- links to