Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -266,7 +266,9 @@ public TupleDescriptor createTupleDescriptor(Analyzer analyzer) throws AnalysisE
}

columnSet.add(colAlias);
columnList.add(new Column(colAlias, selectItemExpr.getType().getPrimitiveType()));
// TODO: inlineView threat all column is nullable to make sure query results are correct
// we should judge column whether is nullable by selectItemExpr in the future
columnList.add(new Column(colAlias, selectItemExpr.getType().getPrimitiveType(), true));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unfortunately, we cannot directly obtain the information about whether slot desc is nullable or not from Expr.

}
InlineView inlineView = (view != null) ? new InlineView(view, columnList) : new InlineView(getExplicitAlias(), columnList);

Expand Down
15 changes: 15 additions & 0 deletions fe/fe-core/src/test/java/org/apache/doris/planner/PlannerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -309,4 +309,19 @@ public void testPushDown() throws Exception{

}

@Test
public void testWithStmtSoltIsAllowNull() throws Exception {
// union
String sql1 = "with a as (select NULL as user_id ), " +
"b as ( select '543' as user_id) " +
"select user_id from a union all select user_id from b";

StmtExecutor stmtExecutor1 = new StmtExecutor(ctx, sql1);
stmtExecutor1.execute();
Planner planner1 = stmtExecutor1.planner();
List<PlanFragment> fragments1 = planner1.getFragments();
String plan1 = planner1.getExplainString(fragments1, TExplainLevel.VERBOSE);
Assert.assertEquals(3, StringUtils.countMatches(plan1, "nullIndicatorBit=0"));
}

}