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 @@ -1271,12 +1271,12 @@ public void registerConjuncts(Expr e, boolean fromHavingClause) throws AnalysisE
public void registerConjuncts(Expr e, boolean fromHavingClause, List<TupleId> ids) throws AnalysisException {
for (Expr conjunct : e.getConjuncts()) {
registerConjunct(conjunct);
if (!e.isConstant()) {
if (!conjunct.isConstant()) {
ArrayList<TupleId> tupleIds = Lists.newArrayList();
ArrayList<SlotId> slotIds = Lists.newArrayList();
e.getIds(tupleIds, slotIds);
conjunct.getIds(tupleIds, slotIds);
if (tupleIds.isEmpty() && slotIds.isEmpty()) {
e.setBoundTupleIds(ids);
conjunct.setBoundTupleIds(ids);
}
}
if (ids != null) {
Expand Down
6 changes: 6 additions & 0 deletions regression-test/suites/correctness_p0/test_rand_filter.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,11 @@ suite("test_rand_filter") {
sql("""select * from test_rand_filter_t where rand() < 0.5 union all select * from test_rand_filter_t where rand() > 0.3;""")
notContains("AND")
}
explain {
sql("""select * from test_rand_filter_t
union all (select * from test_rand_filter_t where rand() < 0.3)
union all (select * from test_rand_filter_t where a > 5 and rand() < 0.4);""")
notContains("rand() < 0.3 AND rand() < 0.4")
}
sql """ DROP TABLE IF EXISTS test_rand_filter_t """
}