You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "Sorabh Hamirwasia (JIRA)" <ji...@apache.org> on 2018/08/04 02:53:00 UTC

[jira] [Commented] (DRILL-6653) Unsupported Schema change exception where there is no schema change in lateral Unnest queries

    [ https://issues.apache.org/jira/browse/DRILL-6653?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16569017#comment-16569017 ] 

Sorabh Hamirwasia commented on DRILL-6653:
------------------------------------------

The issue here is that there is HashAgg operator downstream of Sort. ExternalSortBatch always produces first output batch post build schema phase with OK_NEW_SCHEMA which is not supported by HashAgg. HashAgg only expects OK_NEW_SCHEMA in buildSchema phase and assert if it sees afterwards.  The same issue is reproducible without Lateral/Unnest by writing a query such that there is HashAgg downtsream of Sort.

Since there is no actual schema change post build schema phase from Sort it just sends OK_NEW_SCHEMA because Sort produces SV4 as output batch whereas during buildSchema phase it produces SV None batch. But this is only container type change and not an actual schema change. To resolve this issue we can make a change in RemovingRecordBatch setupNewSchema to not clear the container always. RemovingRecordBatch always output a container of type SVMode None no matter if incoming batch is with SVMode None/SV2/SV4. Hence when RemovingRecordBatch receives an incoming with OK_NEW_SCHEMA with no actual schema change then in setupNewSchema
it consumes OK_NEW_SCHEMA and produce OK outcome instead. Sort is followed by SelectionVectorRemover almost every time except when StreamingAgg is present. StreamingAgg knows how to handle multiple OK_NEW_SCHEMA so it should be fine in that case too.

> Unsupported Schema change exception where there is no schema change in lateral Unnest queries
> ---------------------------------------------------------------------------------------------
>
>                 Key: DRILL-6653
>                 URL: https://issues.apache.org/jira/browse/DRILL-6653
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.14.0
>            Reporter: Kedar Sankar Behera
>            Assignee: Parth Chandra
>            Priority: Major
>             Fix For: 1.15.0
>
>
> Unsupported Schema change exception where there is no schema change
> DataSet - A single json file(sf1)
> Query - 
> {code}
> select customer.c_custkey, customer.c_name, sum(orders.totalprice) totalprice from customer, lateral (select t.o.o_totalprice as totalprice from unnest(customer.c_orders) t(o) order by totalprice limit 10) orders group by customer.c_custkey, customer.c_name order by customer.c_custkey limit 50;
> {code}
> Result - 
> {code}
> Exception:
> java.sql.SQLException: UNSUPPORTED_OPERATION ERROR: Hash aggregate does not support schema change
> Prior schema : 
> BatchSchema [fields=[[`c_custkey` (VARCHAR:OPTIONAL)], [`c_name` (VARCHAR:OPTIONAL)], [`totalprice` (FLOAT8:OPTIONAL)]], selectionVector=NONE]
> New schema : 
> BatchSchema [fields=[[`c_custkey` (VARCHAR:OPTIONAL)], [`c_name` (VARCHAR:OPTIONAL)], [`totalprice` (FLOAT8:OPTIONAL)]], selectionVector=NONE]
> Fragment 0:0
> [Error Id: 21d4d646-4e6a-4e4a-ba75-60ba247ddabd on drill191:31010]
>  at org.apache.drill.jdbc.impl.DrillCursor.nextRowInternally(DrillCursor.java:528)
>  at org.apache.drill.jdbc.impl.DrillCursor.next(DrillCursor.java:632)
>  at oadd.org.apache.calcite.avatica.AvaticaResultSet.next(AvaticaResultSet.java:207)
>  at org.apache.drill.jdbc.impl.DrillResultSetImpl.next(DrillResultSetImpl.java:153)
>  at org.apache.drill.test.framework.DrillTestJdbc.executeQuery(DrillTestJdbc.java:253)
>  at org.apache.drill.test.framework.DrillTestJdbc.run(DrillTestJdbc.java:115)
>  at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
>  at java.util.concurrent.FutureTask.run(FutureTask.java:266)
>  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
>  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
>  at java.lang.Thread.run(Thread.java:748)
> Caused by: oadd.org.apache.drill.common.exceptions.UserRemoteException: UNSUPPORTED_OPERATION ERROR: Hash aggregate does not support schema change
> Prior schema : 
> BatchSchema [fields=[[`c_custkey` (VARCHAR:OPTIONAL)], [`c_name` (VARCHAR:OPTIONAL)], [`totalprice` (FLOAT8:OPTIONAL)]], selectionVector=NONE]
> New schema : 
> BatchSchema [fields=[[`c_custkey` (VARCHAR:OPTIONAL)], [`c_name` (VARCHAR:OPTIONAL)], [`totalprice` (FLOAT8:OPTIONAL)]], selectionVector=NONE]
> Fragment 0:0
> [Error Id: 21d4d646-4e6a-4e4a-ba75-60ba247ddabd on drill191:31010]
>  at oadd.org.apache.drill.exec.rpc.user.QueryResultHandler.resultArrived(QueryResultHandler.java:123)
>  at oadd.org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:422)
>  at oadd.org.apache.drill.exec.rpc.user.UserClient.handle(UserClient.java:96)
>  at oadd.org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:274)
>  at oadd.org.apache.drill.exec.rpc.RpcBus$InboundHandler.decode(RpcBus.java:244)
>  at oadd.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:88)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
>  at oadd.io.netty.handler.timeout.IdleStateHandler.channelRead(IdleStateHandler.java:287)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
>  at oadd.io.netty.handler.codec.MessageToMessageDecoder.channelRead(MessageToMessageDecoder.java:102)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
>  at oadd.io.netty.handler.codec.ByteToMessageDecoder.fireChannelRead(ByteToMessageDecoder.java:312)
>  at oadd.io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:286)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
>  at oadd.io.netty.channel.ChannelInboundHandlerAdapter.channelRead(ChannelInboundHandlerAdapter.java:86)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:335)
>  at oadd.io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1294)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:356)
>  at oadd.io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:342)
>  at oadd.io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:911)
>  at oadd.io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:131)
>  at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:645)
>  at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:580)
>  at oadd.io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:497)
>  at oadd.io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:459)
>  at oadd.io.netty.util.concurrent.SingleThreadEventExecutor$2.run(SingleThreadEventExecutor.java:131)
>  ... 1 more
> {code}
>  



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)