github-actions[bot] commented on code in PR #65805:
URL: https://github.com/apache/doris/pull/65805#discussion_r3614541647


##########
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:
   [P1] Expect the nullable field's metadata path
   
   The DDL above declares `struct<f:int>`, so `f` is nullable by default. 
Starting from the `IS NULL` META context, `visitElementAt` only resets to DATA 
when `!field.isNullable()`; here it suppresses the physical root `[s,NULL]` but 
records META `[s,f,NULL]`. Because `ColumnAccessPath.compareTo` includes the 
type, this new test cannot find DATA `[s,f]` and fails. Please expect 
`metaPath("s", "f", "NULL")` while continuing to forbid root META `[s,NULL]`; 
the separate programmatic `testNotNullFieldPreservedInAccessPaths()` test 
already covers the non-nullable-field DATA branch.



-- 
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]

Reply via email to