englefly commented on code in PR #65805:
URL: https://github.com/apache/doris/pull/65805#discussion_r3618944755
##########
fe/fe-core/src/test/java/org/apache/doris/nereids/rules/rewrite/PruneNestedColumnTest.java:
##########
@@ -1674,4 +1913,154 @@ private void assertVariantSubColumnSlotCount(String
sql, List<String> expectedSu
Assertions.assertEquals(expectedCount, actualCount);
}
+
+ /**
+ * Verify that synthetic nullability from outer join does NOT cause META
NULL paths
+ * on physically NOT NULL columns. When a NOT NULL struct sits on the
nullable side
+ * of a LEFT JOIN, the slot's {@code nullable()} returns true (from outer
join
+ * semantics), but {@code getOriginalColumn().isAllowNull()} returns false
+ * (physical column has no null map). The fix in
AccessPathExpressionCollector
+ * should suppress the {@code [s, NULL]} META path in this case.
+ */
+ @Test
+ public void testNotNullStructOnOuterJoinNullableSide() throws Exception {
+ // driving_tbl LEFT JOIN not_null_struct_tbl:
+ // not_null_struct_tbl.s is NOT NULL in the schema, but after LEFT
JOIN the
+ // slot becomes nullable (right side of LEFT JOIN →
withNullable(true)).
+ // element_at(s, 'f') IS NULL in WHERE:
+ // - s.nullable() = true (synthetic, from outer join)
+ // - s.getOriginalColumn().isAllowNull() = false (physical, no
null map)
+ // Expected: [s, f] DATA is present (field is read for IS NULL
evaluation),
+ // [s, NULL] META must NOT be present (no physical null
map).
+ assertAllAccessPathsContain(
+ "select driving_tbl.id from driving_tbl"
+ + " left join not_null_struct_tbl"
+ + " on driving_tbl.id = not_null_struct_tbl.id"
+ + " where element_at(not_null_struct_tbl.s, 'f') is
null",
+ // expect-contain: field is read (DATA path)
+ ImmutableList.of(path("s", "f")),
Review Comment:
可以有这个优化,但我们没有 复制 is-null filter 到 left outer join 右孩子的rule, 所以不会生成
metaPath(s, f, null)
--
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]