File tree Expand file tree Collapse file tree
fe/fe-core/src/main/java/org/apache/doris/nereids Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -272,6 +272,9 @@ public final boolean hasSameScanSemantics(LogicalCatalogRelation other) {
272272 }
273273
274274 protected boolean hasSameTableIdentity (LogicalCatalogRelation other ) {
275+ if (!Utils .isSameClass (this , other )) {
276+ return false ;
277+ }
275278 return new TableIdentifier (table ).equals (new TableIdentifier (other .table ));
276279 }
277280
Original file line number Diff line number Diff line change @@ -200,6 +200,9 @@ public boolean equals(Object o) {
200200
201201 @ Override
202202 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
203+ if (!Utils .isSameClass (this , other )) {
204+ return false ;
205+ }
203206 LogicalFileScan that = (LogicalFileScan ) other ;
204207 return Objects .equals (selectedPartitions , that .selectedPartitions )
205208 && Objects .equals (tableSample , that .tableSample )
Original file line number Diff line number Diff line change @@ -123,6 +123,9 @@ public Optional<IncrementalRelation> getIncrementalRelation() {
123123
124124 @ Override
125125 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
126+ if (!Utils .isSameClass (this , other )) {
127+ return false ;
128+ }
126129 LogicalHudiScan that = (LogicalHudiScan ) other ;
127130 // IncrementalRelation contains the resolved Hudi timeline and split state and has no value equality.
128131 return super .hasSameScanState (other ) && Objects .equals (incrementalRelation , that .incrementalRelation );
Original file line number Diff line number Diff line change @@ -97,7 +97,7 @@ public LogicalOdbcScan withTableAlias(String tableAlias) {
9797
9898 @ Override
9999 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
100- return true ;
100+ return Utils . isSameClass ( this , other ) ;
101101 }
102102
103103 @ Override
Original file line number Diff line number Diff line change @@ -1209,6 +1209,9 @@ public LogicalOlapScan withTableScanParams(TableScanParams scanParams) {
12091209
12101210 @ Override
12111211 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
1212+ if (!Utils .isSameClass (this , other )) {
1213+ return false ;
1214+ }
12121215 LogicalOlapScan that = (LogicalOlapScan ) other ;
12131216 return selectedIndexId == that .selectedIndexId
12141217 && indexSelected == that .indexSelected
Original file line number Diff line number Diff line change @@ -467,6 +467,9 @@ public LogicalOlapTableStreamScan withReadMode(StreamReadMode readMode) {
467467
468468 @ Override
469469 protected boolean hasSameTableIdentity (LogicalCatalogRelation other ) {
470+ if (!Utils .isSameClass (this , other )) {
471+ return false ;
472+ }
470473 LogicalOlapTableStreamScan that = (LogicalOlapTableStreamScan ) other ;
471474 return Objects .equals (getTable ().getStreamDbId (), that .getTable ().getStreamDbId ())
472475 && Objects .equals (getTable ().getStreamId (), that .getTable ().getStreamId ())
@@ -476,6 +479,9 @@ && new TableIdentifier(getTable().getBaseTable())
476479
477480 @ Override
478481 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
482+ if (!Utils .isSameClass (this , other )) {
483+ return false ;
484+ }
479485 LogicalOlapTableStreamScan that = (LogicalOlapTableStreamScan ) other ;
480486 return super .hasSameScanState (other )
481487 && readMode == that .readMode
Original file line number Diff line number Diff line change @@ -115,6 +115,9 @@ public List<Expression> getFrontendConjuncts() {
115115
116116 @ Override
117117 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
118+ if (!Utils .isSameClass (this , other )) {
119+ return false ;
120+ }
118121 LogicalSchemaScan that = (LogicalSchemaScan ) other ;
119122 return filterPushed == that .filterPushed
120123 && Objects .equals (schemaCatalog , that .schemaCatalog )
Original file line number Diff line number Diff line change @@ -87,7 +87,7 @@ public LogicalTestScan withTableAlias(String tableAlias) {
8787
8888 @ Override
8989 protected boolean hasSameScanState (LogicalCatalogRelation other ) {
90- return true ;
90+ return Utils . isSameClass ( this , other ) ;
9191 }
9292
9393 @ Override
Original file line number Diff line number Diff line change 6262public class Utils {
6363 public static final boolean enableAssert ;
6464
65+ /**
66+ * Check whether two objects are non-null and have the same concrete class.
67+ */
68+ public static boolean isSameClass (Object left , Object right ) {
69+ return left != null && right != null && left .getClass () == right .getClass ();
70+ }
71+
6572 static {
6673 boolean enabled = false ;
6774 // if run jvm with -ea or -enableassertions, the assert statement will be executed
You can’t perform that action at this time.
0 commit comments