Open seraphjiang opened 4 years ago
Thanks for the report! I have reproduced this output and DSL was printed as follows:
{
"Physical Plan" : {
"Project [ columns=[i.issueId] ]" : {
"Top [ count=200 ]" : {
"BlockHashJoin[ conditions=( i.issueId = d.issueId ), type=LEFT_OUTER_JOIN, blockSize=[FixedBlockSize with size=10000] ]" : {
"Scroll [ issue_detail as d, pageSize=10000 ]" : {
"request" : {
"size" : 200,
"query" : {
"bool" : {
"filter" : [
{
"bool" : {
"adjust_pure_negative" : true,
"must" : [
{
"term" : {
"priority" : {
"boost" : 1,
"value" : 2
}
}
}
],
"boost" : 1
}
}
],
"adjust_pure_negative" : true,
"boost" : 1
}
},
"from" : 0
}
},
"Scroll [ issue as i, pageSize=10000 ]" : {
"request" : {
"size" : 200,
"from" : 0,
"_source" : {
"excludes" : [ ],
"includes" : [
"issueId"
]
}
}
},
"useTermsFilterOptimization" : false
}
}
}
},
"description" : "Hash Join algorithm builds hash table based on result of first query, and then probes hash table to find matched rows for each row returned by second query",
"Logical Plan" : {
"Project [ columns=[i.issueId] ]" : {
"Top [ count=200 ]" : {
"Join [ conditions=( i.issueId = d.issueId ) type=LEFT_OUTER_JOIN ]" : {
"Group" : [
{
"Project [ columns=[i.issueId] ]" : {
"TableScan" : {
"tableAlias" : "i",
"tableName" : "issue"
}
}
},
{
"Project [ columns=[d.issueId] ]" : {
"Filter [ conditions=[AND ( AND priority EQ 2 ) ] ]" : {
"TableScan" : {
"tableAlias" : "d",
"tableName" : "issue_detail"
}
}
}
}
]
}
}
}
}
}
As we can see in the physical plan, the filter was pushed into only the left table, which causes problem to the LEFT JOIN queries with filters. Currently we do not support filter and aggregate on the result of LEFT JOINs due to the limitation of ES. Related issues: #245 #236 #289 #124 #110
Problem
I want to be able to find list of issue, filter by attribute from another left join table.
I have two index, issue and issue_detail, they share the same key issueId. issue_detail has additional attribute - priority i'd like to use to filter out result.
see below example
SQL Query
OD-SQL Query
Actual result:
Expect result:
Testing Data