|
22 | 22 |
|
23 | 23 | import com.dtstack.flink.sql.side.cache.AbstractSideCache;
|
24 | 24 | import com.google.common.base.Preconditions;
|
25 |
| -import org.apache.calcite.sql.JoinType; |
26 |
| -import org.apache.calcite.sql.SqlBasicCall; |
27 |
| -import org.apache.calcite.sql.SqlIdentifier; |
28 |
| -import org.apache.calcite.sql.SqlKind; |
29 |
| -import org.apache.calcite.sql.SqlLiteral; |
30 |
| -import org.apache.calcite.sql.SqlNode; |
31 |
| -import org.apache.flink.api.java.typeutils.RowTypeInfo; |
32 | 25 | import com.google.common.collect.Lists;
|
33 | 26 | import com.google.common.collect.Maps;
|
| 27 | +import org.apache.calcite.sql.*; |
| 28 | +import org.apache.calcite.util.NlsString; |
| 29 | +import org.apache.flink.api.java.typeutils.RowTypeInfo; |
34 | 30 | import org.apache.flink.table.runtime.typeutils.BaseRowTypeInfo;
|
35 | 31 |
|
36 | 32 | import java.io.Serializable;
|
|
46 | 42 |
|
47 | 43 | public abstract class BaseSideInfo implements Serializable{
|
48 | 44 |
|
| 45 | + protected static final String QUOTE = "'"; |
| 46 | + protected static final String ESCAPEQUOTE = "''"; |
| 47 | + |
49 | 48 | protected RowTypeInfo rowTypeInfo;
|
50 | 49 |
|
51 | 50 | protected List<FieldInfo> outFieldInfoList;
|
@@ -186,12 +185,18 @@ private void evalConstantEquation(SqlLiteral literal, SqlIdentifier identifier,
|
186 | 185 | checkSupport(identifier);
|
187 | 186 | String fieldName = identifier.getComponent(1).getSimple();
|
188 | 187 | Object constant = literal.getValue();
|
| 188 | + String condition; |
| 189 | + if(constant instanceof NlsString){ |
| 190 | + condition = QUOTE + ((NlsString) constant).getValue().replace(QUOTE,ESCAPEQUOTE)+ QUOTE; |
| 191 | + }else { |
| 192 | + condition = constant.toString(); |
| 193 | + } |
189 | 194 | PredicateInfo predicate = PredicateInfo.builder()
|
190 | 195 | .setOperatorName(sqlKind.sql)
|
191 | 196 | .setOperatorKind(sqlKind.name())
|
192 | 197 | .setOwnerTable(tableName)
|
193 | 198 | .setFieldName(fieldName)
|
194 |
| - .setCondition(constant.toString()) |
| 199 | + .setCondition(condition) |
195 | 200 | .build();
|
196 | 201 | sideTableInfo.addPredicateInfo(predicate);
|
197 | 202 | sideTableInfo.addFullPredicateInfoes(predicate);
|
|
0 commit comments