Skip to content

Commit

Permalink
Fix 'Multiple entries with same key' error with dynamic filter
Browse files Browse the repository at this point in the history
  • Loading branch information
lxqfy authored and raunaqmorarka committed Mar 7, 2024
1 parent b744b8d commit 8052969
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -452,7 +452,8 @@ private TupleDomain<ColumnHandle> translateSummaryToTupleDomain(
return applySaturatedCasts(metadata, functionManager, typeOperators, session, updatedSummary, targetType);
}
return updatedSummary;
})));
},
Domain::intersect)));
}

private static Set<DynamicFilterId> getLazyDynamicFilters(PlanFragment plan)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,29 @@ public void testJoinWithSelectiveBuildSide()
assertThat(domainStats.getSimplifiedDomain()).isEqualTo(singleValue(BIGINT, 1L).toString(getSession().toConnectorSession()));
}

@Test
@Timeout(30)
public void testJoinWithComparingSameColumnUnderDifferentConditions()
{
@Language("SQL") String selectQuery = "SELECT * FROM partitioned_lineitem JOIN supplier ON partitioned_lineitem.suppkey >= supplier.suppkey " +
"AND partitioned_lineitem.suppkey <= supplier.suppkey " +
"AND supplier.name = 'Supplier#000000001'";
MaterializedResultWithPlan result = getDistributedQueryRunner().executeWithPlan(
getSession(),
selectQuery);
MaterializedResult expected = computeActual(withDynamicFilteringDisabled(), selectQuery);
assertEqualsIgnoreOrder(result.result(), expected);

DynamicFiltersStats dynamicFiltersStats = getDynamicFilteringStats(result.queryId());
assertThat(dynamicFiltersStats.getTotalDynamicFilters()).isEqualTo(1L);
assertThat(dynamicFiltersStats.getLazyDynamicFilters()).isEqualTo(1L);
assertThat(dynamicFiltersStats.getReplicatedDynamicFilters()).isEqualTo(1L);
assertThat(dynamicFiltersStats.getDynamicFiltersCompleted()).isEqualTo(1L);

DynamicFilterDomainStats domainStats = getOnlyElement(dynamicFiltersStats.getDynamicFilterDomainStats());
assertThat(domainStats.getSimplifiedDomain()).isEqualTo(singleValue(BIGINT, 1L).toString(getSession().toConnectorSession()));
}

@Test
@Timeout(30)
public void testJoinWithNonSelectiveBuildSide()
Expand Down

0 comments on commit 8052969

Please sign in to comment.