@@ -75,12 +75,15 @@ public abstract class BaseSideInfo implements Serializable{
7575
7676 protected AbstractSideCache sideCache ;
7777
78+ protected JoinInfo joinInfo ;
79+
7880 public BaseSideInfo (RowTypeInfo rowTypeInfo , JoinInfo joinInfo , List <FieldInfo > outFieldInfoList ,
7981 AbstractSideTableInfo sideTableInfo ){
8082 this .rowTypeInfo = rowTypeInfo ;
8183 this .outFieldInfoList = outFieldInfoList ;
8284 this .joinType = joinInfo .getJoinType ();
8385 this .sideTableInfo = sideTableInfo ;
86+ this .joinInfo = joinInfo ;
8487 parseSelectFields (joinInfo );
8588 buildEqualInfo (joinInfo , sideTableInfo );
8689 }
@@ -178,9 +181,7 @@ private void evalEquation(SqlIdentifier left, SqlIdentifier right, String sideTa
178181 */
179182 private void evalConstantEquation (SqlLiteral literal , SqlIdentifier identifier ) {
180183 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 );
184185 String fieldName = identifier .getComponent (1 ).getSimple ();
185186 Object constant = literal .getValue ();
186187 List <PredicateInfo > predicateInfos = sideTableInfo .getPredicateInfoes ();
@@ -194,6 +195,22 @@ private void evalConstantEquation(SqlLiteral literal, SqlIdentifier identifier)
194195 predicateInfos .add (predicate );
195196 }
196197
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+
197214 private void associateField (String sourceTableField , String sideTableField , SqlNode sqlNode ) {
198215 String errorMsg = "can't deal equal field: " + sqlNode ;
199216 equalFieldList .add (sideTableField );
0 commit comments