@@ -75,12 +75,15 @@ public abstract class BaseSideInfo implements Serializable{
75
75
76
76
protected AbstractSideCache sideCache ;
77
77
78
+ protected JoinInfo joinInfo ;
79
+
78
80
public BaseSideInfo (RowTypeInfo rowTypeInfo , JoinInfo joinInfo , List <FieldInfo > outFieldInfoList ,
79
81
AbstractSideTableInfo sideTableInfo ){
80
82
this .rowTypeInfo = rowTypeInfo ;
81
83
this .outFieldInfoList = outFieldInfoList ;
82
84
this .joinType = joinInfo .getJoinType ();
83
85
this .sideTableInfo = sideTableInfo ;
86
+ this .joinInfo = joinInfo ;
84
87
parseSelectFields (joinInfo );
85
88
buildEqualInfo (joinInfo , sideTableInfo );
86
89
}
@@ -178,9 +181,7 @@ private void evalEquation(SqlIdentifier left, SqlIdentifier right, String sideTa
178
181
*/
179
182
private void evalConstantEquation (SqlLiteral literal , SqlIdentifier identifier ) {
180
183
String tableName = identifier .getComponent (0 ).getSimple ();
181
- String sideTableName = sideTableInfo .getName ();
182
- String errorMsg = "only support set side table constant field, error field " + identifier ;
183
- Preconditions .checkState (tableName .equals (sideTableName ), errorMsg );
184
+ checkSupport (identifier );
184
185
String fieldName = identifier .getComponent (1 ).getSimple ();
185
186
Object constant = literal .getValue ();
186
187
List <PredicateInfo > predicateInfos = sideTableInfo .getPredicateInfoes ();
@@ -194,6 +195,22 @@ private void evalConstantEquation(SqlLiteral literal, SqlIdentifier identifier)
194
195
predicateInfos .add (predicate );
195
196
}
196
197
198
+ private void checkSupport (SqlIdentifier identifier ) {
199
+ String tableName = identifier .getComponent (0 ).getSimple ();
200
+ String sideTableName ;
201
+ String sideTableAlias ;
202
+ if (joinInfo .isLeftIsSideTable ()) {
203
+ sideTableName = joinInfo .getLeftTableName ();
204
+ sideTableAlias = joinInfo .getLeftTableAlias ();
205
+ } else {
206
+ sideTableName = joinInfo .getRightTableName ();
207
+ sideTableAlias = joinInfo .getRightTableAlias ();
208
+ }
209
+ boolean isSide = tableName .equals (sideTableName ) || tableName .equals (sideTableAlias );
210
+ String errorMsg = "only support set side table constant field, error field " + identifier ;
211
+ Preconditions .checkState (isSide , errorMsg );
212
+ }
213
+
197
214
private void associateField (String sourceTableField , String sideTableField , SqlNode sqlNode ) {
198
215
String errorMsg = "can't deal equal field: " + sqlNode ;
199
216
equalFieldList .add (sideTableField );
0 commit comments