Raghu Koratagere
01/22/2025, 1:19 PM(fact table has 30M rows and dimension has 20M rows) tables, I have very good filter on Fact table that should which should return only 30 row. But I am running into below exception regarding rows limit which I was not expecting since INTERMEDIATE result of FACT Table should only have few rows.
Query:
select b.user_id
from fact_table a
inner join dimension_table b on a.user_id = b.user_id
where a.phone = '919741xxxxxx'
Execution Plan:
LogicalProject(user_id=[$1])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
PinotLogicalExchange(distribution=[hash[0]])
LogicalProject(user_id=[$51])
LogicalFilter(condition=[=($36, _UTF-8'919741511500')])
LogicalTableScan(table=[[default, fact_table]])
PinotLogicalExchange(distribution=[hash[0]])
LogicalProject(user_id=[$9])
LogicalTableScan(table=[[default, dimension_table]])
Error Code: 200
QueryExecutionError:
Received error query execution result block: {245=Cannot build in memory hash table for join operator, reached number of rows limit: 1048576. Consider increasing the limit for the maximum number of rows in a join either via the query option 'maxRowsInJoin' or the 'max_rows_in_join' hint in the 'joinOptions'. Alternatively, if partial results are acceptable, the join overflow mode can be set to 'BREAK' either via the query option 'joinOverflowMode' or the 'join_overflow_mode' hint in the 'joinOptions'.Kasinath Reddy
01/22/2025, 1:24 PMRaghu Koratagere
01/22/2025, 1:28 PMRaghu Koratagere
01/22/2025, 1:28 PMRaghu Koratagere
01/22/2025, 1:30 PMUse Multi-Stage Engine is checkedGonzalo Ortiz
01/22/2025, 2:29 PMGonzalo Ortiz
01/22/2025, 2:31 PMGonzalo Ortiz
01/22/2025, 2:32 PMGonzalo Ortiz
01/22/2025, 2:32 PMRaghu Koratagere
01/22/2025, 4:12 PMLogicalProject(user_id=[$1])
LogicalJoin(condition=[=($0, $1)], joinType=[inner])
PinotLogicalExchange(distribution=[hash[0]])
LogicalProject(user_id=[$9])
LogicalTableScan(table=[[default, dimension_table]])
PinotLogicalExchange(distribution=[hash[0]])
LogicalProject(user_id=[$51])
LogicalFilter(condition=[=($36, _UTF-8'9741xxxx')])
LogicalTableScan(table=[[default, fact_table]])Gonzalo Ortiz
01/23/2025, 10:45 AMselect b.user_id
from dimension_table b
inner join fact_table a on a.user_id = b.user_id
where a.phone = '919741xxxxxx'
Than
select b.user_id
from dimension_table b
inner join (select distinct user_id from fact_table where a.phone = '919741xxxxxx') a on a.user_id = b.user_id
?
In that case, you (or Pinot automatically) can rewrite that as:
select b.user_id
from dimension_table b
where b.user_id in (select user_id from fact_table where phone = '919741xxxxxx');
which is quite faster if only a few hundreds user_ids are expected.Gonzalo Ortiz
01/23/2025, 10:48 AMGonzalo Ortiz
01/23/2025, 10:55 AMGonzalo Ortiz
01/23/2025, 10:56 AM