TsukiokaKogane commented on code in PR #65973:
URL: https://github.com/apache/doris/pull/65973#discussion_r3655465627
##########
fe/fe-core/src/test/java/org/apache/doris/nereids/trees/plans/ExplainTableStreamPlanTest.java:
##########
@@ -518,6 +519,72 @@ public void
testStreamScanWithSelectedPartitionIdsMarksPartitionPruned() {
Assertions.assertFalse(prunedScan.hasPartitionPredicate());
}
+ @Test
+ public void testIncrementalStreamScanForcesValueColumnsNullable() throws
Exception {
+ // s2 is an incremental (INCREMENTAL read mode) stream over a
unique-key table
+ // (k1 key, k2 value). computeOutput must force non-key value columns
to nullable so the
+ // scan output stays consistent with the row-binlog after/before value
columns, while key
+ // columns keep their original nullability (forceNullable is skipped
for keys).
+ Database db = (Database)
Env.getCurrentInternalCatalog().getDbOrMetaException("test_stream");
+ OlapTable base = (OlapTable)
db.getTableOrMetaException("tbl_stream_base");
+ boolean baseK1Nullable = base.getBaseSchema(false).stream()
+ .filter(c -> c.getName().equals("k1"))
+ .findFirst()
+ .orElseThrow()
+ .isAllowNull();
+
+ Plan analyzedPlan = PlanChecker.from(connectContext)
+ .analyze("select * from test_stream.s2")
+ .getCascadesContext()
+ .getRewritePlan();
+
+ LogicalOlapTableStreamScan streamScan =
findFirstLogicalStreamScan(analyzedPlan);
+ Assertions.assertNotNull(streamScan);
+
+ Slot k1 = findSlot(streamScan, "k1");
+ Slot k2 = findSlot(streamScan, "k2");
+ Assertions.assertNotNull(k1, "key column k1 must be present in stream
scan output");
+ Assertions.assertNotNull(k2, "value column k2 must be present in
stream scan output");
+ Assertions.assertEquals(baseK1Nullable, k1.nullable(),
+ "key column k1 must keep its original nullability (not
force-nullable)");
+ Assertions.assertTrue(k2.nullable(), "non-key value column k2 must be
forced nullable");
Review Comment:
fixed
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]