[
https://issues.apache.org/jira/browse/DRILL-1514?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14207928#comment-14207928
]
B Anil Kumar commented on DRILL-1514:
-------------------------------------
While debugging, we observed that, If we change the alias in the select clause,
then it's working.
In genPlan, after execution of convertToRel() method, the ProjectRel looks as
below for the below two queries respectively.
For: *EXPLAIN PLAN FOR SELECT t1.first_name FROM mongo.employee.`empinfo` t1
JOIN mongo.employee.`empinfo` t2 ON t1.`employee_id` = t2.`employee_id`*
{{doesn't work}}.
{noformat}
rel=ProjectRel
child=JonRel
-- condition=($1, $3)
-- left -> rowType -> DrillRecordRow([*, employee_id, first_name])
-- right -> rowType -> DrillRecordRow([*, employee_id])
{noformat}
If you observe the above "condition", the positions seems to be wrong and I
think the comparison is happening between wrong fields and that's why it's
failing.
Where as for: *EXPLAIN PLAN FOR SELECT t2.first_name FROM
mongo.employee.`empinfo` t1 JOIN mongo.employee.`empinfo` t2 ON
t1.`employee_id` = t2.`employee_id`* {{works}}.
{noformat}
rel=ProjectRel
child=JonRel
-- condition=($1, $3)
-- left -> rowType -> DrillRecordRow([*, employee_id])
-- right -> rowType -> DrillRecordRow([*, employee_id, first_name])
{noformat}
If you observe the above "condition" then it's proper.
> Joins are not working with mongo
> --------------------------------
>
> Key: DRILL-1514
> URL: https://issues.apache.org/jira/browse/DRILL-1514
> Project: Apache Drill
> Issue Type: Bug
> Components: Storage - MongoDB
> Environment: Joins with Mongo storage plugin
> Reporter: B Anil Kumar
> Assignee: B Anil Kumar
>
> As pointed in review board(https://reviews.apache.org/r/25996/), joins are
> not working with mongo storage plugin.
> Few sample queries:
> {noformat}
> 1) SELECT t1.first_name FROM mongo.employee.`empinfo` t1 JOIN
> mongo.employee.`empinfo` t2 ON t1.`employee_id` = t2.`employee_id`
> 2) SELECT t1.first_name, t2.last_name FROM mongo.employee.`empinfo` t1 JOIN
> cp.`employee.json` t2 ON t1.`employee_id` = t2.`employee_id` limit 10
> {noformat}
> The Error is as below:
> {noformat}
> 2014-10-09 11:57:59,721 [d1785c2e-ac11-4f1e-9f7f-1f880aeceb7e:frag:0:0] DEBUG
> o.a.d.e.w.fragment.FragmentExecutor - Error while initializing or executing
> fragment
> java.lang.UnsupportedOperationException: Failure finding function that
> runtime code generation expected. Signature: compare_to(
> BIGINT:OPTIONALVARCHAR:OPTIONAL, ) returns INT:REQUIRED
> at
> org.apache.drill.exec.expr.fn.FunctionGenerationHelper.getFunctionExpression(FunctionGenerationHelper.java:74)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.expr.fn.FunctionGenerationHelper.getComparator(FunctionGenerationHelper.java:45)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.common.ChainedHashTable.setupIsKeyMatchInternal(ChainedHashTable.java:232)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.common.ChainedHashTable.createAndSetupHashTable(ChainedHashTable.java:182)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.join.HashJoinBatch.setupHashTable(HashJoinBatch.java:298)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.join.HashJoinBatch.executeBuildPhase(HashJoinBatch.java:325)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.join.HashJoinBatch.innerNext(HashJoinBatch.java:193)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:105)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:117)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:85)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:75)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:50)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:127)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:105)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:117)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:85)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:75)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractSingleRecordBatch.innerNext(AbstractSingleRecordBatch.java:50)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.project.ProjectRecordBatch.innerNext(ProjectRecordBatch.java:127)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.record.AbstractRecordBatch.next(AbstractRecordBatch.java:105)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.validate.IteratorValidatorBatchIterator.next(IteratorValidatorBatchIterator.java:117)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:67)
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.ScreenCreator$ScreenRoot.innerNext(ScreenCreator.java:97)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.physical.impl.BaseRootExec.next(BaseRootExec.java:57)
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.work.fragment.FragmentExecutor.run(FragmentExecutor.java:104)
>
> ~[drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> org.apache.drill.exec.work.WorkManager$RunnableWrapper.run(WorkManager.java:250)
>
> [drill-java-exec-0.7.0-incubating-SNAPSHOT-rebuffed.jar:0.7.0-incubating-SNAPSHOT]
> at
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
> [na:1.7.0_60]
> at
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
> [na:1.7.0_60]
> at java.lang.Thread.run(Thread.java:745) [na:1.7.0_60]
> {noformat}
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)