Robert Hou created DRILL-5886: --------------------------------- Summary: Operators should create batch sizes that the next operator can consume to avoid OOM Key: DRILL-5886 URL: https://issues.apache.org/jira/browse/DRILL-5886 Project: Apache Drill Issue Type: Bug Components: Execution - Relational Operators Affects Versions: 1.11.0 Reporter: Robert Hou Attachments: 26478262-f0a7-8fc1-1887-4f27071b9c0f.sys.drill, drillbit.log.exchange
Query is: {noformat} ALTER SESSION SET `exec.sort.disable_managed` = false alter session set `planner.memory.max_query_memory_per_node` = 482344960 alter session set `planner.width.max_per_node` = 1 alter session set `planner.width.max_per_query` = 1 alter session set `planner.disable_exchanges` = true select count(*) from (select * from dfs.`/drill/testdata/resource-manager/3500cols.tbl` order by columns[450],columns[330],columns[230],columns[220],columns[110],columns[90],columns[80],columns[70],columns[40],columns[10],columns[20],columns[30],columns[40],columns[50], columns[454],columns[413],columns[940],columns[834],columns[73],columns[140],columns[104],columns[2222],columns[30],columns[2420],columns[1520], columns[1410], columns[1110],columns[1290],columns[2380],columns[705],columns[45],columns[1054],columns[2430],columns[420],columns[404],columns[3350], columns[3333],columns[153],columns[356],columns[84],columns[745],columns[1450],columns[103],columns[2065],columns[343],columns[3420],columns[530], columns[3210] ) d where d.col433 = 'sjka skjf'; {noformat} This is the error from drillbit.log: 2017-09-12 17:36:53,155 [26478262-f0a7-8fc1-1887-4f27071b9c0f:frag:0:0] ERROR o.a.d.e.p.i.x.m.ExternalSortBatch - Insufficient memory to merge two batches. Incoming batch size: 409305088, available memory: 482344960 Here is the plan: {noformat} | 00-00 Screen 00-01 Project(EXPR$0=[$0]) 00-02 StreamAgg(group=[{}], EXPR$0=[COUNT()]) 00-03 Project($f0=[0]) 00-04 SelectionVectorRemover 00-05 Filter(condition=[=(ITEM($0, 'col433'), 'sjka skjf')]) 00-06 Project(T8¦¦*=[$0]) 00-07 SelectionVectorRemover 00-08 Sort(sort0=[$1], sort1=[$2], sort2=[$3], sort3=[$4], sort4=[$5], sort5=[$6], sort6=[$7], sort7=[$8], sort8=[$9], sort9=[$10], sort10=[$11], sort11=[$12], sort12=[$9], sort13=[$13], sort14=[$14], sort15=[$15], sort16=[$16], sort17=[$17], sort18=[$18], sort19=[$19], sort20=[$20], sort21=[$21], sort22=[$12], sort23=[$22], sort24=[$23], sort25=[$24], sort26=[$25], sort27=[$26], sort28=[$27], sort29=[$28], sort30=[$29], sort31=[$30], sort32=[$31], sort33=[$32], sort34=[$33], sort35=[$34], sort36=[$35], sort37=[$36], sort38=[$37], sort39=[$38], sort40=[$39], sort41=[$40], sort42=[$41], sort43=[$42], sort44=[$43], sort45=[$44], sort46=[$45], sort47=[$46], dir0=[ASC], dir1=[ASC], dir2=[ASC], dir3=[ASC], dir4=[ASC], dir5=[ASC], dir6=[ASC], dir7=[ASC], dir8=[ASC], dir9=[ASC], dir10=[ASC], dir11=[ASC], dir12=[ASC], dir13=[ASC], dir14=[ASC], dir15=[ASC], dir16=[ASC], dir17=[ASC], dir18=[ASC], dir19=[ASC], dir20=[ASC], dir21=[ASC], dir22=[ASC], dir23=[ASC], dir24=[ASC], dir25=[ASC], dir26=[ASC], dir27=[ASC], dir28=[ASC], dir29=[ASC], dir30=[ASC], dir31=[ASC], dir32=[ASC], dir33=[ASC], dir34=[ASC], dir35=[ASC], dir36=[ASC], dir37=[ASC], dir38=[ASC], dir39=[ASC], dir40=[ASC], dir41=[ASC], dir42=[ASC], dir43=[ASC], dir44=[ASC], dir45=[ASC], dir46=[ASC], dir47=[ASC]) 00-09 Project(T8¦¦*=[$0], EXPR$1=[ITEM($1, 450)], EXPR$2=[ITEM($1, 330)], EXPR$3=[ITEM($1, 230)], EXPR$4=[ITEM($1, 220)], EXPR$5=[ITEM($1, 110)], EXPR$6=[ITEM($1, 90)], EXPR$7=[ITEM($1, 80)], EXPR$8=[ITEM($1, 70)], EXPR$9=[ITEM($1, 40)], EXPR$10=[ITEM($1, 10)], EXPR$11=[ITEM($1, 20)], EXPR$12=[ITEM($1, 30)], EXPR$13=[ITEM($1, 50)], EXPR$14=[ITEM($1, 454)], EXPR$15=[ITEM($1, 413)], EXPR$16=[ITEM($1, 940)], EXPR$17=[ITEM($1, 834)], EXPR$18=[ITEM($1, 73)], EXPR$19=[ITEM($1, 140)], EXPR$20=[ITEM($1, 104)], EXPR$21=[ITEM($1, 2222)], EXPR$22=[ITEM($1, 2420)], EXPR$23=[ITEM($1, 1520)], EXPR$24=[ITEM($1, 1410)], EXPR$25=[ITEM($1, 1110)], EXPR$26=[ITEM($1, 1290)], EXPR$27=[ITEM($1, 2380)], EXPR$28=[ITEM($1, 705)], EXPR$29=[ITEM($1, 45)], EXPR$30=[ITEM($1, 1054)], EXPR$31=[ITEM($1, 2430)], EXPR$32=[ITEM($1, 420)], EXPR$33=[ITEM($1, 404)], EXPR$34=[ITEM($1, 3350)], EXPR$35=[ITEM($1, 3333)], EXPR$36=[ITEM($1, 153)], EXPR$37=[ITEM($1, 356)], EXPR$38=[ITEM($1, 84)], EXPR$39=[ITEM($1, 745)], EXPR$40=[ITEM($1, 1450)], EXPR$41=[ITEM($1, 103)], EXPR$42=[ITEM($1, 2065)], EXPR$43=[ITEM($1, 343)], EXPR$44=[ITEM($1, 3420)], EXPR$45=[ITEM($1, 530)], EXPR$46=[ITEM($1, 3210)]) 00-10 Project(T8¦¦*=[$0], columns=[$1]) 00-11 Scan(groupscan=[EasyGroupScan [selectionRoot=maprfs:/drill/testdata/resource-manager/3500cols.tbl, numFiles=1, columns=[`*`], files=[maprfs:///drill/testdata/resource-manager/3500cols.tbl]]]) {noformat} The sort succeeds if exchanges are enabled, but fails if exchanges are disabled. -- This message was sent by Atlassian JIRA (v6.4.14#64029)