Yes, we should be able to do this as a hash join with the outer table and inner list of constant values. Perhaps we should think of a generic SubqueryScan operator that can scan a list of constant values or the output of a subquery .. for example: WHERE <column> IN (SELECT <column> FROM...).
Incidentally, NOT IN throws an error even with just a few elements in the list.. so I believe this is not supported at all yet. I will file a separate JIRA for it. select _MAP['N_REGIONKEY'], _MAP['N_NATIONKEY'] FROM "/tmp/parquet/nation.parquet" where cast(_MAP['N_NATIONKEY'] as int) not in (1, 2, 3, 4); java.lang.AssertionError: todo: implement syntax Prefix(NOT(OR(OR(OR(=(CAST(ITEM($0, 'N_NATIONKEY')):INTEGER NOT NULL, 1), =(CAST(ITEM($0, 'N_NATIONKEY')):INTEGER NOT NULL, 2)), =(CAST(ITEM($0, 'N_NATIONKEY')):INTEGER NOT NULL, 3)), =(CAST(ITEM($0, 'N_NATIONKEY')):INTEGER NOT NULL, 4)))) at org.apache.drill.optiq.DrillOptiq$RexToDrill.visitCall(DrillOptiq.java:129) at org.apache.drill.optiq.DrillOptiq$RexToDrill.visitCall(DrillOptiq.java:75) at org.eigenbase.rex.RexCall.accept(RexCall.java:220) at org.apache.drill.optiq.DrillOptiq.toDrill(DrillOptiq.java:71) On Mon, Mar 3, 2014 at 5:59 AM, Jason Altekruse (JIRA) <[email protected]>wrote: > > [ > https://issues.apache.org/jira/browse/DRILL-391?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13918065#comment-13918065] > > Jason Altekruse commented on DRILL-391: > --------------------------------------- > > I was the one who worked on Drill 57 last summer. That was before we had > the full execution engine set up, so the implementation that is available > is for the reference interpreter. > > > IN-list predicate with 20 or more elements gives > UnsupportedOperationException > > > ------------------------------------------------------------------------------ > > > > Key: DRILL-391 > > URL: https://issues.apache.org/jira/browse/DRILL-391 > > Project: Apache Drill > > Issue Type: Bug > > Reporter: Aman Sinha > > > > select _MAP['N_REGIONKEY'], _MAP['N_NATIONKEY'] FROM > "/tmp/parquet/nation.parquet" where cast(_MAP['N_NATIONKEY'] as int) in (1, > 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20); > > java.lang.UnsupportedOperationException > > at > org.apache.drill.optiq.DrillValuesRel.implement(DrillValuesRel.java:51) > > at > org.apache.drill.optiq.DrillImplementor.visitChild(DrillImplementor.java:143) > > at > org.apache.drill.optiq.DrillAggregateRel.implement(DrillAggregateRel.java:62) > > at > org.apache.drill.optiq.DrillImplementor.visitChild(DrillImplementor.java:143) > > at > org.apache.drill.optiq.DrillJoinRel.implementInput(DrillJoinRel.java:98) > > at > org.apache.drill.optiq.DrillJoinRel.implement(DrillJoinRel.java:75) > > at > org.apache.drill.optiq.DrillImplementor.visitChild(DrillImplementor.java:143) > > at > org.apache.drill.optiq.DrillProjectRel.implement(DrillProjectRel.java:63) > > > > -- > This message was sent by Atlassian JIRA > (v6.2#6252) >
