Skip to content

Commit f21952f

Browse files
FlechazoWHiLany
authored andcommitted
[hotfix-1754][side] 维表增加对常量不等于、不小于等条件的支持
1 parent fc2e99e commit f21952f

File tree

2 files changed

+12
-7
lines changed

2 files changed

+12
-7
lines changed

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

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -193,6 +193,10 @@ public List<PredicateInfo> getPredicateInfoes() {
193193
return predicateInfoes;
194194
}
195195

196+
public void addPredicateInfo(PredicateInfo predicateInfo) {
197+
this.predicateInfoes.add(predicateInfo);
198+
}
199+
196200
public Long getAsyncFailMaxNum(Long defaultValue) {
197201
return Objects.isNull(asyncFailMaxNum) ? defaultValue : asyncFailMaxNum;
198202
}

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

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,14 @@ public void dealOneEqualCon(SqlNode sqlNode, String sideTableName) {
137137
if (leftNode.getKind() == SqlKind.LITERAL) {
138138
evalConstantEquation(
139139
(SqlLiteral) leftNode,
140-
(SqlIdentifier) rightNode
140+
(SqlIdentifier) rightNode,
141+
sqlNode.getKind()
141142
);
142143
} else if (rightNode.getKind() == SqlKind.LITERAL) {
143144
evalConstantEquation(
144145
(SqlLiteral) rightNode,
145-
(SqlIdentifier) leftNode
146+
(SqlIdentifier) leftNode,
147+
sqlNode.getKind()
146148
);
147149
} else {
148150
SqlIdentifier left = (SqlIdentifier) leftNode;
@@ -179,20 +181,19 @@ private void evalEquation(SqlIdentifier left, SqlIdentifier right, String sideTa
179181
* @param literal
180182
* @param identifier
181183
*/
182-
private void evalConstantEquation(SqlLiteral literal, SqlIdentifier identifier) {
184+
private void evalConstantEquation(SqlLiteral literal, SqlIdentifier identifier, SqlKind sqlKind) {
183185
String tableName = identifier.getComponent(0).getSimple();
184186
checkSupport(identifier);
185187
String fieldName = identifier.getComponent(1).getSimple();
186188
Object constant = literal.getValue();
187-
List<PredicateInfo> predicateInfos = sideTableInfo.getPredicateInfoes();
188189
PredicateInfo predicate = PredicateInfo.builder()
189-
.setOperatorName("=")
190-
.setOperatorKind("EQUALS")
190+
.setOperatorName(sqlKind.sql)
191+
.setOperatorKind(sqlKind.name())
191192
.setOwnerTable(tableName)
192193
.setFieldName(fieldName)
193194
.setCondition(constant.toString())
194195
.build();
195-
predicateInfos.add(predicate);
196+
sideTableInfo.addPredicateInfo(predicate);
196197
}
197198

198199
private void checkSupport(SqlIdentifier identifier) {

0 commit comments

Comments
 (0)