physical_plan_as_json.slt 328 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394959697989910010110210310410510610710810911011111211311411511611711811912012112212312412512612712812913013113213313413513613713813914014114214314414514614714814915015115215315415515615715815916016116216316416516616716816917017117217317417517617717817918018118218318418518618718818919019119219319419519619719819920020120220320420520620720820921021121221321421521621721821922022122222322422522622722822923023123223323423523623723823924024124224324424524624724824925025125225325425525625725825926026126226326426526626726826927027127227327427527627727827928028128228328428528628728828929029129229329429529629729829930030130230330430530630730830931031131231331431531631731831932032132232332432532632732832933033133233333433533633733833934034134234334434534634734834935035135235335435535635735835936036136236336436536636736836937037137237337437537637737837938038138238338438538638738838939039139239339439539639739839940040140240340440540640740840941041141241341441541641741841942042142242342442542642742842943043143243343443543643743843944044144244344444544644744844945045145245345445545645745845946046146246346446546646746846947047147247347447547647747847948048148248348448548648748848949049149249349449549649749849950050150250350450550650750850951051151251351451551651751851952052152252352452552652752852953053153253353453553653753853954054154254354454554654754854955055155255355455555655755855956056156256356456556656756856957057157257357457557657757857958058158258358458558658758858959059159259359459559659759859960060160260360460560660760860961061161261361461561661761861962062162262362462562662762862963063163263363463563663763863964064164264364464564664764864965065165265365465565665765865966066166266366466566666766866967067167267367467567667767867968068168268368468568668768868969069169269369469569669769869970070170270370470570670770870971071171271371471571671771871972072172272372472572672772872973073173273373473573673773873974074174274374474574674774874975075175275375475575675775875976076176276376476576676776876977077177277377477577677777877978078178278378478578678778878979079179279379479579679779879980080180280380480580680780880981081181281381481581681781881982082182282382482582682782882983083183283383483583683783883984084184284384484584684784884985085185285385485585685785885986086186286386486586686786886987087187287387487587687787887988088188288388488588688788888989089189289389489589689789889990090190290390490590690790890991091191291391491591691791891992092192292392492592692792892993093193293393493593693793893994094194294394494594694794894995095195295395495595695795895996096196296396496596696796896997097197297397497597697797897998098198298398498598698798898999099199299399499599699799899910001001100210031004100510061007100810091010101110121013101410151016101710181019102010211022102310241025102610271028102910301031103210331034103510361037103810391040104110421043104410451046104710481049105010511052105310541055105610571058105910601061106210631064106510661067106810691070107110721073107410751076107710781079108010811082108310841085108610871088108910901091109210931094109510961097109810991100110111021103110411051106110711081109111011111112111311141115111611171118111911201121112211231124112511261127112811291130113111321133113411351136113711381139114011411142114311441145114611471148114911501151115211531154115511561157115811591160116111621163116411651166116711681169117011711172117311741175117611771178117911801181118211831184118511861187118811891190119111921193119411951196119711981199120012011202120312041205120612071208120912101211121212131214121512161217121812191220122112221223122412251226122712281229123012311232123312341235123612371238123912401241124212431244124512461247124812491250125112521253125412551256125712581259126012611262126312641265126612671268126912701271127212731274127512761277127812791280128112821283128412851286128712881289129012911292129312941295129612971298129913001301130213031304130513061307130813091310131113121313131413151316131713181319132013211322132313241325132613271328132913301331133213331334133513361337133813391340134113421343134413451346134713481349135013511352135313541355135613571358135913601361136213631364136513661367136813691370137113721373137413751376137713781379138013811382138313841385138613871388138913901391139213931394139513961397139813991400140114021403140414051406140714081409141014111412141314141415141614171418141914201421142214231424142514261427142814291430143114321433143414351436143714381439144014411442144314441445144614471448144914501451145214531454145514561457145814591460146114621463146414651466146714681469147014711472147314741475147614771478147914801481148214831484148514861487148814891490149114921493149414951496149714981499150015011502150315041505150615071508150915101511151215131514151515161517151815191520152115221523152415251526152715281529153015311532153315341535153615371538153915401541154215431544154515461547154815491550155115521553155415551556155715581559156015611562156315641565156615671568156915701571157215731574157515761577157815791580158115821583158415851586158715881589159015911592159315941595159615971598159916001601160216031604160516061607160816091610161116121613161416151616161716181619162016211622162316241625162616271628162916301631163216331634163516361637163816391640164116421643164416451646164716481649165016511652165316541655165616571658165916601661166216631664166516661667166816691670167116721673167416751676167716781679168016811682168316841685168616871688168916901691169216931694169516961697169816991700170117021703170417051706170717081709171017111712171317141715171617171718171917201721172217231724172517261727172817291730173117321733173417351736173717381739174017411742174317441745174617471748174917501751175217531754175517561757175817591760176117621763176417651766176717681769177017711772177317741775177617771778177917801781178217831784178517861787178817891790179117921793179417951796179717981799180018011802180318041805180618071808180918101811181218131814181518161817181818191820182118221823182418251826182718281829183018311832183318341835183618371838183918401841184218431844184518461847184818491850185118521853185418551856185718581859186018611862186318641865186618671868186918701871187218731874187518761877187818791880188118821883188418851886188718881889189018911892189318941895189618971898189919001901190219031904190519061907190819091910191119121913191419151916191719181919192019211922192319241925192619271928192919301931193219331934193519361937193819391940194119421943194419451946194719481949195019511952195319541955195619571958195919601961196219631964196519661967196819691970197119721973197419751976197719781979198019811982198319841985198619871988198919901991199219931994199519961997199819992000200120022003200420052006200720082009201020112012201320142015201620172018201920202021202220232024202520262027202820292030203120322033203420352036203720382039204020412042204320442045204620472048204920502051205220532054205520562057205820592060206120622063206420652066206720682069207020712072207320742075207620772078207920802081208220832084208520862087208820892090209120922093209420952096209720982099210021012102210321042105210621072108210921102111211221132114211521162117211821192120212121222123212421252126212721282129213021312132213321342135213621372138213921402141214221432144214521462147214821492150215121522153215421552156215721582159216021612162216321642165216621672168216921702171217221732174217521762177217821792180218121822183218421852186218721882189219021912192219321942195219621972198219922002201220222032204220522062207220822092210221122122213221422152216221722182219222022212222222322242225222622272228222922302231223222332234223522362237223822392240224122422243224422452246224722482249225022512252225322542255225622572258225922602261226222632264226522662267226822692270227122722273227422752276227722782279228022812282228322842285228622872288228922902291229222932294229522962297229822992300230123022303230423052306230723082309231023112312231323142315231623172318231923202321232223232324232523262327232823292330233123322333233423352336233723382339234023412342234323442345234623472348234923502351235223532354235523562357235823592360236123622363236423652366236723682369237023712372237323742375237623772378237923802381238223832384238523862387238823892390239123922393239423952396239723982399240024012402240324042405240624072408240924102411241224132414241524162417241824192420242124222423242424252426242724282429243024312432243324342435243624372438243924402441244224432444244524462447244824492450245124522453245424552456245724582459246024612462246324642465246624672468246924702471247224732474247524762477247824792480248124822483248424852486248724882489249024912492249324942495249624972498249925002501250225032504250525062507250825092510251125122513251425152516251725182519252025212522252325242525252625272528252925302531253225332534253525362537253825392540254125422543254425452546254725482549255025512552255325542555255625572558255925602561256225632564256525662567256825692570257125722573257425752576257725782579258025812582258325842585258625872588258925902591259225932594259525962597259825992600260126022603260426052606260726082609261026112612261326142615261626172618261926202621262226232624262526262627262826292630263126322633263426352636263726382639264026412642264326442645264626472648264926502651265226532654265526562657265826592660266126622663266426652666266726682669267026712672267326742675267626772678267926802681268226832684268526862687268826892690269126922693269426952696269726982699270027012702270327042705270627072708270927102711271227132714271527162717271827192720272127222723272427252726272727282729273027312732273327342735273627372738273927402741274227432744274527462747274827492750275127522753275427552756275727582759276027612762276327642765276627672768276927702771277227732774277527762777277827792780278127822783278427852786278727882789279027912792279327942795279627972798279928002801280228032804280528062807280828092810281128122813281428152816281728182819282028212822282328242825282628272828282928302831283228332834283528362837283828392840284128422843284428452846284728482849285028512852285328542855285628572858285928602861286228632864286528662867286828692870287128722873287428752876287728782879288028812882288328842885288628872888288928902891289228932894289528962897289828992900290129022903290429052906290729082909291029112912291329142915291629172918291929202921292229232924292529262927292829292930293129322933293429352936293729382939294029412942294329442945294629472948294929502951295229532954295529562957295829592960296129622963296429652966296729682969297029712972297329742975297629772978297929802981298229832984298529862987298829892990299129922993299429952996299729982999300030013002300330043005300630073008300930103011301230133014301530163017301830193020302130223023302430253026302730283029303030313032303330343035303630373038303930403041304230433044304530463047304830493050305130523053305430553056305730583059306030613062306330643065306630673068306930703071307230733074307530763077307830793080308130823083308430853086308730883089309030913092309330943095309630973098309931003101310231033104310531063107310831093110311131123113311431153116311731183119312031213122312331243125312631273128312931303131313231333134313531363137313831393140314131423143314431453146314731483149315031513152315331543155315631573158315931603161316231633164316531663167316831693170317131723173317431753176317731783179318031813182318331843185318631873188318931903191319231933194319531963197319831993200320132023203320432053206320732083209321032113212321332143215321632173218321932203221322232233224322532263227322832293230323132323233323432353236323732383239324032413242324332443245324632473248324932503251325232533254325532563257325832593260326132623263326432653266326732683269327032713272327332743275327632773278327932803281328232833284328532863287328832893290329132923293329432953296329732983299330033013302330333043305330633073308330933103311331233133314331533163317331833193320332133223323332433253326332733283329333033313332333333343335333633373338333933403341334233433344334533463347334833493350335133523353335433553356335733583359336033613362336333643365336633673368336933703371337233733374337533763377337833793380338133823383338433853386338733883389339033913392339333943395339633973398339934003401340234033404340534063407340834093410341134123413341434153416341734183419342034213422342334243425342634273428342934303431343234333434343534363437343834393440344134423443344434453446344734483449345034513452345334543455345634573458345934603461346234633464346534663467346834693470347134723473347434753476347734783479348034813482348334843485348634873488348934903491349234933494349534963497349834993500350135023503350435053506350735083509351035113512351335143515351635173518351935203521352235233524352535263527352835293530353135323533353435353536353735383539354035413542354335443545354635473548354935503551355235533554355535563557355835593560356135623563356435653566356735683569357035713572357335743575357635773578357935803581358235833584358535863587358835893590359135923593359435953596359735983599360036013602360336043605360636073608360936103611361236133614361536163617361836193620362136223623362436253626362736283629363036313632363336343635363636373638363936403641364236433644364536463647364836493650365136523653365436553656365736583659366036613662366336643665366636673668366936703671367236733674367536763677367836793680368136823683368436853686368736883689369036913692369336943695369636973698369937003701370237033704370537063707370837093710371137123713371437153716371737183719372037213722372337243725372637273728372937303731373237333734373537363737373837393740374137423743374437453746374737483749375037513752375337543755375637573758375937603761376237633764376537663767376837693770377137723773377437753776377737783779378037813782378337843785378637873788378937903791379237933794379537963797379837993800380138023803380438053806380738083809381038113812381338143815381638173818381938203821382238233824382538263827382838293830383138323833383438353836383738383839384038413842384338443845384638473848384938503851385238533854385538563857385838593860386138623863386438653866386738683869387038713872387338743875387638773878387938803881388238833884388538863887388838893890389138923893389438953896389738983899390039013902390339043905390639073908390939103911391239133914391539163917391839193920392139223923392439253926392739283929393039313932393339343935393639373938393939403941394239433944394539463947394839493950395139523953395439553956395739583959396039613962396339643965396639673968396939703971397239733974397539763977397839793980398139823983398439853986398739883989399039913992399339943995399639973998399940004001400240034004400540064007400840094010401140124013401440154016401740184019402040214022402340244025402640274028402940304031403240334034403540364037403840394040404140424043404440454046404740484049405040514052405340544055405640574058405940604061406240634064406540664067406840694070407140724073407440754076407740784079408040814082408340844085408640874088408940904091409240934094409540964097409840994100410141024103410441054106410741084109411041114112411341144115411641174118411941204121412241234124412541264127412841294130413141324133413441354136413741384139414041414142414341444145414641474148414941504151415241534154415541564157415841594160416141624163416441654166416741684169417041714172417341744175417641774178417941804181418241834184418541864187418841894190419141924193419441954196419741984199420042014202420342044205420642074208420942104211421242134214421542164217421842194220422142224223422442254226422742284229423042314232423342344235423642374238423942404241424242434244424542464247424842494250425142524253425442554256425742584259426042614262426342644265426642674268426942704271427242734274427542764277427842794280428142824283428442854286428742884289429042914292429342944295429642974298429943004301430243034304430543064307430843094310431143124313431443154316431743184319432043214322432343244325432643274328432943304331433243334334433543364337433843394340434143424343434443454346434743484349435043514352435343544355435643574358435943604361436243634364436543664367436843694370437143724373437443754376437743784379438043814382438343844385438643874388438943904391439243934394439543964397439843994400440144024403440444054406440744084409441044114412441344144415441644174418441944204421442244234424442544264427442844294430443144324433443444354436443744384439444044414442444344444445444644474448444944504451445244534454445544564457445844594460446144624463446444654466446744684469447044714472447344744475447644774478447944804481448244834484448544864487448844894490449144924493449444954496449744984499450045014502450345044505450645074508450945104511451245134514451545164517451845194520452145224523452445254526452745284529453045314532453345344535453645374538453945404541454245434544454545464547454845494550455145524553455445554556455745584559456045614562456345644565456645674568456945704571457245734574457545764577457845794580458145824583458445854586458745884589459045914592459345944595459645974598459946004601460246034604460546064607460846094610461146124613461446154616461746184619462046214622462346244625462646274628462946304631463246334634463546364637463846394640464146424643464446454646464746484649465046514652465346544655465646574658465946604661466246634664466546664667466846694670467146724673467446754676467746784679468046814682468346844685468646874688468946904691469246934694469546964697469846994700470147024703470447054706470747084709471047114712471347144715471647174718471947204721472247234724472547264727472847294730473147324733473447354736473747384739474047414742474347444745474647474748474947504751475247534754475547564757475847594760476147624763476447654766476747684769477047714772477347744775477647774778477947804781478247834784478547864787478847894790479147924793479447954796479747984799480048014802480348044805480648074808480948104811481248134814481548164817481848194820482148224823482448254826482748284829483048314832483348344835483648374838483948404841484248434844484548464847484848494850485148524853485448554856485748584859486048614862486348644865486648674868486948704871487248734874487548764877487848794880488148824883488448854886488748884889489048914892489348944895489648974898489949004901490249034904490549064907490849094910491149124913491449154916491749184919492049214922492349244925492649274928492949304931493249334934493549364937493849394940494149424943494449454946494749484949495049514952495349544955495649574958495949604961496249634964496549664967496849694970497149724973497449754976497749784979498049814982498349844985498649874988498949904991499249934994499549964997499849995000500150025003500450055006500750085009501050115012501350145015501650175018501950205021502250235024502550265027502850295030503150325033503450355036503750385039504050415042504350445045504650475048504950505051505250535054505550565057505850595060506150625063506450655066506750685069507050715072507350745075507650775078507950805081508250835084508550865087508850895090509150925093509450955096509750985099510051015102510351045105510651075108510951105111511251135114511551165117511851195120512151225123512451255126512751285129513051315132513351345135513651375138513951405141514251435144514551465147514851495150515151525153515451555156515751585159516051615162516351645165516651675168516951705171517251735174517551765177517851795180518151825183518451855186518751885189519051915192519351945195519651975198519952005201520252035204520552065207520852095210521152125213521452155216521752185219522052215222522352245225522652275228522952305231523252335234523552365237523852395240524152425243524452455246524752485249525052515252525352545255525652575258525952605261526252635264526552665267526852695270527152725273527452755276527752785279528052815282528352845285528652875288528952905291529252935294529552965297529852995300530153025303530453055306530753085309531053115312531353145315531653175318531953205321532253235324532553265327532853295330533153325333533453355336533753385339534053415342534353445345534653475348534953505351535253535354535553565357535853595360536153625363536453655366536753685369537053715372537353745375537653775378537953805381538253835384538553865387538853895390539153925393539453955396539753985399540054015402540354045405540654075408540954105411541254135414541554165417541854195420542154225423542454255426542754285429543054315432543354345435543654375438543954405441544254435444544554465447544854495450545154525453545454555456545754585459546054615462546354645465546654675468546954705471547254735474547554765477547854795480548154825483548454855486548754885489549054915492549354945495549654975498549955005501550255035504550555065507550855095510551155125513551455155516551755185519552055215522552355245525552655275528552955305531553255335534553555365537553855395540554155425543554455455546554755485549555055515552555355545555555655575558555955605561556255635564556555665567556855695570557155725573557455755576557755785579558055815582558355845585558655875588558955905591559255935594559555965597559855995600560156025603560456055606560756085609561056115612561356145615561656175618561956205621562256235624562556265627562856295630563156325633563456355636563756385639564056415642564356445645564656475648564956505651565256535654565556565657565856595660566156625663566456655666566756685669567056715672567356745675567656775678567956805681568256835684568556865687568856895690569156925693569456955696569756985699570057015702570357045705570657075708570957105711571257135714571557165717571857195720572157225723572457255726572757285729573057315732573357345735573657375738573957405741574257435744574557465747574857495750575157525753575457555756575757585759576057615762576357645765576657675768576957705771577257735774577557765777577857795780578157825783578457855786578757885789579057915792579357945795579657975798579958005801580258035804580558065807580858095810581158125813581458155816581758185819582058215822582358245825582658275828582958305831583258335834583558365837583858395840584158425843584458455846584758485849585058515852585358545855585658575858585958605861586258635864586558665867586858695870587158725873587458755876587758785879588058815882588358845885588658875888588958905891589258935894589558965897589858995900590159025903590459055906590759085909591059115912591359145915591659175918591959205921592259235924592559265927592859295930593159325933593459355936593759385939594059415942594359445945594659475948594959505951595259535954595559565957595859595960596159625963596459655966596759685969597059715972597359745975597659775978597959805981598259835984598559865987598859895990599159925993599459955996599759985999600060016002600360046005600660076008600960106011601260136014601560166017601860196020602160226023602460256026602760286029603060316032603360346035603660376038603960406041604260436044604560466047604860496050605160526053605460556056605760586059606060616062606360646065606660676068606960706071607260736074607560766077607860796080608160826083608460856086608760886089609060916092609360946095609660976098609961006101610261036104610561066107610861096110611161126113611461156116611761186119612061216122612361246125612661276128612961306131613261336134613561366137613861396140614161426143614461456146614761486149615061516152615361546155615661576158615961606161616261636164616561666167616861696170617161726173617461756176617761786179618061816182618361846185618661876188618961906191619261936194619561966197619861996200620162026203620462056206620762086209621062116212621362146215621662176218621962206221622262236224622562266227622862296230623162326233623462356236623762386239624062416242624362446245624662476248624962506251625262536254625562566257625862596260626162626263626462656266626762686269627062716272627362746275627662776278627962806281628262836284628562866287628862896290629162926293629462956296629762986299630063016302630363046305630663076308630963106311631263136314631563166317631863196320632163226323632463256326632763286329633063316332633363346335633663376338633963406341634263436344634563466347634863496350635163526353635463556356635763586359636063616362636363646365636663676368636963706371637263736374637563766377637863796380638163826383638463856386638763886389639063916392639363946395639663976398639964006401640264036404640564066407640864096410641164126413641464156416641764186419642064216422642364246425642664276428642964306431643264336434643564366437643864396440644164426443644464456446644764486449645064516452645364546455645664576458645964606461646264636464646564666467646864696470647164726473647464756476647764786479648064816482648364846485648664876488648964906491649264936494649564966497649864996500650165026503650465056506650765086509651065116512651365146515651665176518651965206521652265236524652565266527652865296530653165326533653465356536653765386539654065416542654365446545654665476548654965506551655265536554655565566557655865596560656165626563656465656566656765686569657065716572657365746575657665776578657965806581658265836584658565866587658865896590659165926593659465956596659765986599660066016602660366046605660666076608660966106611661266136614661566166617661866196620662166226623662466256626662766286629663066316632663366346635663666376638663966406641664266436644664566466647664866496650665166526653665466556656665766586659666066616662666366646665666666676668666966706671667266736674667566766677667866796680668166826683668466856686668766886689669066916692669366946695669666976698669967006701670267036704670567066707670867096710671167126713671467156716671767186719672067216722672367246725672667276728672967306731673267336734673567366737673867396740674167426743674467456746674767486749675067516752675367546755675667576758675967606761676267636764676567666767676867696770677167726773677467756776677767786779678067816782678367846785678667876788678967906791679267936794679567966797679867996800680168026803680468056806680768086809681068116812681368146815681668176818681968206821682268236824682568266827682868296830683168326833683468356836683768386839684068416842684368446845684668476848684968506851685268536854685568566857685868596860686168626863686468656866686768686869687068716872687368746875687668776878687968806881688268836884688568866887688868896890689168926893689468956896689768986899690069016902690369046905690669076908690969106911691269136914691569166917691869196920692169226923692469256926692769286929693069316932693369346935693669376938693969406941694269436944694569466947694869496950695169526953695469556956695769586959696069616962696369646965696669676968696969706971697269736974697569766977697869796980698169826983698469856986698769886989699069916992699369946995699669976998699970007001700270037004700570067007700870097010701170127013701470157016701770187019702070217022702370247025702670277028702970307031703270337034703570367037703870397040704170427043704470457046704770487049705070517052705370547055705670577058705970607061706270637064706570667067706870697070707170727073707470757076707770787079708070817082708370847085708670877088708970907091709270937094709570967097709870997100710171027103710471057106710771087109711071117112711371147115711671177118711971207121712271237124712571267127712871297130713171327133713471357136713771387139714071417142714371447145714671477148714971507151715271537154715571567157715871597160716171627163716471657166716771687169717071717172717371747175717671777178717971807181718271837184718571867187718871897190719171927193719471957196719771987199720072017202720372047205720672077208720972107211721272137214721572167217721872197220722172227223722472257226722772287229723072317232723372347235723672377238723972407241724272437244724572467247724872497250725172527253725472557256725772587259726072617262726372647265726672677268726972707271727272737274727572767277727872797280728172827283728472857286728772887289729072917292729372947295729672977298729973007301730273037304730573067307730873097310731173127313731473157316731773187319732073217322732373247325732673277328732973307331733273337334733573367337733873397340734173427343734473457346734773487349735073517352735373547355735673577358735973607361736273637364736573667367736873697370737173727373737473757376737773787379738073817382738373847385738673877388738973907391739273937394739573967397739873997400740174027403740474057406740774087409741074117412741374147415741674177418741974207421742274237424742574267427742874297430743174327433743474357436743774387439744074417442744374447445744674477448744974507451745274537454745574567457745874597460746174627463746474657466746774687469747074717472747374747475747674777478747974807481748274837484748574867487748874897490749174927493749474957496749774987499750075017502750375047505750675077508750975107511751275137514751575167517751875197520752175227523752475257526752775287529753075317532753375347535753675377538753975407541754275437544754575467547754875497550755175527553755475557556755775587559756075617562756375647565756675677568756975707571757275737574757575767577757875797580758175827583758475857586758775887589759075917592759375947595759675977598759976007601760276037604760576067607760876097610761176127613761476157616761776187619762076217622762376247625762676277628762976307631763276337634763576367637763876397640764176427643764476457646764776487649765076517652765376547655765676577658765976607661766276637664766576667667766876697670767176727673767476757676767776787679768076817682768376847685768676877688768976907691769276937694769576967697769876997700770177027703770477057706770777087709771077117712771377147715771677177718771977207721772277237724772577267727772877297730773177327733773477357736773777387739774077417742774377447745774677477748774977507751775277537754775577567757775877597760776177627763776477657766776777687769777077717772777377747775777677777778777977807781778277837784778577867787778877897790779177927793779477957796779777987799780078017802780378047805780678077808780978107811781278137814781578167817781878197820782178227823782478257826782778287829783078317832783378347835783678377838783978407841784278437844784578467847784878497850785178527853785478557856785778587859786078617862786378647865786678677868786978707871787278737874787578767877787878797880788178827883788478857886788778887889789078917892789378947895789678977898789979007901790279037904790579067907790879097910791179127913791479157916791779187919792079217922792379247925792679277928792979307931793279337934793579367937793879397940794179427943794479457946794779487949795079517952795379547955795679577958795979607961796279637964796579667967796879697970797179727973797479757976797779787979798079817982798379847985798679877988798979907991799279937994799579967997799879998000800180028003800480058006800780088009801080118012801380148015801680178018801980208021802280238024802580268027802880298030803180328033803480358036803780388039804080418042804380448045804680478048804980508051805280538054805580568057805880598060806180628063806480658066806780688069807080718072807380748075807680778078807980808081808280838084808580868087808880898090809180928093809480958096809780988099810081018102810381048105810681078108810981108111811281138114811581168117811881198120812181228123812481258126812781288129813081318132813381348135813681378138813981408141814281438144814581468147814881498150815181528153815481558156815781588159816081618162816381648165816681678168816981708171817281738174817581768177817881798180818181828183818481858186818781888189819081918192819381948195819681978198819982008201820282038204820582068207820882098210821182128213821482158216821782188219822082218222822382248225822682278228822982308231823282338234823582368237823882398240824182428243824482458246824782488249825082518252825382548255825682578258825982608261826282638264826582668267826882698270827182728273827482758276827782788279828082818282828382848285828682878288828982908291829282938294829582968297829882998300830183028303830483058306830783088309831083118312831383148315831683178318831983208321832283238324832583268327832883298330833183328333833483358336833783388339834083418342834383448345834683478348834983508351835283538354835583568357835883598360836183628363836483658366836783688369837083718372837383748375837683778378837983808381838283838384838583868387838883898390839183928393839483958396839783988399840084018402840384048405840684078408840984108411841284138414841584168417841884198420842184228423842484258426842784288429843084318432843384348435843684378438843984408441844284438444844584468447844884498450845184528453845484558456845784588459846084618462846384648465846684678468846984708471847284738474847584768477847884798480848184828483848484858486848784888489849084918492849384948495849684978498849985008501850285038504850585068507850885098510851185128513851485158516851785188519852085218522852385248525852685278528852985308531853285338534853585368537853885398540854185428543854485458546854785488549855085518552855385548555855685578558855985608561856285638564856585668567856885698570857185728573857485758576857785788579858085818582858385848585858685878588858985908591859285938594859585968597859885998600860186028603860486058606860786088609861086118612861386148615861686178618861986208621862286238624862586268627862886298630863186328633863486358636863786388639864086418642864386448645864686478648864986508651865286538654865586568657865886598660866186628663866486658666866786688669867086718672867386748675867686778678867986808681868286838684868586868687868886898690869186928693869486958696869786988699870087018702870387048705870687078708870987108711871287138714871587168717871887198720872187228723872487258726872787288729873087318732873387348735873687378738873987408741874287438744874587468747874887498750875187528753875487558756875787588759876087618762876387648765876687678768876987708771877287738774877587768777877887798780878187828783878487858786878787888789879087918792879387948795879687978798879988008801880288038804880588068807880888098810881188128813881488158816881788188819882088218822882388248825882688278828882988308831883288338834883588368837883888398840884188428843884488458846884788488849885088518852885388548855885688578858885988608861886288638864886588668867886888698870887188728873887488758876887788788879888088818882888388848885888688878888888988908891889288938894889588968897889888998900890189028903890489058906890789088909891089118912891389148915891689178918891989208921892289238924892589268927892889298930893189328933893489358936893789388939894089418942894389448945894689478948894989508951895289538954895589568957895889598960896189628963896489658966896789688969897089718972897389748975897689778978897989808981898289838984898589868987898889898990899189928993899489958996899789988999900090019002900390049005900690079008900990109011901290139014901590169017901890199020902190229023902490259026902790289029903090319032903390349035903690379038903990409041904290439044904590469047904890499050905190529053905490559056905790589059906090619062906390649065906690679068906990709071907290739074907590769077907890799080908190829083908490859086908790889089909090919092909390949095909690979098909991009101910291039104910591069107910891099110911191129113911491159116911791189119912091219122912391249125912691279128912991309131913291339134913591369137913891399140914191429143914491459146914791489149915091519152915391549155915691579158915991609161916291639164916591669167916891699170917191729173917491759176917791789179918091819182918391849185918691879188918991909191919291939194919591969197919891999200920192029203920492059206920792089209921092119212921392149215921692179218921992209221922292239224922592269227922892299230923192329233923492359236923792389239924092419242924392449245924692479248924992509251925292539254925592569257925892599260926192629263926492659266926792689269927092719272927392749275927692779278927992809281928292839284928592869287928892899290929192929293929492959296929792989299930093019302930393049305930693079308930993109311931293139314931593169317931893199320932193229323932493259326932793289329933093319332933393349335933693379338933993409341934293439344934593469347934893499350935193529353935493559356935793589359936093619362936393649365936693679368936993709371937293739374937593769377937893799380938193829383938493859386938793889389939093919392939393949395939693979398939994009401940294039404940594069407940894099410941194129413941494159416941794189419942094219422942394249425
  1. # Copyright Materialize, Inc. and contributors. All rights reserved.
  2. #
  3. # Use of this software is governed by the Business Source License
  4. # included in the LICENSE file at the root of this repository.
  5. #
  6. # As of the Change Date specified in that file, in accordance with
  7. # the Business Source License, use of this software will be governed
  8. # by the Apache License, Version 2.0.
  9. # Test requires stable object IDs
  10. reset-server
  11. statement ok
  12. CREATE TABLE t (
  13. a int,
  14. b int
  15. )
  16. statement ok
  17. CREATE TABLE u (
  18. c int,
  19. d int
  20. )
  21. statement ok
  22. CREATE TABLE v (
  23. e int,
  24. f int
  25. )
  26. statement ok
  27. CREATE INDEX t_a_idx ON T(a);
  28. statement ok
  29. CREATE INDEX t_b_idx ON T(b);
  30. statement ok
  31. CREATE VIEW ov AS SELECT * FROM t ORDER BY b asc, a desc LIMIT 5
  32. statement ok
  33. CREATE MATERIALIZED VIEW mv AS
  34. SELECT * FROM t WHERE a IS NOT NULL
  35. statement ok
  36. CREATE VIEW hierarchical_group_by AS
  37. SELECT
  38. a,
  39. MIN(b),
  40. MAX(DISTINCT b)
  41. FROM t
  42. GROUP BY a
  43. statement ok
  44. CREATE MATERIALIZED VIEW hierarchical_group_by_mv AS
  45. SELECT * FROM hierarchical_group_by
  46. statement ok
  47. CREATE VIEW hierarchical_global AS
  48. SELECT
  49. MIN(b),
  50. MAX(DISTINCT b)
  51. FROM t
  52. statement ok
  53. CREATE MATERIALIZED VIEW hierarchical_global_mv AS
  54. SELECT * FROM hierarchical_global
  55. statement ok
  56. CREATE VIEW collated_group_by AS
  57. SELECT
  58. a,
  59. COUNT(DISTINCT b),
  60. STRING_AGG(b::text || '1', ',') AS b1,
  61. MIN(b),
  62. MAX(DISTINCT b),
  63. SUM(b),
  64. STRING_AGG(b::text || '2', ',') AS b2
  65. FROM t
  66. GROUP BY a
  67. statement ok
  68. CREATE MATERIALIZED VIEW collated_group_by_mv AS
  69. SELECT * FROM collated_group_by
  70. statement ok
  71. CREATE VIEW collated_global AS
  72. SELECT
  73. COUNT(DISTINCT b),
  74. STRING_AGG(b::text || '1', ',') AS b1,
  75. MIN(b),
  76. MAX(DISTINCT b),
  77. SUM(b),
  78. STRING_AGG(b::text || '2', ',') AS b2
  79. FROM t
  80. statement ok
  81. CREATE MATERIALIZED VIEW collated_global_mv AS
  82. SELECT * FROM collated_global
  83. mode cockroach
  84. # Test constant error.
  85. query T multiline
  86. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  87. SELECT 1 / 0
  88. ----
  89. {
  90. "plans": [
  91. {
  92. "id": "Explained Query",
  93. "plan": {
  94. "lir_id": 1,
  95. "node": {
  96. "Constant": {
  97. "rows": {
  98. "Err": "DivisionByZero"
  99. }
  100. }
  101. }
  102. }
  103. }
  104. ],
  105. "sources": []
  106. }
  107. EOF
  108. # Test constant with two elements.
  109. query T multiline
  110. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  111. (SELECT 1, 2) UNION ALL (SELECT 1, 2) UNION ALL (SELECT 3, 4)
  112. ----
  113. {
  114. "plans": [
  115. {
  116. "id": "Explained Query",
  117. "plan": {
  118. "lir_id": 1,
  119. "node": {
  120. "Constant": {
  121. "rows": {
  122. "Ok": [
  123. [
  124. {
  125. "data": [
  126. 45,
  127. 1,
  128. 45,
  129. 2
  130. ]
  131. },
  132. 0,
  133. 2
  134. ],
  135. [
  136. {
  137. "data": [
  138. 45,
  139. 3,
  140. 45,
  141. 4
  142. ]
  143. },
  144. 0,
  145. 1
  146. ]
  147. ]
  148. }
  149. }
  150. }
  151. }
  152. }
  153. ],
  154. "sources": []
  155. }
  156. EOF
  157. # Test basic linear chains.
  158. # PassArrangements plan (identity transform on an arranged input).
  159. query T multiline
  160. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  161. SELECT * FROM t
  162. ----
  163. {
  164. "plans": [
  165. {
  166. "id": "Explained Query",
  167. "plan": {
  168. "lir_id": 1,
  169. "node": {
  170. "Get": {
  171. "id": {
  172. "Global": {
  173. "User": 1
  174. }
  175. },
  176. "keys": {
  177. "raw": false,
  178. "arranged": [
  179. [
  180. [
  181. {
  182. "Column": [
  183. 0,
  184. "a"
  185. ]
  186. }
  187. ],
  188. [
  189. 0,
  190. 1
  191. ],
  192. [
  193. 1
  194. ]
  195. ]
  196. ],
  197. "types": [
  198. {
  199. "scalar_type": "Int32",
  200. "nullable": true
  201. },
  202. {
  203. "scalar_type": "Int32",
  204. "nullable": true
  205. }
  206. ]
  207. },
  208. "plan": "PassArrangements"
  209. }
  210. }
  211. }
  212. }
  213. ],
  214. "sources": []
  215. }
  216. EOF
  217. # PassArrangements plan (identity transform on a raw input).
  218. query T multiline
  219. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  220. SELECT * FROM u
  221. ----
  222. {
  223. "plans": [
  224. {
  225. "id": "Explained Query",
  226. "plan": {
  227. "lir_id": 1,
  228. "node": {
  229. "Get": {
  230. "id": {
  231. "Global": {
  232. "User": 2
  233. }
  234. },
  235. "keys": {
  236. "raw": true,
  237. "arranged": [],
  238. "types": null
  239. },
  240. "plan": "PassArrangements"
  241. }
  242. }
  243. }
  244. }
  245. ],
  246. "sources": [
  247. {
  248. "id": {
  249. "User": 2
  250. },
  251. "op": null
  252. }
  253. ]
  254. }
  255. EOF
  256. # GetArrangement plan (linear transform of an arranged input).
  257. query T multiline
  258. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  259. SELECT a + b, 1 FROM t
  260. ----
  261. {
  262. "plans": [
  263. {
  264. "id": "Explained Query",
  265. "plan": {
  266. "lir_id": 1,
  267. "node": {
  268. "Get": {
  269. "id": {
  270. "Global": {
  271. "User": 1
  272. }
  273. },
  274. "keys": {
  275. "raw": false,
  276. "arranged": [
  277. [
  278. [
  279. {
  280. "Column": [
  281. 0,
  282. "a"
  283. ]
  284. }
  285. ],
  286. [
  287. 0,
  288. 1
  289. ],
  290. [
  291. 1
  292. ]
  293. ]
  294. ],
  295. "types": [
  296. {
  297. "scalar_type": "Int32",
  298. "nullable": true
  299. },
  300. {
  301. "scalar_type": "Int32",
  302. "nullable": true
  303. }
  304. ]
  305. },
  306. "plan": {
  307. "Arrangement": [
  308. [
  309. {
  310. "Column": [
  311. 0,
  312. "a"
  313. ]
  314. }
  315. ],
  316. null,
  317. {
  318. "expressions": [
  319. {
  320. "CallBinary": {
  321. "func": "AddInt32",
  322. "expr1": {
  323. "Column": [
  324. 0,
  325. "a"
  326. ]
  327. },
  328. "expr2": {
  329. "Column": [
  330. 1,
  331. "b"
  332. ]
  333. }
  334. }
  335. },
  336. {
  337. "Literal": [
  338. {
  339. "Ok": {
  340. "data": [
  341. 45,
  342. 1
  343. ]
  344. }
  345. },
  346. {
  347. "scalar_type": "Int32",
  348. "nullable": false
  349. }
  350. ]
  351. }
  352. ],
  353. "predicates": [],
  354. "projection": [
  355. 2,
  356. 3
  357. ],
  358. "input_arity": 2
  359. }
  360. ]
  361. }
  362. }
  363. }
  364. }
  365. }
  366. ],
  367. "sources": []
  368. }
  369. EOF
  370. # GetCollection plan (linear transform of a raw input).
  371. query T multiline
  372. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  373. SELECT c + d, 1 FROM u
  374. ----
  375. {
  376. "plans": [
  377. {
  378. "id": "Explained Query",
  379. "plan": {
  380. "lir_id": 1,
  381. "node": {
  382. "Get": {
  383. "id": {
  384. "Global": {
  385. "User": 2
  386. }
  387. },
  388. "keys": {
  389. "raw": true,
  390. "arranged": [],
  391. "types": null
  392. },
  393. "plan": {
  394. "Collection": {
  395. "expressions": [],
  396. "predicates": [],
  397. "projection": [
  398. 0,
  399. 1
  400. ],
  401. "input_arity": 2
  402. }
  403. }
  404. }
  405. }
  406. }
  407. }
  408. ],
  409. "sources": [
  410. {
  411. "id": {
  412. "User": 2
  413. },
  414. "op": {
  415. "expressions": [
  416. {
  417. "CallBinary": {
  418. "func": "AddInt32",
  419. "expr1": {
  420. "Column": [
  421. 0,
  422. "c"
  423. ]
  424. },
  425. "expr2": {
  426. "Column": [
  427. 1,
  428. "d"
  429. ]
  430. }
  431. }
  432. },
  433. {
  434. "Literal": [
  435. {
  436. "Ok": {
  437. "data": [
  438. 45,
  439. 1
  440. ]
  441. }
  442. },
  443. {
  444. "scalar_type": "Int32",
  445. "nullable": false
  446. }
  447. ]
  448. }
  449. ],
  450. "predicates": [],
  451. "projection": [
  452. 2,
  453. 3
  454. ],
  455. "input_arity": 2
  456. }
  457. }
  458. ]
  459. }
  460. EOF
  461. # MonotonicTopK plan (one-shot).
  462. query T multiline
  463. EXPLAIN PHYSICAL PLAN WITH(no fast path) AS JSON FOR
  464. SELECT * FROM ov
  465. ----
  466. {
  467. "plans": [
  468. {
  469. "id": "Explained Query",
  470. "plan": {
  471. "lir_id": 3,
  472. "node": {
  473. "TopK": {
  474. "input": {
  475. "lir_id": 2,
  476. "node": {
  477. "ArrangeBy": {
  478. "input": {
  479. "lir_id": 1,
  480. "node": {
  481. "Get": {
  482. "id": {
  483. "Global": {
  484. "User": 1
  485. }
  486. },
  487. "keys": {
  488. "raw": false,
  489. "arranged": [
  490. [
  491. [
  492. {
  493. "Column": [
  494. 0,
  495. "a"
  496. ]
  497. }
  498. ],
  499. [
  500. 0,
  501. 1
  502. ],
  503. [
  504. 1
  505. ]
  506. ]
  507. ],
  508. "types": [
  509. {
  510. "scalar_type": "Int32",
  511. "nullable": true
  512. },
  513. {
  514. "scalar_type": "Int32",
  515. "nullable": true
  516. }
  517. ]
  518. },
  519. "plan": "PassArrangements"
  520. }
  521. }
  522. },
  523. "forms": {
  524. "raw": true,
  525. "arranged": [],
  526. "types": null
  527. },
  528. "input_key": [
  529. {
  530. "Column": [
  531. 0,
  532. "a"
  533. ]
  534. }
  535. ],
  536. "input_mfp": {
  537. "expressions": [],
  538. "predicates": [],
  539. "projection": [
  540. 0,
  541. 1
  542. ],
  543. "input_arity": 2
  544. }
  545. }
  546. }
  547. },
  548. "top_k_plan": {
  549. "MonotonicTopK": {
  550. "group_key": [],
  551. "order_key": [
  552. {
  553. "column": 1,
  554. "desc": false,
  555. "nulls_last": true
  556. },
  557. {
  558. "column": 0,
  559. "desc": true,
  560. "nulls_last": false
  561. }
  562. ],
  563. "limit": {
  564. "Literal": [
  565. {
  566. "Ok": {
  567. "data": [
  568. 50,
  569. 5
  570. ]
  571. }
  572. },
  573. {
  574. "scalar_type": "Int64",
  575. "nullable": false
  576. }
  577. ]
  578. },
  579. "arity": 2,
  580. "must_consolidate": true
  581. }
  582. }
  583. }
  584. }
  585. }
  586. }
  587. ],
  588. "sources": []
  589. }
  590. EOF
  591. # Test Threshold, Union, Distinct, Negate.
  592. query T multiline
  593. EXPLAIN PHYSICAL PLAN AS JSON FOR
  594. SELECT a FROM t EXCEPT ALL SELECT b FROM mv
  595. ----
  596. {
  597. "plans": [
  598. {
  599. "id": "Explained Query",
  600. "plan": {
  601. "lir_id": 6,
  602. "node": {
  603. "Threshold": {
  604. "input": {
  605. "lir_id": 5,
  606. "node": {
  607. "ArrangeBy": {
  608. "input": {
  609. "lir_id": 4,
  610. "node": {
  611. "Union": {
  612. "inputs": [
  613. {
  614. "lir_id": 1,
  615. "node": {
  616. "Get": {
  617. "id": {
  618. "Global": {
  619. "User": 1
  620. }
  621. },
  622. "keys": {
  623. "raw": false,
  624. "arranged": [
  625. [
  626. [
  627. {
  628. "Column": [
  629. 0,
  630. "a"
  631. ]
  632. }
  633. ],
  634. [
  635. 0,
  636. 1
  637. ],
  638. [
  639. 1
  640. ]
  641. ]
  642. ],
  643. "types": [
  644. {
  645. "scalar_type": "Int32",
  646. "nullable": true
  647. },
  648. {
  649. "scalar_type": "Int32",
  650. "nullable": true
  651. }
  652. ]
  653. },
  654. "plan": {
  655. "Arrangement": [
  656. [
  657. {
  658. "Column": [
  659. 0,
  660. "a"
  661. ]
  662. }
  663. ],
  664. null,
  665. {
  666. "expressions": [],
  667. "predicates": [],
  668. "projection": [
  669. 0
  670. ],
  671. "input_arity": 2
  672. }
  673. ]
  674. }
  675. }
  676. }
  677. },
  678. {
  679. "lir_id": 3,
  680. "node": {
  681. "Negate": {
  682. "input": {
  683. "lir_id": 2,
  684. "node": {
  685. "Get": {
  686. "id": {
  687. "Global": {
  688. "User": 7
  689. }
  690. },
  691. "keys": {
  692. "raw": true,
  693. "arranged": [],
  694. "types": null
  695. },
  696. "plan": {
  697. "Collection": {
  698. "expressions": [],
  699. "predicates": [],
  700. "projection": [
  701. 0
  702. ],
  703. "input_arity": 1
  704. }
  705. }
  706. }
  707. }
  708. }
  709. }
  710. }
  711. }
  712. ],
  713. "consolidate_output": true
  714. }
  715. }
  716. },
  717. "forms": {
  718. "raw": false,
  719. "arranged": [
  720. [
  721. [
  722. {
  723. "Column": [
  724. 0,
  725. null
  726. ]
  727. }
  728. ],
  729. [
  730. 0
  731. ],
  732. []
  733. ]
  734. ],
  735. "types": [
  736. {
  737. "scalar_type": "Int32",
  738. "nullable": true
  739. }
  740. ]
  741. },
  742. "input_key": null,
  743. "input_mfp": {
  744. "expressions": [],
  745. "predicates": [],
  746. "projection": [
  747. 0
  748. ],
  749. "input_arity": 1
  750. }
  751. }
  752. }
  753. },
  754. "threshold_plan": {
  755. "Basic": {
  756. "ensure_arrangement": [
  757. [
  758. {
  759. "Column": [
  760. 0,
  761. null
  762. ]
  763. }
  764. ],
  765. [
  766. 0
  767. ],
  768. []
  769. ]
  770. }
  771. }
  772. }
  773. }
  774. }
  775. }
  776. ],
  777. "sources": [
  778. {
  779. "id": {
  780. "User": 7
  781. },
  782. "op": {
  783. "expressions": [],
  784. "predicates": [],
  785. "projection": [
  786. 1
  787. ],
  788. "input_arity": 2
  789. }
  790. }
  791. ]
  792. }
  793. EOF
  794. query T multiline
  795. EXPLAIN PHYSICAL PLAN WITH (TYPES) AS JSON FOR
  796. SELECT * FROM ov
  797. ----
  798. {
  799. "plans": [
  800. {
  801. "id": "Explained Query",
  802. "plan": {
  803. "lir_id": 3,
  804. "node": {
  805. "TopK": {
  806. "input": {
  807. "lir_id": 2,
  808. "node": {
  809. "ArrangeBy": {
  810. "input": {
  811. "lir_id": 1,
  812. "node": {
  813. "Get": {
  814. "id": {
  815. "Global": {
  816. "User": 1
  817. }
  818. },
  819. "keys": {
  820. "raw": false,
  821. "arranged": [
  822. [
  823. [
  824. {
  825. "Column": [
  826. 0,
  827. "a"
  828. ]
  829. }
  830. ],
  831. [
  832. 0,
  833. 1
  834. ],
  835. [
  836. 1
  837. ]
  838. ]
  839. ],
  840. "types": [
  841. {
  842. "scalar_type": "Int32",
  843. "nullable": true
  844. },
  845. {
  846. "scalar_type": "Int32",
  847. "nullable": true
  848. }
  849. ]
  850. },
  851. "plan": "PassArrangements"
  852. }
  853. }
  854. },
  855. "forms": {
  856. "raw": true,
  857. "arranged": [],
  858. "types": null
  859. },
  860. "input_key": [
  861. {
  862. "Column": [
  863. 0,
  864. "a"
  865. ]
  866. }
  867. ],
  868. "input_mfp": {
  869. "expressions": [],
  870. "predicates": [],
  871. "projection": [
  872. 0,
  873. 1
  874. ],
  875. "input_arity": 2
  876. }
  877. }
  878. }
  879. },
  880. "top_k_plan": {
  881. "MonotonicTopK": {
  882. "group_key": [],
  883. "order_key": [
  884. {
  885. "column": 1,
  886. "desc": false,
  887. "nulls_last": true
  888. },
  889. {
  890. "column": 0,
  891. "desc": true,
  892. "nulls_last": false
  893. }
  894. ],
  895. "limit": {
  896. "Literal": [
  897. {
  898. "Ok": {
  899. "data": [
  900. 50,
  901. 5
  902. ]
  903. }
  904. },
  905. {
  906. "scalar_type": "Int64",
  907. "nullable": false
  908. }
  909. ]
  910. },
  911. "arity": 2,
  912. "must_consolidate": true
  913. }
  914. }
  915. }
  916. }
  917. }
  918. }
  919. ],
  920. "sources": []
  921. }
  922. EOF
  923. # Test CTEs.
  924. query T multiline
  925. EXPLAIN PHYSICAL PLAN AS JSON FOR
  926. WITH cte(x) as (SELECT a FROM t EXCEPT ALL SELECT b FROM mv)
  927. (SELECT x + 1 FROM cte UNION ALL SELECT x - 1 FROM cte)
  928. ----
  929. {
  930. "plans": [
  931. {
  932. "id": "Explained Query",
  933. "plan": {
  934. "lir_id": 10,
  935. "node": {
  936. "Let": {
  937. "id": 0,
  938. "value": {
  939. "lir_id": 6,
  940. "node": {
  941. "Threshold": {
  942. "input": {
  943. "lir_id": 5,
  944. "node": {
  945. "ArrangeBy": {
  946. "input": {
  947. "lir_id": 4,
  948. "node": {
  949. "Union": {
  950. "inputs": [
  951. {
  952. "lir_id": 1,
  953. "node": {
  954. "Get": {
  955. "id": {
  956. "Global": {
  957. "User": 1
  958. }
  959. },
  960. "keys": {
  961. "raw": false,
  962. "arranged": [
  963. [
  964. [
  965. {
  966. "Column": [
  967. 0,
  968. "a"
  969. ]
  970. }
  971. ],
  972. [
  973. 0,
  974. 1
  975. ],
  976. [
  977. 1
  978. ]
  979. ]
  980. ],
  981. "types": [
  982. {
  983. "scalar_type": "Int32",
  984. "nullable": true
  985. },
  986. {
  987. "scalar_type": "Int32",
  988. "nullable": true
  989. }
  990. ]
  991. },
  992. "plan": {
  993. "Arrangement": [
  994. [
  995. {
  996. "Column": [
  997. 0,
  998. "a"
  999. ]
  1000. }
  1001. ],
  1002. null,
  1003. {
  1004. "expressions": [],
  1005. "predicates": [],
  1006. "projection": [
  1007. 0
  1008. ],
  1009. "input_arity": 2
  1010. }
  1011. ]
  1012. }
  1013. }
  1014. }
  1015. },
  1016. {
  1017. "lir_id": 3,
  1018. "node": {
  1019. "Negate": {
  1020. "input": {
  1021. "lir_id": 2,
  1022. "node": {
  1023. "Get": {
  1024. "id": {
  1025. "Global": {
  1026. "User": 7
  1027. }
  1028. },
  1029. "keys": {
  1030. "raw": true,
  1031. "arranged": [],
  1032. "types": null
  1033. },
  1034. "plan": {
  1035. "Collection": {
  1036. "expressions": [],
  1037. "predicates": [],
  1038. "projection": [
  1039. 0
  1040. ],
  1041. "input_arity": 1
  1042. }
  1043. }
  1044. }
  1045. }
  1046. }
  1047. }
  1048. }
  1049. }
  1050. ],
  1051. "consolidate_output": true
  1052. }
  1053. }
  1054. },
  1055. "forms": {
  1056. "raw": false,
  1057. "arranged": [
  1058. [
  1059. [
  1060. {
  1061. "Column": [
  1062. 0,
  1063. null
  1064. ]
  1065. }
  1066. ],
  1067. [
  1068. 0
  1069. ],
  1070. []
  1071. ]
  1072. ],
  1073. "types": [
  1074. {
  1075. "scalar_type": "Int32",
  1076. "nullable": true
  1077. }
  1078. ]
  1079. },
  1080. "input_key": null,
  1081. "input_mfp": {
  1082. "expressions": [],
  1083. "predicates": [],
  1084. "projection": [
  1085. 0
  1086. ],
  1087. "input_arity": 1
  1088. }
  1089. }
  1090. }
  1091. },
  1092. "threshold_plan": {
  1093. "Basic": {
  1094. "ensure_arrangement": [
  1095. [
  1096. {
  1097. "Column": [
  1098. 0,
  1099. null
  1100. ]
  1101. }
  1102. ],
  1103. [
  1104. 0
  1105. ],
  1106. []
  1107. ]
  1108. }
  1109. }
  1110. }
  1111. }
  1112. },
  1113. "body": {
  1114. "lir_id": 9,
  1115. "node": {
  1116. "Union": {
  1117. "inputs": [
  1118. {
  1119. "lir_id": 7,
  1120. "node": {
  1121. "Get": {
  1122. "id": {
  1123. "Local": 0
  1124. },
  1125. "keys": {
  1126. "raw": false,
  1127. "arranged": [
  1128. [
  1129. [
  1130. {
  1131. "Column": [
  1132. 0,
  1133. null
  1134. ]
  1135. }
  1136. ],
  1137. [
  1138. 0
  1139. ],
  1140. []
  1141. ]
  1142. ],
  1143. "types": [
  1144. {
  1145. "scalar_type": "Int32",
  1146. "nullable": true
  1147. }
  1148. ]
  1149. },
  1150. "plan": {
  1151. "Arrangement": [
  1152. [
  1153. {
  1154. "Column": [
  1155. 0,
  1156. null
  1157. ]
  1158. }
  1159. ],
  1160. null,
  1161. {
  1162. "expressions": [
  1163. {
  1164. "CallBinary": {
  1165. "func": "AddInt32",
  1166. "expr1": {
  1167. "Column": [
  1168. 0,
  1169. "x"
  1170. ]
  1171. },
  1172. "expr2": {
  1173. "Literal": [
  1174. {
  1175. "Ok": {
  1176. "data": [
  1177. 45,
  1178. 1
  1179. ]
  1180. }
  1181. },
  1182. {
  1183. "scalar_type": "Int32",
  1184. "nullable": false
  1185. }
  1186. ]
  1187. }
  1188. }
  1189. }
  1190. ],
  1191. "predicates": [],
  1192. "projection": [
  1193. 1
  1194. ],
  1195. "input_arity": 1
  1196. }
  1197. ]
  1198. }
  1199. }
  1200. }
  1201. },
  1202. {
  1203. "lir_id": 8,
  1204. "node": {
  1205. "Get": {
  1206. "id": {
  1207. "Local": 0
  1208. },
  1209. "keys": {
  1210. "raw": false,
  1211. "arranged": [
  1212. [
  1213. [
  1214. {
  1215. "Column": [
  1216. 0,
  1217. null
  1218. ]
  1219. }
  1220. ],
  1221. [
  1222. 0
  1223. ],
  1224. []
  1225. ]
  1226. ],
  1227. "types": [
  1228. {
  1229. "scalar_type": "Int32",
  1230. "nullable": true
  1231. }
  1232. ]
  1233. },
  1234. "plan": {
  1235. "Arrangement": [
  1236. [
  1237. {
  1238. "Column": [
  1239. 0,
  1240. null
  1241. ]
  1242. }
  1243. ],
  1244. null,
  1245. {
  1246. "expressions": [
  1247. {
  1248. "CallBinary": {
  1249. "func": "SubInt32",
  1250. "expr1": {
  1251. "Column": [
  1252. 0,
  1253. "x"
  1254. ]
  1255. },
  1256. "expr2": {
  1257. "Literal": [
  1258. {
  1259. "Ok": {
  1260. "data": [
  1261. 45,
  1262. 1
  1263. ]
  1264. }
  1265. },
  1266. {
  1267. "scalar_type": "Int32",
  1268. "nullable": false
  1269. }
  1270. ]
  1271. }
  1272. }
  1273. }
  1274. ],
  1275. "predicates": [],
  1276. "projection": [
  1277. 1
  1278. ],
  1279. "input_arity": 1
  1280. }
  1281. ]
  1282. }
  1283. }
  1284. }
  1285. }
  1286. ],
  1287. "consolidate_output": false
  1288. }
  1289. }
  1290. }
  1291. }
  1292. }
  1293. }
  1294. }
  1295. ],
  1296. "sources": [
  1297. {
  1298. "id": {
  1299. "User": 7
  1300. },
  1301. "op": {
  1302. "expressions": [],
  1303. "predicates": [],
  1304. "projection": [
  1305. 1
  1306. ],
  1307. "input_arity": 2
  1308. }
  1309. }
  1310. ]
  1311. }
  1312. EOF
  1313. # Test Mfp.
  1314. query T multiline
  1315. EXPLAIN PHYSICAL PLAN AS JSON FOR
  1316. WITH cte(x) as (SELECT a FROM t EXCEPT ALL SELECT b FROM mv)
  1317. SELECT x * 5 FROM cte WHERE x = 5
  1318. ----
  1319. {
  1320. "plans": [
  1321. {
  1322. "id": "Explained Query",
  1323. "plan": {
  1324. "lir_id": 10,
  1325. "node": {
  1326. "Mfp": {
  1327. "input": {
  1328. "lir_id": 9,
  1329. "node": {
  1330. "Threshold": {
  1331. "input": {
  1332. "lir_id": 8,
  1333. "node": {
  1334. "ArrangeBy": {
  1335. "input": {
  1336. "lir_id": 7,
  1337. "node": {
  1338. "Union": {
  1339. "inputs": [
  1340. {
  1341. "lir_id": 4,
  1342. "node": {
  1343. "Join": {
  1344. "inputs": [
  1345. {
  1346. "lir_id": 1,
  1347. "node": {
  1348. "Get": {
  1349. "id": {
  1350. "Global": {
  1351. "User": 1
  1352. }
  1353. },
  1354. "keys": {
  1355. "raw": false,
  1356. "arranged": [
  1357. [
  1358. [
  1359. {
  1360. "Column": [
  1361. 0,
  1362. "a"
  1363. ]
  1364. }
  1365. ],
  1366. [
  1367. 0,
  1368. 1
  1369. ],
  1370. [
  1371. 1
  1372. ]
  1373. ]
  1374. ],
  1375. "types": [
  1376. {
  1377. "scalar_type": "Int32",
  1378. "nullable": true
  1379. },
  1380. {
  1381. "scalar_type": "Int32",
  1382. "nullable": true
  1383. }
  1384. ]
  1385. },
  1386. "plan": "PassArrangements"
  1387. }
  1388. }
  1389. },
  1390. {
  1391. "lir_id": 3,
  1392. "node": {
  1393. "ArrangeBy": {
  1394. "input": {
  1395. "lir_id": 2,
  1396. "node": {
  1397. "Constant": {
  1398. "rows": {
  1399. "Ok": [
  1400. [
  1401. {
  1402. "data": [
  1403. 45,
  1404. 5
  1405. ]
  1406. },
  1407. 0,
  1408. 1
  1409. ]
  1410. ]
  1411. }
  1412. }
  1413. }
  1414. },
  1415. "forms": {
  1416. "raw": true,
  1417. "arranged": [
  1418. [
  1419. [
  1420. {
  1421. "Column": [
  1422. 0,
  1423. null
  1424. ]
  1425. }
  1426. ],
  1427. [
  1428. 0
  1429. ],
  1430. []
  1431. ]
  1432. ],
  1433. "types": [
  1434. {
  1435. "scalar_type": "Int32",
  1436. "nullable": false
  1437. }
  1438. ]
  1439. },
  1440. "input_key": null,
  1441. "input_mfp": {
  1442. "expressions": [],
  1443. "predicates": [],
  1444. "projection": [
  1445. 0
  1446. ],
  1447. "input_arity": 1
  1448. }
  1449. }
  1450. }
  1451. }
  1452. ],
  1453. "plan": {
  1454. "Linear": {
  1455. "source_relation": 1,
  1456. "source_key": [
  1457. {
  1458. "Column": [
  1459. 0,
  1460. null
  1461. ]
  1462. }
  1463. ],
  1464. "initial_closure": null,
  1465. "stage_plans": [
  1466. {
  1467. "lookup_relation": 0,
  1468. "stream_key": [
  1469. {
  1470. "Column": [
  1471. 0,
  1472. null
  1473. ]
  1474. }
  1475. ],
  1476. "stream_thinning": [],
  1477. "lookup_key": [
  1478. {
  1479. "Column": [
  1480. 0,
  1481. "a"
  1482. ]
  1483. }
  1484. ],
  1485. "closure": {
  1486. "ready_equivalences": [],
  1487. "before": {
  1488. "mfp": {
  1489. "expressions": [],
  1490. "predicates": [],
  1491. "projection": [
  1492. 0
  1493. ],
  1494. "input_arity": 2
  1495. }
  1496. }
  1497. }
  1498. }
  1499. ],
  1500. "final_closure": null
  1501. }
  1502. }
  1503. }
  1504. }
  1505. },
  1506. {
  1507. "lir_id": 6,
  1508. "node": {
  1509. "Negate": {
  1510. "input": {
  1511. "lir_id": 5,
  1512. "node": {
  1513. "Get": {
  1514. "id": {
  1515. "Global": {
  1516. "User": 7
  1517. }
  1518. },
  1519. "keys": {
  1520. "raw": true,
  1521. "arranged": [],
  1522. "types": null
  1523. },
  1524. "plan": {
  1525. "Collection": {
  1526. "expressions": [],
  1527. "predicates": [],
  1528. "projection": [
  1529. 0
  1530. ],
  1531. "input_arity": 1
  1532. }
  1533. }
  1534. }
  1535. }
  1536. }
  1537. }
  1538. }
  1539. }
  1540. ],
  1541. "consolidate_output": true
  1542. }
  1543. }
  1544. },
  1545. "forms": {
  1546. "raw": false,
  1547. "arranged": [
  1548. [
  1549. [
  1550. {
  1551. "Column": [
  1552. 0,
  1553. null
  1554. ]
  1555. }
  1556. ],
  1557. [
  1558. 0
  1559. ],
  1560. []
  1561. ]
  1562. ],
  1563. "types": [
  1564. {
  1565. "scalar_type": "Int32",
  1566. "nullable": false
  1567. }
  1568. ]
  1569. },
  1570. "input_key": null,
  1571. "input_mfp": {
  1572. "expressions": [],
  1573. "predicates": [],
  1574. "projection": [
  1575. 0
  1576. ],
  1577. "input_arity": 1
  1578. }
  1579. }
  1580. }
  1581. },
  1582. "threshold_plan": {
  1583. "Basic": {
  1584. "ensure_arrangement": [
  1585. [
  1586. {
  1587. "Column": [
  1588. 0,
  1589. null
  1590. ]
  1591. }
  1592. ],
  1593. [
  1594. 0
  1595. ],
  1596. []
  1597. ]
  1598. }
  1599. }
  1600. }
  1601. }
  1602. },
  1603. "mfp": {
  1604. "expressions": [
  1605. {
  1606. "Literal": [
  1607. {
  1608. "Ok": {
  1609. "data": [
  1610. 45,
  1611. 25
  1612. ]
  1613. }
  1614. },
  1615. {
  1616. "scalar_type": "Int32",
  1617. "nullable": false
  1618. }
  1619. ]
  1620. }
  1621. ],
  1622. "predicates": [],
  1623. "projection": [
  1624. 1
  1625. ],
  1626. "input_arity": 1
  1627. },
  1628. "input_key_val": [
  1629. [
  1630. {
  1631. "Column": [
  1632. 0,
  1633. null
  1634. ]
  1635. }
  1636. ],
  1637. null
  1638. ]
  1639. }
  1640. }
  1641. }
  1642. }
  1643. ],
  1644. "sources": [
  1645. {
  1646. "id": {
  1647. "User": 7
  1648. },
  1649. "op": {
  1650. "expressions": [],
  1651. "predicates": [
  1652. [
  1653. 2,
  1654. {
  1655. "CallBinary": {
  1656. "func": "Eq",
  1657. "expr1": {
  1658. "Column": [
  1659. 1,
  1660. "x"
  1661. ]
  1662. },
  1663. "expr2": {
  1664. "Literal": [
  1665. {
  1666. "Ok": {
  1667. "data": [
  1668. 45,
  1669. 5
  1670. ]
  1671. }
  1672. },
  1673. {
  1674. "scalar_type": "Int32",
  1675. "nullable": false
  1676. }
  1677. ]
  1678. }
  1679. }
  1680. }
  1681. ]
  1682. ],
  1683. "projection": [
  1684. 1
  1685. ],
  1686. "input_arity": 2
  1687. }
  1688. }
  1689. ]
  1690. }
  1691. EOF
  1692. # Test FlatMap.
  1693. query T multiline
  1694. EXPLAIN PHYSICAL PLAN AS JSON FOR
  1695. SELECT generate_series(a, b) from t
  1696. ----
  1697. {
  1698. "plans": [
  1699. {
  1700. "id": "Explained Query",
  1701. "plan": {
  1702. "lir_id": 2,
  1703. "node": {
  1704. "FlatMap": {
  1705. "input": {
  1706. "lir_id": 1,
  1707. "node": {
  1708. "Get": {
  1709. "id": {
  1710. "Global": {
  1711. "User": 1
  1712. }
  1713. },
  1714. "keys": {
  1715. "raw": false,
  1716. "arranged": [
  1717. [
  1718. [
  1719. {
  1720. "Column": [
  1721. 0,
  1722. "a"
  1723. ]
  1724. }
  1725. ],
  1726. [
  1727. 0,
  1728. 1
  1729. ],
  1730. [
  1731. 1
  1732. ]
  1733. ]
  1734. ],
  1735. "types": [
  1736. {
  1737. "scalar_type": "Int32",
  1738. "nullable": true
  1739. },
  1740. {
  1741. "scalar_type": "Int32",
  1742. "nullable": true
  1743. }
  1744. ]
  1745. },
  1746. "plan": "PassArrangements"
  1747. }
  1748. }
  1749. },
  1750. "func": "GenerateSeriesInt32",
  1751. "exprs": [
  1752. {
  1753. "Column": [
  1754. 0,
  1755. "a"
  1756. ]
  1757. },
  1758. {
  1759. "Column": [
  1760. 1,
  1761. "b"
  1762. ]
  1763. },
  1764. {
  1765. "Literal": [
  1766. {
  1767. "Ok": {
  1768. "data": [
  1769. 45,
  1770. 1
  1771. ]
  1772. }
  1773. },
  1774. {
  1775. "scalar_type": "Int32",
  1776. "nullable": false
  1777. }
  1778. ]
  1779. }
  1780. ],
  1781. "mfp_after": {
  1782. "expressions": [],
  1783. "predicates": [],
  1784. "projection": [
  1785. 2
  1786. ],
  1787. "input_arity": 3
  1788. },
  1789. "input_key": [
  1790. {
  1791. "Column": [
  1792. 0,
  1793. "a"
  1794. ]
  1795. }
  1796. ]
  1797. }
  1798. }
  1799. }
  1800. }
  1801. ],
  1802. "sources": []
  1803. }
  1804. EOF
  1805. # Test Reduce::Distinct.
  1806. query T multiline
  1807. EXPLAIN PHYSICAL PLAN AS JSON FOR
  1808. SELECT DISTINCT a, b FROM t
  1809. ----
  1810. {
  1811. "plans": [
  1812. {
  1813. "id": "Explained Query",
  1814. "plan": {
  1815. "lir_id": 2,
  1816. "node": {
  1817. "Reduce": {
  1818. "input": {
  1819. "lir_id": 1,
  1820. "node": {
  1821. "Get": {
  1822. "id": {
  1823. "Global": {
  1824. "User": 1
  1825. }
  1826. },
  1827. "keys": {
  1828. "raw": false,
  1829. "arranged": [
  1830. [
  1831. [
  1832. {
  1833. "Column": [
  1834. 0,
  1835. "a"
  1836. ]
  1837. }
  1838. ],
  1839. [
  1840. 0,
  1841. 1
  1842. ],
  1843. [
  1844. 1
  1845. ]
  1846. ]
  1847. ],
  1848. "types": [
  1849. {
  1850. "scalar_type": "Int32",
  1851. "nullable": true
  1852. },
  1853. {
  1854. "scalar_type": "Int32",
  1855. "nullable": true
  1856. }
  1857. ]
  1858. },
  1859. "plan": "PassArrangements"
  1860. }
  1861. }
  1862. },
  1863. "key_val_plan": {
  1864. "key_plan": {
  1865. "mfp": {
  1866. "expressions": [],
  1867. "predicates": [],
  1868. "projection": [
  1869. 0,
  1870. 1
  1871. ],
  1872. "input_arity": 2
  1873. }
  1874. },
  1875. "val_plan": {
  1876. "mfp": {
  1877. "expressions": [],
  1878. "predicates": [],
  1879. "projection": [],
  1880. "input_arity": 2
  1881. }
  1882. }
  1883. },
  1884. "plan": "Distinct",
  1885. "input_key": [
  1886. {
  1887. "Column": [
  1888. 0,
  1889. "a"
  1890. ]
  1891. }
  1892. ],
  1893. "mfp_after": {
  1894. "expressions": [],
  1895. "predicates": [],
  1896. "projection": [
  1897. 0,
  1898. 1
  1899. ],
  1900. "input_arity": 2
  1901. }
  1902. }
  1903. }
  1904. }
  1905. }
  1906. ],
  1907. "sources": []
  1908. }
  1909. EOF
  1910. # Test Reduce::Accumulable (with GROUP BY).
  1911. query T multiline
  1912. EXPLAIN PHYSICAL PLAN AS JSON FOR
  1913. SELECT
  1914. a,
  1915. SUM(b),
  1916. COUNT(DISTINCT b)
  1917. FROM t
  1918. GROUP BY a
  1919. ----
  1920. {
  1921. "plans": [
  1922. {
  1923. "id": "Explained Query",
  1924. "plan": {
  1925. "lir_id": 2,
  1926. "node": {
  1927. "Reduce": {
  1928. "input": {
  1929. "lir_id": 1,
  1930. "node": {
  1931. "Get": {
  1932. "id": {
  1933. "Global": {
  1934. "User": 1
  1935. }
  1936. },
  1937. "keys": {
  1938. "raw": false,
  1939. "arranged": [
  1940. [
  1941. [
  1942. {
  1943. "Column": [
  1944. 0,
  1945. "a"
  1946. ]
  1947. }
  1948. ],
  1949. [
  1950. 0,
  1951. 1
  1952. ],
  1953. [
  1954. 1
  1955. ]
  1956. ]
  1957. ],
  1958. "types": [
  1959. {
  1960. "scalar_type": "Int32",
  1961. "nullable": true
  1962. },
  1963. {
  1964. "scalar_type": "Int32",
  1965. "nullable": true
  1966. }
  1967. ]
  1968. },
  1969. "plan": "PassArrangements"
  1970. }
  1971. }
  1972. },
  1973. "key_val_plan": {
  1974. "key_plan": {
  1975. "mfp": {
  1976. "expressions": [],
  1977. "predicates": [],
  1978. "projection": [
  1979. 0
  1980. ],
  1981. "input_arity": 2
  1982. }
  1983. },
  1984. "val_plan": {
  1985. "mfp": {
  1986. "expressions": [],
  1987. "predicates": [],
  1988. "projection": [
  1989. 1,
  1990. 1
  1991. ],
  1992. "input_arity": 2
  1993. }
  1994. }
  1995. },
  1996. "plan": {
  1997. "Accumulable": {
  1998. "full_aggrs": [
  1999. {
  2000. "func": "SumInt32",
  2001. "expr": {
  2002. "Column": [
  2003. 1,
  2004. "b"
  2005. ]
  2006. },
  2007. "distinct": false
  2008. },
  2009. {
  2010. "func": "Count",
  2011. "expr": {
  2012. "Column": [
  2013. 1,
  2014. "b"
  2015. ]
  2016. },
  2017. "distinct": true
  2018. }
  2019. ],
  2020. "simple_aggrs": [
  2021. [
  2022. 0,
  2023. 0,
  2024. {
  2025. "func": "SumInt32",
  2026. "expr": {
  2027. "Column": [
  2028. 1,
  2029. "b"
  2030. ]
  2031. },
  2032. "distinct": false
  2033. }
  2034. ]
  2035. ],
  2036. "distinct_aggrs": [
  2037. [
  2038. 1,
  2039. 1,
  2040. {
  2041. "func": "Count",
  2042. "expr": {
  2043. "Column": [
  2044. 1,
  2045. "b"
  2046. ]
  2047. },
  2048. "distinct": true
  2049. }
  2050. ]
  2051. ]
  2052. }
  2053. },
  2054. "input_key": [
  2055. {
  2056. "Column": [
  2057. 0,
  2058. "a"
  2059. ]
  2060. }
  2061. ],
  2062. "mfp_after": {
  2063. "expressions": [],
  2064. "predicates": [],
  2065. "projection": [
  2066. 0,
  2067. 1,
  2068. 2
  2069. ],
  2070. "input_arity": 3
  2071. }
  2072. }
  2073. }
  2074. }
  2075. }
  2076. ],
  2077. "sources": []
  2078. }
  2079. EOF
  2080. # Test Reduce::Accumulable (global aggregate).
  2081. query T multiline
  2082. EXPLAIN PHYSICAL PLAN AS JSON FOR
  2083. SELECT
  2084. SUM(b),
  2085. COUNT(DISTINCT b)
  2086. FROM t
  2087. ----
  2088. {
  2089. "plans": [
  2090. {
  2091. "id": "Explained Query",
  2092. "plan": {
  2093. "lir_id": 11,
  2094. "node": {
  2095. "Let": {
  2096. "id": 0,
  2097. "value": {
  2098. "lir_id": 2,
  2099. "node": {
  2100. "Reduce": {
  2101. "input": {
  2102. "lir_id": 1,
  2103. "node": {
  2104. "Get": {
  2105. "id": {
  2106. "Global": {
  2107. "User": 1
  2108. }
  2109. },
  2110. "keys": {
  2111. "raw": false,
  2112. "arranged": [
  2113. [
  2114. [
  2115. {
  2116. "Column": [
  2117. 0,
  2118. "a"
  2119. ]
  2120. }
  2121. ],
  2122. [
  2123. 0,
  2124. 1
  2125. ],
  2126. [
  2127. 1
  2128. ]
  2129. ]
  2130. ],
  2131. "types": [
  2132. {
  2133. "scalar_type": "Int32",
  2134. "nullable": true
  2135. },
  2136. {
  2137. "scalar_type": "Int32",
  2138. "nullable": true
  2139. }
  2140. ]
  2141. },
  2142. "plan": {
  2143. "Arrangement": [
  2144. [
  2145. {
  2146. "Column": [
  2147. 0,
  2148. "a"
  2149. ]
  2150. }
  2151. ],
  2152. null,
  2153. {
  2154. "expressions": [],
  2155. "predicates": [],
  2156. "projection": [
  2157. 1
  2158. ],
  2159. "input_arity": 2
  2160. }
  2161. ]
  2162. }
  2163. }
  2164. }
  2165. },
  2166. "key_val_plan": {
  2167. "key_plan": {
  2168. "mfp": {
  2169. "expressions": [],
  2170. "predicates": [],
  2171. "projection": [],
  2172. "input_arity": 1
  2173. }
  2174. },
  2175. "val_plan": {
  2176. "mfp": {
  2177. "expressions": [],
  2178. "predicates": [],
  2179. "projection": [
  2180. 0,
  2181. 0
  2182. ],
  2183. "input_arity": 1
  2184. }
  2185. }
  2186. },
  2187. "plan": {
  2188. "Accumulable": {
  2189. "full_aggrs": [
  2190. {
  2191. "func": "SumInt32",
  2192. "expr": {
  2193. "Column": [
  2194. 0,
  2195. "b"
  2196. ]
  2197. },
  2198. "distinct": false
  2199. },
  2200. {
  2201. "func": "Count",
  2202. "expr": {
  2203. "Column": [
  2204. 0,
  2205. "b"
  2206. ]
  2207. },
  2208. "distinct": true
  2209. }
  2210. ],
  2211. "simple_aggrs": [
  2212. [
  2213. 0,
  2214. 0,
  2215. {
  2216. "func": "SumInt32",
  2217. "expr": {
  2218. "Column": [
  2219. 0,
  2220. "b"
  2221. ]
  2222. },
  2223. "distinct": false
  2224. }
  2225. ]
  2226. ],
  2227. "distinct_aggrs": [
  2228. [
  2229. 1,
  2230. 1,
  2231. {
  2232. "func": "Count",
  2233. "expr": {
  2234. "Column": [
  2235. 0,
  2236. "b"
  2237. ]
  2238. },
  2239. "distinct": true
  2240. }
  2241. ]
  2242. ]
  2243. }
  2244. },
  2245. "input_key": null,
  2246. "mfp_after": {
  2247. "expressions": [],
  2248. "predicates": [],
  2249. "projection": [
  2250. 0,
  2251. 1
  2252. ],
  2253. "input_arity": 2
  2254. }
  2255. }
  2256. }
  2257. },
  2258. "body": {
  2259. "lir_id": 10,
  2260. "node": {
  2261. "Union": {
  2262. "inputs": [
  2263. {
  2264. "lir_id": 9,
  2265. "node": {
  2266. "ArrangeBy": {
  2267. "input": {
  2268. "lir_id": 3,
  2269. "node": {
  2270. "Get": {
  2271. "id": {
  2272. "Local": 0
  2273. },
  2274. "keys": {
  2275. "raw": false,
  2276. "arranged": [
  2277. [
  2278. [],
  2279. [
  2280. 0,
  2281. 1
  2282. ],
  2283. [
  2284. 0,
  2285. 1
  2286. ]
  2287. ]
  2288. ],
  2289. "types": null
  2290. },
  2291. "plan": "PassArrangements"
  2292. }
  2293. }
  2294. },
  2295. "forms": {
  2296. "raw": true,
  2297. "arranged": [],
  2298. "types": null
  2299. },
  2300. "input_key": [],
  2301. "input_mfp": {
  2302. "expressions": [],
  2303. "predicates": [],
  2304. "projection": [
  2305. 0,
  2306. 1
  2307. ],
  2308. "input_arity": 2
  2309. }
  2310. }
  2311. }
  2312. },
  2313. {
  2314. "lir_id": 8,
  2315. "node": {
  2316. "Mfp": {
  2317. "input": {
  2318. "lir_id": 7,
  2319. "node": {
  2320. "Union": {
  2321. "inputs": [
  2322. {
  2323. "lir_id": 5,
  2324. "node": {
  2325. "Negate": {
  2326. "input": {
  2327. "lir_id": 4,
  2328. "node": {
  2329. "Get": {
  2330. "id": {
  2331. "Local": 0
  2332. },
  2333. "keys": {
  2334. "raw": false,
  2335. "arranged": [
  2336. [
  2337. [],
  2338. [
  2339. 0,
  2340. 1
  2341. ],
  2342. [
  2343. 0,
  2344. 1
  2345. ]
  2346. ]
  2347. ],
  2348. "types": null
  2349. },
  2350. "plan": {
  2351. "Arrangement": [
  2352. [],
  2353. null,
  2354. {
  2355. "expressions": [],
  2356. "predicates": [],
  2357. "projection": [],
  2358. "input_arity": 2
  2359. }
  2360. ]
  2361. }
  2362. }
  2363. }
  2364. }
  2365. }
  2366. }
  2367. },
  2368. {
  2369. "lir_id": 6,
  2370. "node": {
  2371. "Constant": {
  2372. "rows": {
  2373. "Ok": [
  2374. [
  2375. {
  2376. "data": []
  2377. },
  2378. 0,
  2379. 1
  2380. ]
  2381. ]
  2382. }
  2383. }
  2384. }
  2385. }
  2386. ],
  2387. "consolidate_output": true
  2388. }
  2389. }
  2390. },
  2391. "mfp": {
  2392. "expressions": [
  2393. {
  2394. "Literal": [
  2395. {
  2396. "Ok": {
  2397. "data": [
  2398. 0
  2399. ]
  2400. }
  2401. },
  2402. {
  2403. "scalar_type": "Int64",
  2404. "nullable": true
  2405. }
  2406. ]
  2407. },
  2408. {
  2409. "Literal": [
  2410. {
  2411. "Ok": {
  2412. "data": [
  2413. 49
  2414. ]
  2415. }
  2416. },
  2417. {
  2418. "scalar_type": "Int64",
  2419. "nullable": false
  2420. }
  2421. ]
  2422. }
  2423. ],
  2424. "predicates": [],
  2425. "projection": [
  2426. 0,
  2427. 1
  2428. ],
  2429. "input_arity": 0
  2430. },
  2431. "input_key_val": null
  2432. }
  2433. }
  2434. }
  2435. ],
  2436. "consolidate_output": false
  2437. }
  2438. }
  2439. }
  2440. }
  2441. }
  2442. }
  2443. }
  2444. ],
  2445. "sources": []
  2446. }
  2447. EOF
  2448. # Test Reduce::Hierarchical (with GROUP BY, one-shot).
  2449. query T multiline
  2450. EXPLAIN PHYSICAL PLAN AS JSON FOR
  2451. SELECT * FROM hierarchical_group_by
  2452. ----
  2453. {
  2454. "plans": [
  2455. {
  2456. "id": "Explained Query",
  2457. "plan": {
  2458. "lir_id": 2,
  2459. "node": {
  2460. "Reduce": {
  2461. "input": {
  2462. "lir_id": 1,
  2463. "node": {
  2464. "Get": {
  2465. "id": {
  2466. "Global": {
  2467. "User": 1
  2468. }
  2469. },
  2470. "keys": {
  2471. "raw": false,
  2472. "arranged": [
  2473. [
  2474. [
  2475. {
  2476. "Column": [
  2477. 0,
  2478. "a"
  2479. ]
  2480. }
  2481. ],
  2482. [
  2483. 0,
  2484. 1
  2485. ],
  2486. [
  2487. 1
  2488. ]
  2489. ]
  2490. ],
  2491. "types": [
  2492. {
  2493. "scalar_type": "Int32",
  2494. "nullable": true
  2495. },
  2496. {
  2497. "scalar_type": "Int32",
  2498. "nullable": true
  2499. }
  2500. ]
  2501. },
  2502. "plan": "PassArrangements"
  2503. }
  2504. }
  2505. },
  2506. "key_val_plan": {
  2507. "key_plan": {
  2508. "mfp": {
  2509. "expressions": [],
  2510. "predicates": [],
  2511. "projection": [
  2512. 0
  2513. ],
  2514. "input_arity": 2
  2515. }
  2516. },
  2517. "val_plan": {
  2518. "mfp": {
  2519. "expressions": [],
  2520. "predicates": [],
  2521. "projection": [
  2522. 1,
  2523. 1
  2524. ],
  2525. "input_arity": 2
  2526. }
  2527. }
  2528. },
  2529. "plan": {
  2530. "Hierarchical": {
  2531. "Monotonic": {
  2532. "aggr_funcs": [
  2533. "MinInt32",
  2534. "MaxInt32"
  2535. ],
  2536. "skips": [
  2537. 0,
  2538. 0
  2539. ],
  2540. "must_consolidate": true
  2541. }
  2542. }
  2543. },
  2544. "input_key": [
  2545. {
  2546. "Column": [
  2547. 0,
  2548. "a"
  2549. ]
  2550. }
  2551. ],
  2552. "mfp_after": {
  2553. "expressions": [],
  2554. "predicates": [],
  2555. "projection": [
  2556. 0,
  2557. 1,
  2558. 2
  2559. ],
  2560. "input_arity": 3
  2561. }
  2562. }
  2563. }
  2564. }
  2565. }
  2566. ],
  2567. "sources": []
  2568. }
  2569. EOF
  2570. # Test Reduce::Hierarchical (global aggregate).
  2571. query T multiline
  2572. EXPLAIN PHYSICAL PLAN AS JSON FOR
  2573. MATERIALIZED VIEW hierarchical_global_mv
  2574. ----
  2575. {
  2576. "plans": [
  2577. {
  2578. "id": "materialize.public.hierarchical_global_mv",
  2579. "plan": {
  2580. "lir_id": 11,
  2581. "node": {
  2582. "Let": {
  2583. "id": 0,
  2584. "value": {
  2585. "lir_id": 2,
  2586. "node": {
  2587. "Reduce": {
  2588. "input": {
  2589. "lir_id": 1,
  2590. "node": {
  2591. "Get": {
  2592. "id": {
  2593. "Global": {
  2594. "User": 1
  2595. }
  2596. },
  2597. "keys": {
  2598. "raw": false,
  2599. "arranged": [
  2600. [
  2601. [
  2602. {
  2603. "Column": [
  2604. 0,
  2605. "a"
  2606. ]
  2607. }
  2608. ],
  2609. [
  2610. 0,
  2611. 1
  2612. ],
  2613. [
  2614. 1
  2615. ]
  2616. ]
  2617. ],
  2618. "types": [
  2619. {
  2620. "scalar_type": "Int32",
  2621. "nullable": true
  2622. },
  2623. {
  2624. "scalar_type": "Int32",
  2625. "nullable": true
  2626. }
  2627. ]
  2628. },
  2629. "plan": {
  2630. "Arrangement": [
  2631. [
  2632. {
  2633. "Column": [
  2634. 0,
  2635. "a"
  2636. ]
  2637. }
  2638. ],
  2639. null,
  2640. {
  2641. "expressions": [],
  2642. "predicates": [],
  2643. "projection": [
  2644. 1
  2645. ],
  2646. "input_arity": 2
  2647. }
  2648. ]
  2649. }
  2650. }
  2651. }
  2652. },
  2653. "key_val_plan": {
  2654. "key_plan": {
  2655. "mfp": {
  2656. "expressions": [],
  2657. "predicates": [],
  2658. "projection": [],
  2659. "input_arity": 1
  2660. }
  2661. },
  2662. "val_plan": {
  2663. "mfp": {
  2664. "expressions": [],
  2665. "predicates": [],
  2666. "projection": [
  2667. 0,
  2668. 0
  2669. ],
  2670. "input_arity": 1
  2671. }
  2672. }
  2673. },
  2674. "plan": {
  2675. "Hierarchical": {
  2676. "Bucketed": {
  2677. "aggr_funcs": [
  2678. "MinInt32",
  2679. "MaxInt32"
  2680. ],
  2681. "skips": [
  2682. 0,
  2683. 0
  2684. ],
  2685. "buckets": [
  2686. 268435456,
  2687. 16777216,
  2688. 1048576,
  2689. 65536,
  2690. 4096,
  2691. 256,
  2692. 16
  2693. ]
  2694. }
  2695. }
  2696. },
  2697. "input_key": null,
  2698. "mfp_after": {
  2699. "expressions": [],
  2700. "predicates": [],
  2701. "projection": [
  2702. 0,
  2703. 1
  2704. ],
  2705. "input_arity": 2
  2706. }
  2707. }
  2708. }
  2709. },
  2710. "body": {
  2711. "lir_id": 10,
  2712. "node": {
  2713. "Union": {
  2714. "inputs": [
  2715. {
  2716. "lir_id": 9,
  2717. "node": {
  2718. "ArrangeBy": {
  2719. "input": {
  2720. "lir_id": 3,
  2721. "node": {
  2722. "Get": {
  2723. "id": {
  2724. "Local": 0
  2725. },
  2726. "keys": {
  2727. "raw": false,
  2728. "arranged": [
  2729. [
  2730. [],
  2731. [
  2732. 0,
  2733. 1
  2734. ],
  2735. [
  2736. 0,
  2737. 1
  2738. ]
  2739. ]
  2740. ],
  2741. "types": null
  2742. },
  2743. "plan": "PassArrangements"
  2744. }
  2745. }
  2746. },
  2747. "forms": {
  2748. "raw": true,
  2749. "arranged": [],
  2750. "types": null
  2751. },
  2752. "input_key": [],
  2753. "input_mfp": {
  2754. "expressions": [],
  2755. "predicates": [],
  2756. "projection": [
  2757. 0,
  2758. 1
  2759. ],
  2760. "input_arity": 2
  2761. }
  2762. }
  2763. }
  2764. },
  2765. {
  2766. "lir_id": 8,
  2767. "node": {
  2768. "Mfp": {
  2769. "input": {
  2770. "lir_id": 7,
  2771. "node": {
  2772. "Union": {
  2773. "inputs": [
  2774. {
  2775. "lir_id": 5,
  2776. "node": {
  2777. "Negate": {
  2778. "input": {
  2779. "lir_id": 4,
  2780. "node": {
  2781. "Get": {
  2782. "id": {
  2783. "Local": 0
  2784. },
  2785. "keys": {
  2786. "raw": false,
  2787. "arranged": [
  2788. [
  2789. [],
  2790. [
  2791. 0,
  2792. 1
  2793. ],
  2794. [
  2795. 0,
  2796. 1
  2797. ]
  2798. ]
  2799. ],
  2800. "types": null
  2801. },
  2802. "plan": {
  2803. "Arrangement": [
  2804. [],
  2805. null,
  2806. {
  2807. "expressions": [],
  2808. "predicates": [],
  2809. "projection": [],
  2810. "input_arity": 2
  2811. }
  2812. ]
  2813. }
  2814. }
  2815. }
  2816. }
  2817. }
  2818. }
  2819. },
  2820. {
  2821. "lir_id": 6,
  2822. "node": {
  2823. "Constant": {
  2824. "rows": {
  2825. "Ok": [
  2826. [
  2827. {
  2828. "data": []
  2829. },
  2830. 0,
  2831. 1
  2832. ]
  2833. ]
  2834. }
  2835. }
  2836. }
  2837. }
  2838. ],
  2839. "consolidate_output": true
  2840. }
  2841. }
  2842. },
  2843. "mfp": {
  2844. "expressions": [
  2845. {
  2846. "Literal": [
  2847. {
  2848. "Ok": {
  2849. "data": [
  2850. 0
  2851. ]
  2852. }
  2853. },
  2854. {
  2855. "scalar_type": "Int32",
  2856. "nullable": true
  2857. }
  2858. ]
  2859. },
  2860. {
  2861. "Literal": [
  2862. {
  2863. "Ok": {
  2864. "data": [
  2865. 0
  2866. ]
  2867. }
  2868. },
  2869. {
  2870. "scalar_type": "Int32",
  2871. "nullable": true
  2872. }
  2873. ]
  2874. }
  2875. ],
  2876. "predicates": [],
  2877. "projection": [
  2878. 0,
  2879. 1
  2880. ],
  2881. "input_arity": 0
  2882. },
  2883. "input_key_val": null
  2884. }
  2885. }
  2886. }
  2887. ],
  2888. "consolidate_output": false
  2889. }
  2890. }
  2891. }
  2892. }
  2893. }
  2894. }
  2895. }
  2896. ],
  2897. "sources": []
  2898. }
  2899. EOF
  2900. # Test Reduce::Hierarchical (global aggregate, one-shot).
  2901. query T multiline
  2902. EXPLAIN PHYSICAL PLAN AS JSON FOR
  2903. SELECT * FROM hierarchical_global
  2904. ----
  2905. {
  2906. "plans": [
  2907. {
  2908. "id": "Explained Query",
  2909. "plan": {
  2910. "lir_id": 11,
  2911. "node": {
  2912. "Let": {
  2913. "id": 0,
  2914. "value": {
  2915. "lir_id": 2,
  2916. "node": {
  2917. "Reduce": {
  2918. "input": {
  2919. "lir_id": 1,
  2920. "node": {
  2921. "Get": {
  2922. "id": {
  2923. "Global": {
  2924. "User": 1
  2925. }
  2926. },
  2927. "keys": {
  2928. "raw": false,
  2929. "arranged": [
  2930. [
  2931. [
  2932. {
  2933. "Column": [
  2934. 0,
  2935. "a"
  2936. ]
  2937. }
  2938. ],
  2939. [
  2940. 0,
  2941. 1
  2942. ],
  2943. [
  2944. 1
  2945. ]
  2946. ]
  2947. ],
  2948. "types": [
  2949. {
  2950. "scalar_type": "Int32",
  2951. "nullable": true
  2952. },
  2953. {
  2954. "scalar_type": "Int32",
  2955. "nullable": true
  2956. }
  2957. ]
  2958. },
  2959. "plan": {
  2960. "Arrangement": [
  2961. [
  2962. {
  2963. "Column": [
  2964. 0,
  2965. "a"
  2966. ]
  2967. }
  2968. ],
  2969. null,
  2970. {
  2971. "expressions": [],
  2972. "predicates": [],
  2973. "projection": [
  2974. 1
  2975. ],
  2976. "input_arity": 2
  2977. }
  2978. ]
  2979. }
  2980. }
  2981. }
  2982. },
  2983. "key_val_plan": {
  2984. "key_plan": {
  2985. "mfp": {
  2986. "expressions": [],
  2987. "predicates": [],
  2988. "projection": [],
  2989. "input_arity": 1
  2990. }
  2991. },
  2992. "val_plan": {
  2993. "mfp": {
  2994. "expressions": [],
  2995. "predicates": [],
  2996. "projection": [
  2997. 0,
  2998. 0
  2999. ],
  3000. "input_arity": 1
  3001. }
  3002. }
  3003. },
  3004. "plan": {
  3005. "Hierarchical": {
  3006. "Monotonic": {
  3007. "aggr_funcs": [
  3008. "MinInt32",
  3009. "MaxInt32"
  3010. ],
  3011. "skips": [
  3012. 0,
  3013. 0
  3014. ],
  3015. "must_consolidate": true
  3016. }
  3017. }
  3018. },
  3019. "input_key": null,
  3020. "mfp_after": {
  3021. "expressions": [],
  3022. "predicates": [],
  3023. "projection": [
  3024. 0,
  3025. 1
  3026. ],
  3027. "input_arity": 2
  3028. }
  3029. }
  3030. }
  3031. },
  3032. "body": {
  3033. "lir_id": 10,
  3034. "node": {
  3035. "Union": {
  3036. "inputs": [
  3037. {
  3038. "lir_id": 9,
  3039. "node": {
  3040. "ArrangeBy": {
  3041. "input": {
  3042. "lir_id": 3,
  3043. "node": {
  3044. "Get": {
  3045. "id": {
  3046. "Local": 0
  3047. },
  3048. "keys": {
  3049. "raw": false,
  3050. "arranged": [
  3051. [
  3052. [],
  3053. [
  3054. 0,
  3055. 1
  3056. ],
  3057. [
  3058. 0,
  3059. 1
  3060. ]
  3061. ]
  3062. ],
  3063. "types": null
  3064. },
  3065. "plan": "PassArrangements"
  3066. }
  3067. }
  3068. },
  3069. "forms": {
  3070. "raw": true,
  3071. "arranged": [],
  3072. "types": null
  3073. },
  3074. "input_key": [],
  3075. "input_mfp": {
  3076. "expressions": [],
  3077. "predicates": [],
  3078. "projection": [
  3079. 0,
  3080. 1
  3081. ],
  3082. "input_arity": 2
  3083. }
  3084. }
  3085. }
  3086. },
  3087. {
  3088. "lir_id": 8,
  3089. "node": {
  3090. "Mfp": {
  3091. "input": {
  3092. "lir_id": 7,
  3093. "node": {
  3094. "Union": {
  3095. "inputs": [
  3096. {
  3097. "lir_id": 5,
  3098. "node": {
  3099. "Negate": {
  3100. "input": {
  3101. "lir_id": 4,
  3102. "node": {
  3103. "Get": {
  3104. "id": {
  3105. "Local": 0
  3106. },
  3107. "keys": {
  3108. "raw": false,
  3109. "arranged": [
  3110. [
  3111. [],
  3112. [
  3113. 0,
  3114. 1
  3115. ],
  3116. [
  3117. 0,
  3118. 1
  3119. ]
  3120. ]
  3121. ],
  3122. "types": null
  3123. },
  3124. "plan": {
  3125. "Arrangement": [
  3126. [],
  3127. null,
  3128. {
  3129. "expressions": [],
  3130. "predicates": [],
  3131. "projection": [],
  3132. "input_arity": 2
  3133. }
  3134. ]
  3135. }
  3136. }
  3137. }
  3138. }
  3139. }
  3140. }
  3141. },
  3142. {
  3143. "lir_id": 6,
  3144. "node": {
  3145. "Constant": {
  3146. "rows": {
  3147. "Ok": [
  3148. [
  3149. {
  3150. "data": []
  3151. },
  3152. 0,
  3153. 1
  3154. ]
  3155. ]
  3156. }
  3157. }
  3158. }
  3159. }
  3160. ],
  3161. "consolidate_output": true
  3162. }
  3163. }
  3164. },
  3165. "mfp": {
  3166. "expressions": [
  3167. {
  3168. "Literal": [
  3169. {
  3170. "Ok": {
  3171. "data": [
  3172. 0
  3173. ]
  3174. }
  3175. },
  3176. {
  3177. "scalar_type": "Int32",
  3178. "nullable": true
  3179. }
  3180. ]
  3181. },
  3182. {
  3183. "Literal": [
  3184. {
  3185. "Ok": {
  3186. "data": [
  3187. 0
  3188. ]
  3189. }
  3190. },
  3191. {
  3192. "scalar_type": "Int32",
  3193. "nullable": true
  3194. }
  3195. ]
  3196. }
  3197. ],
  3198. "predicates": [],
  3199. "projection": [
  3200. 0,
  3201. 1
  3202. ],
  3203. "input_arity": 0
  3204. },
  3205. "input_key_val": null
  3206. }
  3207. }
  3208. }
  3209. ],
  3210. "consolidate_output": false
  3211. }
  3212. }
  3213. }
  3214. }
  3215. }
  3216. }
  3217. }
  3218. ],
  3219. "sources": []
  3220. }
  3221. EOF
  3222. # Test Reduce::Basic (with GROUP BY).
  3223. query T multiline
  3224. EXPLAIN PHYSICAL PLAN AS JSON FOR
  3225. SELECT
  3226. a,
  3227. STRING_AGG(b::text || '1', ','),
  3228. STRING_AGG(b::text || '2', ',')
  3229. FROM t
  3230. GROUP BY a
  3231. ----
  3232. {
  3233. "plans": [
  3234. {
  3235. "id": "Explained Query",
  3236. "plan": {
  3237. "lir_id": 2,
  3238. "node": {
  3239. "Reduce": {
  3240. "input": {
  3241. "lir_id": 1,
  3242. "node": {
  3243. "Get": {
  3244. "id": {
  3245. "Global": {
  3246. "User": 1
  3247. }
  3248. },
  3249. "keys": {
  3250. "raw": false,
  3251. "arranged": [
  3252. [
  3253. [
  3254. {
  3255. "Column": [
  3256. 0,
  3257. "a"
  3258. ]
  3259. }
  3260. ],
  3261. [
  3262. 0,
  3263. 1
  3264. ],
  3265. [
  3266. 1
  3267. ]
  3268. ]
  3269. ],
  3270. "types": [
  3271. {
  3272. "scalar_type": "Int32",
  3273. "nullable": true
  3274. },
  3275. {
  3276. "scalar_type": "Int32",
  3277. "nullable": true
  3278. }
  3279. ]
  3280. },
  3281. "plan": "PassArrangements"
  3282. }
  3283. }
  3284. },
  3285. "key_val_plan": {
  3286. "key_plan": {
  3287. "mfp": {
  3288. "expressions": [],
  3289. "predicates": [],
  3290. "projection": [
  3291. 0
  3292. ],
  3293. "input_arity": 2
  3294. }
  3295. },
  3296. "val_plan": {
  3297. "mfp": {
  3298. "expressions": [
  3299. {
  3300. "CallUnary": {
  3301. "func": {
  3302. "CastInt32ToString": null
  3303. },
  3304. "expr": {
  3305. "Column": [
  3306. 1,
  3307. "b"
  3308. ]
  3309. }
  3310. }
  3311. },
  3312. {
  3313. "CallVariadic": {
  3314. "func": {
  3315. "RecordCreate": {
  3316. "field_names": [
  3317. ""
  3318. ]
  3319. }
  3320. },
  3321. "exprs": [
  3322. {
  3323. "CallVariadic": {
  3324. "func": {
  3325. "RecordCreate": {
  3326. "field_names": [
  3327. "value",
  3328. "sep"
  3329. ]
  3330. }
  3331. },
  3332. "exprs": [
  3333. {
  3334. "CallBinary": {
  3335. "func": "TextConcat",
  3336. "expr1": {
  3337. "Column": [
  3338. 2,
  3339. null
  3340. ]
  3341. },
  3342. "expr2": {
  3343. "Literal": [
  3344. {
  3345. "Ok": {
  3346. "data": [
  3347. 19,
  3348. 1,
  3349. 49
  3350. ]
  3351. }
  3352. },
  3353. {
  3354. "scalar_type": "String",
  3355. "nullable": false
  3356. }
  3357. ]
  3358. }
  3359. }
  3360. },
  3361. {
  3362. "Literal": [
  3363. {
  3364. "Ok": {
  3365. "data": [
  3366. 19,
  3367. 1,
  3368. 44
  3369. ]
  3370. }
  3371. },
  3372. {
  3373. "scalar_type": "String",
  3374. "nullable": false
  3375. }
  3376. ]
  3377. }
  3378. ]
  3379. }
  3380. }
  3381. ]
  3382. }
  3383. },
  3384. {
  3385. "CallVariadic": {
  3386. "func": {
  3387. "RecordCreate": {
  3388. "field_names": [
  3389. ""
  3390. ]
  3391. }
  3392. },
  3393. "exprs": [
  3394. {
  3395. "CallVariadic": {
  3396. "func": {
  3397. "RecordCreate": {
  3398. "field_names": [
  3399. "value",
  3400. "sep"
  3401. ]
  3402. }
  3403. },
  3404. "exprs": [
  3405. {
  3406. "CallBinary": {
  3407. "func": "TextConcat",
  3408. "expr1": {
  3409. "Column": [
  3410. 2,
  3411. null
  3412. ]
  3413. },
  3414. "expr2": {
  3415. "Literal": [
  3416. {
  3417. "Ok": {
  3418. "data": [
  3419. 19,
  3420. 1,
  3421. 50
  3422. ]
  3423. }
  3424. },
  3425. {
  3426. "scalar_type": "String",
  3427. "nullable": false
  3428. }
  3429. ]
  3430. }
  3431. }
  3432. },
  3433. {
  3434. "Literal": [
  3435. {
  3436. "Ok": {
  3437. "data": [
  3438. 19,
  3439. 1,
  3440. 44
  3441. ]
  3442. }
  3443. },
  3444. {
  3445. "scalar_type": "String",
  3446. "nullable": false
  3447. }
  3448. ]
  3449. }
  3450. ]
  3451. }
  3452. }
  3453. ]
  3454. }
  3455. }
  3456. ],
  3457. "predicates": [],
  3458. "projection": [
  3459. 3,
  3460. 4
  3461. ],
  3462. "input_arity": 2
  3463. }
  3464. }
  3465. },
  3466. "plan": {
  3467. "Basic": {
  3468. "Multiple": [
  3469. [
  3470. 0,
  3471. {
  3472. "func": {
  3473. "StringAgg": {
  3474. "order_by": []
  3475. }
  3476. },
  3477. "expr": {
  3478. "CallVariadic": {
  3479. "func": {
  3480. "RecordCreate": {
  3481. "field_names": [
  3482. ""
  3483. ]
  3484. }
  3485. },
  3486. "exprs": [
  3487. {
  3488. "CallVariadic": {
  3489. "func": {
  3490. "RecordCreate": {
  3491. "field_names": [
  3492. "value",
  3493. "sep"
  3494. ]
  3495. }
  3496. },
  3497. "exprs": [
  3498. {
  3499. "CallBinary": {
  3500. "func": "TextConcat",
  3501. "expr1": {
  3502. "CallUnary": {
  3503. "func": {
  3504. "CastInt32ToString": null
  3505. },
  3506. "expr": {
  3507. "Column": [
  3508. 1,
  3509. "b"
  3510. ]
  3511. }
  3512. }
  3513. },
  3514. "expr2": {
  3515. "Literal": [
  3516. {
  3517. "Ok": {
  3518. "data": [
  3519. 19,
  3520. 1,
  3521. 49
  3522. ]
  3523. }
  3524. },
  3525. {
  3526. "scalar_type": "String",
  3527. "nullable": false
  3528. }
  3529. ]
  3530. }
  3531. }
  3532. },
  3533. {
  3534. "Literal": [
  3535. {
  3536. "Ok": {
  3537. "data": [
  3538. 19,
  3539. 1,
  3540. 44
  3541. ]
  3542. }
  3543. },
  3544. {
  3545. "scalar_type": "String",
  3546. "nullable": false
  3547. }
  3548. ]
  3549. }
  3550. ]
  3551. }
  3552. }
  3553. ]
  3554. }
  3555. },
  3556. "distinct": false
  3557. }
  3558. ],
  3559. [
  3560. 1,
  3561. {
  3562. "func": {
  3563. "StringAgg": {
  3564. "order_by": []
  3565. }
  3566. },
  3567. "expr": {
  3568. "CallVariadic": {
  3569. "func": {
  3570. "RecordCreate": {
  3571. "field_names": [
  3572. ""
  3573. ]
  3574. }
  3575. },
  3576. "exprs": [
  3577. {
  3578. "CallVariadic": {
  3579. "func": {
  3580. "RecordCreate": {
  3581. "field_names": [
  3582. "value",
  3583. "sep"
  3584. ]
  3585. }
  3586. },
  3587. "exprs": [
  3588. {
  3589. "CallBinary": {
  3590. "func": "TextConcat",
  3591. "expr1": {
  3592. "CallUnary": {
  3593. "func": {
  3594. "CastInt32ToString": null
  3595. },
  3596. "expr": {
  3597. "Column": [
  3598. 1,
  3599. "b"
  3600. ]
  3601. }
  3602. }
  3603. },
  3604. "expr2": {
  3605. "Literal": [
  3606. {
  3607. "Ok": {
  3608. "data": [
  3609. 19,
  3610. 1,
  3611. 50
  3612. ]
  3613. }
  3614. },
  3615. {
  3616. "scalar_type": "String",
  3617. "nullable": false
  3618. }
  3619. ]
  3620. }
  3621. }
  3622. },
  3623. {
  3624. "Literal": [
  3625. {
  3626. "Ok": {
  3627. "data": [
  3628. 19,
  3629. 1,
  3630. 44
  3631. ]
  3632. }
  3633. },
  3634. {
  3635. "scalar_type": "String",
  3636. "nullable": false
  3637. }
  3638. ]
  3639. }
  3640. ]
  3641. }
  3642. }
  3643. ]
  3644. }
  3645. },
  3646. "distinct": false
  3647. }
  3648. ]
  3649. ]
  3650. }
  3651. },
  3652. "input_key": [
  3653. {
  3654. "Column": [
  3655. 0,
  3656. "a"
  3657. ]
  3658. }
  3659. ],
  3660. "mfp_after": {
  3661. "expressions": [],
  3662. "predicates": [],
  3663. "projection": [
  3664. 0,
  3665. 1,
  3666. 2
  3667. ],
  3668. "input_arity": 3
  3669. }
  3670. }
  3671. }
  3672. }
  3673. }
  3674. ],
  3675. "sources": []
  3676. }
  3677. EOF
  3678. # Test Reduce::Basic (global aggregate).
  3679. query T multiline
  3680. EXPLAIN PHYSICAL PLAN AS JSON FOR
  3681. SELECT
  3682. STRING_AGG(b::text || '1', ','),
  3683. STRING_AGG(b::text || '2', ',')
  3684. FROM t
  3685. ----
  3686. {
  3687. "plans": [
  3688. {
  3689. "id": "Explained Query",
  3690. "plan": {
  3691. "lir_id": 11,
  3692. "node": {
  3693. "Let": {
  3694. "id": 0,
  3695. "value": {
  3696. "lir_id": 2,
  3697. "node": {
  3698. "Reduce": {
  3699. "input": {
  3700. "lir_id": 1,
  3701. "node": {
  3702. "Get": {
  3703. "id": {
  3704. "Global": {
  3705. "User": 1
  3706. }
  3707. },
  3708. "keys": {
  3709. "raw": false,
  3710. "arranged": [
  3711. [
  3712. [
  3713. {
  3714. "Column": [
  3715. 0,
  3716. "a"
  3717. ]
  3718. }
  3719. ],
  3720. [
  3721. 0,
  3722. 1
  3723. ],
  3724. [
  3725. 1
  3726. ]
  3727. ]
  3728. ],
  3729. "types": [
  3730. {
  3731. "scalar_type": "Int32",
  3732. "nullable": true
  3733. },
  3734. {
  3735. "scalar_type": "Int32",
  3736. "nullable": true
  3737. }
  3738. ]
  3739. },
  3740. "plan": {
  3741. "Arrangement": [
  3742. [
  3743. {
  3744. "Column": [
  3745. 0,
  3746. "a"
  3747. ]
  3748. }
  3749. ],
  3750. null,
  3751. {
  3752. "expressions": [],
  3753. "predicates": [],
  3754. "projection": [
  3755. 1
  3756. ],
  3757. "input_arity": 2
  3758. }
  3759. ]
  3760. }
  3761. }
  3762. }
  3763. },
  3764. "key_val_plan": {
  3765. "key_plan": {
  3766. "mfp": {
  3767. "expressions": [],
  3768. "predicates": [],
  3769. "projection": [],
  3770. "input_arity": 1
  3771. }
  3772. },
  3773. "val_plan": {
  3774. "mfp": {
  3775. "expressions": [
  3776. {
  3777. "CallUnary": {
  3778. "func": {
  3779. "CastInt32ToString": null
  3780. },
  3781. "expr": {
  3782. "Column": [
  3783. 0,
  3784. "b"
  3785. ]
  3786. }
  3787. }
  3788. },
  3789. {
  3790. "CallVariadic": {
  3791. "func": {
  3792. "RecordCreate": {
  3793. "field_names": [
  3794. ""
  3795. ]
  3796. }
  3797. },
  3798. "exprs": [
  3799. {
  3800. "CallVariadic": {
  3801. "func": {
  3802. "RecordCreate": {
  3803. "field_names": [
  3804. "value",
  3805. "sep"
  3806. ]
  3807. }
  3808. },
  3809. "exprs": [
  3810. {
  3811. "CallBinary": {
  3812. "func": "TextConcat",
  3813. "expr1": {
  3814. "Column": [
  3815. 1,
  3816. null
  3817. ]
  3818. },
  3819. "expr2": {
  3820. "Literal": [
  3821. {
  3822. "Ok": {
  3823. "data": [
  3824. 19,
  3825. 1,
  3826. 49
  3827. ]
  3828. }
  3829. },
  3830. {
  3831. "scalar_type": "String",
  3832. "nullable": false
  3833. }
  3834. ]
  3835. }
  3836. }
  3837. },
  3838. {
  3839. "Literal": [
  3840. {
  3841. "Ok": {
  3842. "data": [
  3843. 19,
  3844. 1,
  3845. 44
  3846. ]
  3847. }
  3848. },
  3849. {
  3850. "scalar_type": "String",
  3851. "nullable": false
  3852. }
  3853. ]
  3854. }
  3855. ]
  3856. }
  3857. }
  3858. ]
  3859. }
  3860. },
  3861. {
  3862. "CallVariadic": {
  3863. "func": {
  3864. "RecordCreate": {
  3865. "field_names": [
  3866. ""
  3867. ]
  3868. }
  3869. },
  3870. "exprs": [
  3871. {
  3872. "CallVariadic": {
  3873. "func": {
  3874. "RecordCreate": {
  3875. "field_names": [
  3876. "value",
  3877. "sep"
  3878. ]
  3879. }
  3880. },
  3881. "exprs": [
  3882. {
  3883. "CallBinary": {
  3884. "func": "TextConcat",
  3885. "expr1": {
  3886. "Column": [
  3887. 1,
  3888. null
  3889. ]
  3890. },
  3891. "expr2": {
  3892. "Literal": [
  3893. {
  3894. "Ok": {
  3895. "data": [
  3896. 19,
  3897. 1,
  3898. 50
  3899. ]
  3900. }
  3901. },
  3902. {
  3903. "scalar_type": "String",
  3904. "nullable": false
  3905. }
  3906. ]
  3907. }
  3908. }
  3909. },
  3910. {
  3911. "Literal": [
  3912. {
  3913. "Ok": {
  3914. "data": [
  3915. 19,
  3916. 1,
  3917. 44
  3918. ]
  3919. }
  3920. },
  3921. {
  3922. "scalar_type": "String",
  3923. "nullable": false
  3924. }
  3925. ]
  3926. }
  3927. ]
  3928. }
  3929. }
  3930. ]
  3931. }
  3932. }
  3933. ],
  3934. "predicates": [],
  3935. "projection": [
  3936. 2,
  3937. 3
  3938. ],
  3939. "input_arity": 1
  3940. }
  3941. }
  3942. },
  3943. "plan": {
  3944. "Basic": {
  3945. "Multiple": [
  3946. [
  3947. 0,
  3948. {
  3949. "func": {
  3950. "StringAgg": {
  3951. "order_by": []
  3952. }
  3953. },
  3954. "expr": {
  3955. "CallVariadic": {
  3956. "func": {
  3957. "RecordCreate": {
  3958. "field_names": [
  3959. ""
  3960. ]
  3961. }
  3962. },
  3963. "exprs": [
  3964. {
  3965. "CallVariadic": {
  3966. "func": {
  3967. "RecordCreate": {
  3968. "field_names": [
  3969. "value",
  3970. "sep"
  3971. ]
  3972. }
  3973. },
  3974. "exprs": [
  3975. {
  3976. "CallBinary": {
  3977. "func": "TextConcat",
  3978. "expr1": {
  3979. "CallUnary": {
  3980. "func": {
  3981. "CastInt32ToString": null
  3982. },
  3983. "expr": {
  3984. "Column": [
  3985. 0,
  3986. "b"
  3987. ]
  3988. }
  3989. }
  3990. },
  3991. "expr2": {
  3992. "Literal": [
  3993. {
  3994. "Ok": {
  3995. "data": [
  3996. 19,
  3997. 1,
  3998. 49
  3999. ]
  4000. }
  4001. },
  4002. {
  4003. "scalar_type": "String",
  4004. "nullable": false
  4005. }
  4006. ]
  4007. }
  4008. }
  4009. },
  4010. {
  4011. "Literal": [
  4012. {
  4013. "Ok": {
  4014. "data": [
  4015. 19,
  4016. 1,
  4017. 44
  4018. ]
  4019. }
  4020. },
  4021. {
  4022. "scalar_type": "String",
  4023. "nullable": false
  4024. }
  4025. ]
  4026. }
  4027. ]
  4028. }
  4029. }
  4030. ]
  4031. }
  4032. },
  4033. "distinct": false
  4034. }
  4035. ],
  4036. [
  4037. 1,
  4038. {
  4039. "func": {
  4040. "StringAgg": {
  4041. "order_by": []
  4042. }
  4043. },
  4044. "expr": {
  4045. "CallVariadic": {
  4046. "func": {
  4047. "RecordCreate": {
  4048. "field_names": [
  4049. ""
  4050. ]
  4051. }
  4052. },
  4053. "exprs": [
  4054. {
  4055. "CallVariadic": {
  4056. "func": {
  4057. "RecordCreate": {
  4058. "field_names": [
  4059. "value",
  4060. "sep"
  4061. ]
  4062. }
  4063. },
  4064. "exprs": [
  4065. {
  4066. "CallBinary": {
  4067. "func": "TextConcat",
  4068. "expr1": {
  4069. "CallUnary": {
  4070. "func": {
  4071. "CastInt32ToString": null
  4072. },
  4073. "expr": {
  4074. "Column": [
  4075. 0,
  4076. "b"
  4077. ]
  4078. }
  4079. }
  4080. },
  4081. "expr2": {
  4082. "Literal": [
  4083. {
  4084. "Ok": {
  4085. "data": [
  4086. 19,
  4087. 1,
  4088. 50
  4089. ]
  4090. }
  4091. },
  4092. {
  4093. "scalar_type": "String",
  4094. "nullable": false
  4095. }
  4096. ]
  4097. }
  4098. }
  4099. },
  4100. {
  4101. "Literal": [
  4102. {
  4103. "Ok": {
  4104. "data": [
  4105. 19,
  4106. 1,
  4107. 44
  4108. ]
  4109. }
  4110. },
  4111. {
  4112. "scalar_type": "String",
  4113. "nullable": false
  4114. }
  4115. ]
  4116. }
  4117. ]
  4118. }
  4119. }
  4120. ]
  4121. }
  4122. },
  4123. "distinct": false
  4124. }
  4125. ]
  4126. ]
  4127. }
  4128. },
  4129. "input_key": null,
  4130. "mfp_after": {
  4131. "expressions": [],
  4132. "predicates": [],
  4133. "projection": [
  4134. 0,
  4135. 1
  4136. ],
  4137. "input_arity": 2
  4138. }
  4139. }
  4140. }
  4141. },
  4142. "body": {
  4143. "lir_id": 10,
  4144. "node": {
  4145. "Union": {
  4146. "inputs": [
  4147. {
  4148. "lir_id": 9,
  4149. "node": {
  4150. "ArrangeBy": {
  4151. "input": {
  4152. "lir_id": 3,
  4153. "node": {
  4154. "Get": {
  4155. "id": {
  4156. "Local": 0
  4157. },
  4158. "keys": {
  4159. "raw": false,
  4160. "arranged": [
  4161. [
  4162. [],
  4163. [
  4164. 0,
  4165. 1
  4166. ],
  4167. [
  4168. 0,
  4169. 1
  4170. ]
  4171. ]
  4172. ],
  4173. "types": null
  4174. },
  4175. "plan": "PassArrangements"
  4176. }
  4177. }
  4178. },
  4179. "forms": {
  4180. "raw": true,
  4181. "arranged": [],
  4182. "types": null
  4183. },
  4184. "input_key": [],
  4185. "input_mfp": {
  4186. "expressions": [],
  4187. "predicates": [],
  4188. "projection": [
  4189. 0,
  4190. 1
  4191. ],
  4192. "input_arity": 2
  4193. }
  4194. }
  4195. }
  4196. },
  4197. {
  4198. "lir_id": 8,
  4199. "node": {
  4200. "Mfp": {
  4201. "input": {
  4202. "lir_id": 7,
  4203. "node": {
  4204. "Union": {
  4205. "inputs": [
  4206. {
  4207. "lir_id": 5,
  4208. "node": {
  4209. "Negate": {
  4210. "input": {
  4211. "lir_id": 4,
  4212. "node": {
  4213. "Get": {
  4214. "id": {
  4215. "Local": 0
  4216. },
  4217. "keys": {
  4218. "raw": false,
  4219. "arranged": [
  4220. [
  4221. [],
  4222. [
  4223. 0,
  4224. 1
  4225. ],
  4226. [
  4227. 0,
  4228. 1
  4229. ]
  4230. ]
  4231. ],
  4232. "types": null
  4233. },
  4234. "plan": {
  4235. "Arrangement": [
  4236. [],
  4237. null,
  4238. {
  4239. "expressions": [],
  4240. "predicates": [],
  4241. "projection": [],
  4242. "input_arity": 2
  4243. }
  4244. ]
  4245. }
  4246. }
  4247. }
  4248. }
  4249. }
  4250. }
  4251. },
  4252. {
  4253. "lir_id": 6,
  4254. "node": {
  4255. "Constant": {
  4256. "rows": {
  4257. "Ok": [
  4258. [
  4259. {
  4260. "data": []
  4261. },
  4262. 0,
  4263. 1
  4264. ]
  4265. ]
  4266. }
  4267. }
  4268. }
  4269. }
  4270. ],
  4271. "consolidate_output": true
  4272. }
  4273. }
  4274. },
  4275. "mfp": {
  4276. "expressions": [
  4277. {
  4278. "Literal": [
  4279. {
  4280. "Ok": {
  4281. "data": [
  4282. 0
  4283. ]
  4284. }
  4285. },
  4286. {
  4287. "scalar_type": "String",
  4288. "nullable": true
  4289. }
  4290. ]
  4291. },
  4292. {
  4293. "Literal": [
  4294. {
  4295. "Ok": {
  4296. "data": [
  4297. 0
  4298. ]
  4299. }
  4300. },
  4301. {
  4302. "scalar_type": "String",
  4303. "nullable": true
  4304. }
  4305. ]
  4306. }
  4307. ],
  4308. "predicates": [],
  4309. "projection": [
  4310. 0,
  4311. 1
  4312. ],
  4313. "input_arity": 0
  4314. },
  4315. "input_key_val": null
  4316. }
  4317. }
  4318. }
  4319. ],
  4320. "consolidate_output": false
  4321. }
  4322. }
  4323. }
  4324. }
  4325. }
  4326. }
  4327. }
  4328. ],
  4329. "sources": []
  4330. }
  4331. EOF
  4332. # Test Reduce::Collated (with GROUP BY).
  4333. query T multiline
  4334. EXPLAIN PHYSICAL PLAN AS JSON FOR
  4335. MATERIALIZED VIEW collated_group_by_mv
  4336. ----
  4337. {
  4338. "plans": [
  4339. {
  4340. "id": "materialize.public.collated_group_by_mv",
  4341. "plan": {
  4342. "lir_id": 2,
  4343. "node": {
  4344. "Reduce": {
  4345. "input": {
  4346. "lir_id": 1,
  4347. "node": {
  4348. "Get": {
  4349. "id": {
  4350. "Global": {
  4351. "User": 1
  4352. }
  4353. },
  4354. "keys": {
  4355. "raw": false,
  4356. "arranged": [
  4357. [
  4358. [
  4359. {
  4360. "Column": [
  4361. 0,
  4362. "a"
  4363. ]
  4364. }
  4365. ],
  4366. [
  4367. 0,
  4368. 1
  4369. ],
  4370. [
  4371. 1
  4372. ]
  4373. ]
  4374. ],
  4375. "types": [
  4376. {
  4377. "scalar_type": "Int32",
  4378. "nullable": true
  4379. },
  4380. {
  4381. "scalar_type": "Int32",
  4382. "nullable": true
  4383. }
  4384. ]
  4385. },
  4386. "plan": "PassArrangements"
  4387. }
  4388. }
  4389. },
  4390. "key_val_plan": {
  4391. "key_plan": {
  4392. "mfp": {
  4393. "expressions": [],
  4394. "predicates": [],
  4395. "projection": [
  4396. 0
  4397. ],
  4398. "input_arity": 2
  4399. }
  4400. },
  4401. "val_plan": {
  4402. "mfp": {
  4403. "expressions": [
  4404. {
  4405. "CallUnary": {
  4406. "func": {
  4407. "CastInt32ToString": null
  4408. },
  4409. "expr": {
  4410. "Column": [
  4411. 1,
  4412. "b"
  4413. ]
  4414. }
  4415. }
  4416. },
  4417. {
  4418. "CallVariadic": {
  4419. "func": {
  4420. "RecordCreate": {
  4421. "field_names": [
  4422. ""
  4423. ]
  4424. }
  4425. },
  4426. "exprs": [
  4427. {
  4428. "CallVariadic": {
  4429. "func": {
  4430. "RecordCreate": {
  4431. "field_names": [
  4432. "value",
  4433. "sep"
  4434. ]
  4435. }
  4436. },
  4437. "exprs": [
  4438. {
  4439. "CallBinary": {
  4440. "func": "TextConcat",
  4441. "expr1": {
  4442. "Column": [
  4443. 2,
  4444. null
  4445. ]
  4446. },
  4447. "expr2": {
  4448. "Literal": [
  4449. {
  4450. "Ok": {
  4451. "data": [
  4452. 19,
  4453. 1,
  4454. 49
  4455. ]
  4456. }
  4457. },
  4458. {
  4459. "scalar_type": "String",
  4460. "nullable": false
  4461. }
  4462. ]
  4463. }
  4464. }
  4465. },
  4466. {
  4467. "Literal": [
  4468. {
  4469. "Ok": {
  4470. "data": [
  4471. 19,
  4472. 1,
  4473. 44
  4474. ]
  4475. }
  4476. },
  4477. {
  4478. "scalar_type": "String",
  4479. "nullable": false
  4480. }
  4481. ]
  4482. }
  4483. ]
  4484. }
  4485. }
  4486. ]
  4487. }
  4488. },
  4489. {
  4490. "CallVariadic": {
  4491. "func": {
  4492. "RecordCreate": {
  4493. "field_names": [
  4494. ""
  4495. ]
  4496. }
  4497. },
  4498. "exprs": [
  4499. {
  4500. "CallVariadic": {
  4501. "func": {
  4502. "RecordCreate": {
  4503. "field_names": [
  4504. "value",
  4505. "sep"
  4506. ]
  4507. }
  4508. },
  4509. "exprs": [
  4510. {
  4511. "CallBinary": {
  4512. "func": "TextConcat",
  4513. "expr1": {
  4514. "Column": [
  4515. 2,
  4516. null
  4517. ]
  4518. },
  4519. "expr2": {
  4520. "Literal": [
  4521. {
  4522. "Ok": {
  4523. "data": [
  4524. 19,
  4525. 1,
  4526. 50
  4527. ]
  4528. }
  4529. },
  4530. {
  4531. "scalar_type": "String",
  4532. "nullable": false
  4533. }
  4534. ]
  4535. }
  4536. }
  4537. },
  4538. {
  4539. "Literal": [
  4540. {
  4541. "Ok": {
  4542. "data": [
  4543. 19,
  4544. 1,
  4545. 44
  4546. ]
  4547. }
  4548. },
  4549. {
  4550. "scalar_type": "String",
  4551. "nullable": false
  4552. }
  4553. ]
  4554. }
  4555. ]
  4556. }
  4557. }
  4558. ]
  4559. }
  4560. }
  4561. ],
  4562. "predicates": [],
  4563. "projection": [
  4564. 1,
  4565. 3,
  4566. 1,
  4567. 1,
  4568. 1,
  4569. 4
  4570. ],
  4571. "input_arity": 2
  4572. }
  4573. }
  4574. },
  4575. "plan": {
  4576. "Collation": {
  4577. "accumulable": {
  4578. "full_aggrs": [
  4579. {
  4580. "func": "Count",
  4581. "expr": {
  4582. "Column": [
  4583. 1,
  4584. "b"
  4585. ]
  4586. },
  4587. "distinct": true
  4588. },
  4589. {
  4590. "func": "SumInt32",
  4591. "expr": {
  4592. "Column": [
  4593. 1,
  4594. "b"
  4595. ]
  4596. },
  4597. "distinct": false
  4598. }
  4599. ],
  4600. "simple_aggrs": [
  4601. [
  4602. 1,
  4603. 4,
  4604. {
  4605. "func": "SumInt32",
  4606. "expr": {
  4607. "Column": [
  4608. 1,
  4609. "b"
  4610. ]
  4611. },
  4612. "distinct": false
  4613. }
  4614. ]
  4615. ],
  4616. "distinct_aggrs": [
  4617. [
  4618. 0,
  4619. 0,
  4620. {
  4621. "func": "Count",
  4622. "expr": {
  4623. "Column": [
  4624. 1,
  4625. "b"
  4626. ]
  4627. },
  4628. "distinct": true
  4629. }
  4630. ]
  4631. ]
  4632. },
  4633. "hierarchical": {
  4634. "Bucketed": {
  4635. "aggr_funcs": [
  4636. "MinInt32",
  4637. "MaxInt32"
  4638. ],
  4639. "skips": [
  4640. 2,
  4641. 0
  4642. ],
  4643. "buckets": [
  4644. 268435456,
  4645. 16777216,
  4646. 1048576,
  4647. 65536,
  4648. 4096,
  4649. 256,
  4650. 16
  4651. ]
  4652. }
  4653. },
  4654. "basic": {
  4655. "Multiple": [
  4656. [
  4657. 1,
  4658. {
  4659. "func": {
  4660. "StringAgg": {
  4661. "order_by": []
  4662. }
  4663. },
  4664. "expr": {
  4665. "CallVariadic": {
  4666. "func": {
  4667. "RecordCreate": {
  4668. "field_names": [
  4669. ""
  4670. ]
  4671. }
  4672. },
  4673. "exprs": [
  4674. {
  4675. "CallVariadic": {
  4676. "func": {
  4677. "RecordCreate": {
  4678. "field_names": [
  4679. "value",
  4680. "sep"
  4681. ]
  4682. }
  4683. },
  4684. "exprs": [
  4685. {
  4686. "CallBinary": {
  4687. "func": "TextConcat",
  4688. "expr1": {
  4689. "CallUnary": {
  4690. "func": {
  4691. "CastInt32ToString": null
  4692. },
  4693. "expr": {
  4694. "Column": [
  4695. 1,
  4696. "b"
  4697. ]
  4698. }
  4699. }
  4700. },
  4701. "expr2": {
  4702. "Literal": [
  4703. {
  4704. "Ok": {
  4705. "data": [
  4706. 19,
  4707. 1,
  4708. 49
  4709. ]
  4710. }
  4711. },
  4712. {
  4713. "scalar_type": "String",
  4714. "nullable": false
  4715. }
  4716. ]
  4717. }
  4718. }
  4719. },
  4720. {
  4721. "Literal": [
  4722. {
  4723. "Ok": {
  4724. "data": [
  4725. 19,
  4726. 1,
  4727. 44
  4728. ]
  4729. }
  4730. },
  4731. {
  4732. "scalar_type": "String",
  4733. "nullable": false
  4734. }
  4735. ]
  4736. }
  4737. ]
  4738. }
  4739. }
  4740. ]
  4741. }
  4742. },
  4743. "distinct": false
  4744. }
  4745. ],
  4746. [
  4747. 5,
  4748. {
  4749. "func": {
  4750. "StringAgg": {
  4751. "order_by": []
  4752. }
  4753. },
  4754. "expr": {
  4755. "CallVariadic": {
  4756. "func": {
  4757. "RecordCreate": {
  4758. "field_names": [
  4759. ""
  4760. ]
  4761. }
  4762. },
  4763. "exprs": [
  4764. {
  4765. "CallVariadic": {
  4766. "func": {
  4767. "RecordCreate": {
  4768. "field_names": [
  4769. "value",
  4770. "sep"
  4771. ]
  4772. }
  4773. },
  4774. "exprs": [
  4775. {
  4776. "CallBinary": {
  4777. "func": "TextConcat",
  4778. "expr1": {
  4779. "CallUnary": {
  4780. "func": {
  4781. "CastInt32ToString": null
  4782. },
  4783. "expr": {
  4784. "Column": [
  4785. 1,
  4786. "b"
  4787. ]
  4788. }
  4789. }
  4790. },
  4791. "expr2": {
  4792. "Literal": [
  4793. {
  4794. "Ok": {
  4795. "data": [
  4796. 19,
  4797. 1,
  4798. 50
  4799. ]
  4800. }
  4801. },
  4802. {
  4803. "scalar_type": "String",
  4804. "nullable": false
  4805. }
  4806. ]
  4807. }
  4808. }
  4809. },
  4810. {
  4811. "Literal": [
  4812. {
  4813. "Ok": {
  4814. "data": [
  4815. 19,
  4816. 1,
  4817. 44
  4818. ]
  4819. }
  4820. },
  4821. {
  4822. "scalar_type": "String",
  4823. "nullable": false
  4824. }
  4825. ]
  4826. }
  4827. ]
  4828. }
  4829. }
  4830. ]
  4831. }
  4832. },
  4833. "distinct": false
  4834. }
  4835. ]
  4836. ]
  4837. },
  4838. "aggregate_types": [
  4839. "Accumulable",
  4840. "Basic",
  4841. "Hierarchical",
  4842. "Hierarchical",
  4843. "Accumulable",
  4844. "Basic"
  4845. ]
  4846. }
  4847. },
  4848. "input_key": [
  4849. {
  4850. "Column": [
  4851. 0,
  4852. "a"
  4853. ]
  4854. }
  4855. ],
  4856. "mfp_after": {
  4857. "expressions": [],
  4858. "predicates": [],
  4859. "projection": [
  4860. 0,
  4861. 1,
  4862. 2,
  4863. 3,
  4864. 4,
  4865. 5,
  4866. 6
  4867. ],
  4868. "input_arity": 7
  4869. }
  4870. }
  4871. }
  4872. }
  4873. }
  4874. ],
  4875. "sources": []
  4876. }
  4877. EOF
  4878. # Test Reduce::Collated (with GROUP BY, one-shot).
  4879. query T multiline
  4880. EXPLAIN PHYSICAL PLAN AS JSON FOR
  4881. SELECT * FROM collated_group_by
  4882. ----
  4883. {
  4884. "plans": [
  4885. {
  4886. "id": "Explained Query",
  4887. "plan": {
  4888. "lir_id": 2,
  4889. "node": {
  4890. "Reduce": {
  4891. "input": {
  4892. "lir_id": 1,
  4893. "node": {
  4894. "Get": {
  4895. "id": {
  4896. "Global": {
  4897. "User": 1
  4898. }
  4899. },
  4900. "keys": {
  4901. "raw": false,
  4902. "arranged": [
  4903. [
  4904. [
  4905. {
  4906. "Column": [
  4907. 0,
  4908. "a"
  4909. ]
  4910. }
  4911. ],
  4912. [
  4913. 0,
  4914. 1
  4915. ],
  4916. [
  4917. 1
  4918. ]
  4919. ]
  4920. ],
  4921. "types": [
  4922. {
  4923. "scalar_type": "Int32",
  4924. "nullable": true
  4925. },
  4926. {
  4927. "scalar_type": "Int32",
  4928. "nullable": true
  4929. }
  4930. ]
  4931. },
  4932. "plan": "PassArrangements"
  4933. }
  4934. }
  4935. },
  4936. "key_val_plan": {
  4937. "key_plan": {
  4938. "mfp": {
  4939. "expressions": [],
  4940. "predicates": [],
  4941. "projection": [
  4942. 0
  4943. ],
  4944. "input_arity": 2
  4945. }
  4946. },
  4947. "val_plan": {
  4948. "mfp": {
  4949. "expressions": [
  4950. {
  4951. "CallUnary": {
  4952. "func": {
  4953. "CastInt32ToString": null
  4954. },
  4955. "expr": {
  4956. "Column": [
  4957. 1,
  4958. "b"
  4959. ]
  4960. }
  4961. }
  4962. },
  4963. {
  4964. "CallVariadic": {
  4965. "func": {
  4966. "RecordCreate": {
  4967. "field_names": [
  4968. ""
  4969. ]
  4970. }
  4971. },
  4972. "exprs": [
  4973. {
  4974. "CallVariadic": {
  4975. "func": {
  4976. "RecordCreate": {
  4977. "field_names": [
  4978. "value",
  4979. "sep"
  4980. ]
  4981. }
  4982. },
  4983. "exprs": [
  4984. {
  4985. "CallBinary": {
  4986. "func": "TextConcat",
  4987. "expr1": {
  4988. "Column": [
  4989. 2,
  4990. null
  4991. ]
  4992. },
  4993. "expr2": {
  4994. "Literal": [
  4995. {
  4996. "Ok": {
  4997. "data": [
  4998. 19,
  4999. 1,
  5000. 49
  5001. ]
  5002. }
  5003. },
  5004. {
  5005. "scalar_type": "String",
  5006. "nullable": false
  5007. }
  5008. ]
  5009. }
  5010. }
  5011. },
  5012. {
  5013. "Literal": [
  5014. {
  5015. "Ok": {
  5016. "data": [
  5017. 19,
  5018. 1,
  5019. 44
  5020. ]
  5021. }
  5022. },
  5023. {
  5024. "scalar_type": "String",
  5025. "nullable": false
  5026. }
  5027. ]
  5028. }
  5029. ]
  5030. }
  5031. }
  5032. ]
  5033. }
  5034. },
  5035. {
  5036. "CallVariadic": {
  5037. "func": {
  5038. "RecordCreate": {
  5039. "field_names": [
  5040. ""
  5041. ]
  5042. }
  5043. },
  5044. "exprs": [
  5045. {
  5046. "CallVariadic": {
  5047. "func": {
  5048. "RecordCreate": {
  5049. "field_names": [
  5050. "value",
  5051. "sep"
  5052. ]
  5053. }
  5054. },
  5055. "exprs": [
  5056. {
  5057. "CallBinary": {
  5058. "func": "TextConcat",
  5059. "expr1": {
  5060. "Column": [
  5061. 2,
  5062. null
  5063. ]
  5064. },
  5065. "expr2": {
  5066. "Literal": [
  5067. {
  5068. "Ok": {
  5069. "data": [
  5070. 19,
  5071. 1,
  5072. 50
  5073. ]
  5074. }
  5075. },
  5076. {
  5077. "scalar_type": "String",
  5078. "nullable": false
  5079. }
  5080. ]
  5081. }
  5082. }
  5083. },
  5084. {
  5085. "Literal": [
  5086. {
  5087. "Ok": {
  5088. "data": [
  5089. 19,
  5090. 1,
  5091. 44
  5092. ]
  5093. }
  5094. },
  5095. {
  5096. "scalar_type": "String",
  5097. "nullable": false
  5098. }
  5099. ]
  5100. }
  5101. ]
  5102. }
  5103. }
  5104. ]
  5105. }
  5106. }
  5107. ],
  5108. "predicates": [],
  5109. "projection": [
  5110. 1,
  5111. 3,
  5112. 1,
  5113. 1,
  5114. 1,
  5115. 4
  5116. ],
  5117. "input_arity": 2
  5118. }
  5119. }
  5120. },
  5121. "plan": {
  5122. "Collation": {
  5123. "accumulable": {
  5124. "full_aggrs": [
  5125. {
  5126. "func": "Count",
  5127. "expr": {
  5128. "Column": [
  5129. 1,
  5130. "b"
  5131. ]
  5132. },
  5133. "distinct": true
  5134. },
  5135. {
  5136. "func": "SumInt32",
  5137. "expr": {
  5138. "Column": [
  5139. 1,
  5140. "b"
  5141. ]
  5142. },
  5143. "distinct": false
  5144. }
  5145. ],
  5146. "simple_aggrs": [
  5147. [
  5148. 1,
  5149. 4,
  5150. {
  5151. "func": "SumInt32",
  5152. "expr": {
  5153. "Column": [
  5154. 1,
  5155. "b"
  5156. ]
  5157. },
  5158. "distinct": false
  5159. }
  5160. ]
  5161. ],
  5162. "distinct_aggrs": [
  5163. [
  5164. 0,
  5165. 0,
  5166. {
  5167. "func": "Count",
  5168. "expr": {
  5169. "Column": [
  5170. 1,
  5171. "b"
  5172. ]
  5173. },
  5174. "distinct": true
  5175. }
  5176. ]
  5177. ]
  5178. },
  5179. "hierarchical": {
  5180. "Monotonic": {
  5181. "aggr_funcs": [
  5182. "MinInt32",
  5183. "MaxInt32"
  5184. ],
  5185. "skips": [
  5186. 2,
  5187. 0
  5188. ],
  5189. "must_consolidate": true
  5190. }
  5191. },
  5192. "basic": {
  5193. "Multiple": [
  5194. [
  5195. 1,
  5196. {
  5197. "func": {
  5198. "StringAgg": {
  5199. "order_by": []
  5200. }
  5201. },
  5202. "expr": {
  5203. "CallVariadic": {
  5204. "func": {
  5205. "RecordCreate": {
  5206. "field_names": [
  5207. ""
  5208. ]
  5209. }
  5210. },
  5211. "exprs": [
  5212. {
  5213. "CallVariadic": {
  5214. "func": {
  5215. "RecordCreate": {
  5216. "field_names": [
  5217. "value",
  5218. "sep"
  5219. ]
  5220. }
  5221. },
  5222. "exprs": [
  5223. {
  5224. "CallBinary": {
  5225. "func": "TextConcat",
  5226. "expr1": {
  5227. "CallUnary": {
  5228. "func": {
  5229. "CastInt32ToString": null
  5230. },
  5231. "expr": {
  5232. "Column": [
  5233. 1,
  5234. "b"
  5235. ]
  5236. }
  5237. }
  5238. },
  5239. "expr2": {
  5240. "Literal": [
  5241. {
  5242. "Ok": {
  5243. "data": [
  5244. 19,
  5245. 1,
  5246. 49
  5247. ]
  5248. }
  5249. },
  5250. {
  5251. "scalar_type": "String",
  5252. "nullable": false
  5253. }
  5254. ]
  5255. }
  5256. }
  5257. },
  5258. {
  5259. "Literal": [
  5260. {
  5261. "Ok": {
  5262. "data": [
  5263. 19,
  5264. 1,
  5265. 44
  5266. ]
  5267. }
  5268. },
  5269. {
  5270. "scalar_type": "String",
  5271. "nullable": false
  5272. }
  5273. ]
  5274. }
  5275. ]
  5276. }
  5277. }
  5278. ]
  5279. }
  5280. },
  5281. "distinct": false
  5282. }
  5283. ],
  5284. [
  5285. 5,
  5286. {
  5287. "func": {
  5288. "StringAgg": {
  5289. "order_by": []
  5290. }
  5291. },
  5292. "expr": {
  5293. "CallVariadic": {
  5294. "func": {
  5295. "RecordCreate": {
  5296. "field_names": [
  5297. ""
  5298. ]
  5299. }
  5300. },
  5301. "exprs": [
  5302. {
  5303. "CallVariadic": {
  5304. "func": {
  5305. "RecordCreate": {
  5306. "field_names": [
  5307. "value",
  5308. "sep"
  5309. ]
  5310. }
  5311. },
  5312. "exprs": [
  5313. {
  5314. "CallBinary": {
  5315. "func": "TextConcat",
  5316. "expr1": {
  5317. "CallUnary": {
  5318. "func": {
  5319. "CastInt32ToString": null
  5320. },
  5321. "expr": {
  5322. "Column": [
  5323. 1,
  5324. "b"
  5325. ]
  5326. }
  5327. }
  5328. },
  5329. "expr2": {
  5330. "Literal": [
  5331. {
  5332. "Ok": {
  5333. "data": [
  5334. 19,
  5335. 1,
  5336. 50
  5337. ]
  5338. }
  5339. },
  5340. {
  5341. "scalar_type": "String",
  5342. "nullable": false
  5343. }
  5344. ]
  5345. }
  5346. }
  5347. },
  5348. {
  5349. "Literal": [
  5350. {
  5351. "Ok": {
  5352. "data": [
  5353. 19,
  5354. 1,
  5355. 44
  5356. ]
  5357. }
  5358. },
  5359. {
  5360. "scalar_type": "String",
  5361. "nullable": false
  5362. }
  5363. ]
  5364. }
  5365. ]
  5366. }
  5367. }
  5368. ]
  5369. }
  5370. },
  5371. "distinct": false
  5372. }
  5373. ]
  5374. ]
  5375. },
  5376. "aggregate_types": [
  5377. "Accumulable",
  5378. "Basic",
  5379. "Hierarchical",
  5380. "Hierarchical",
  5381. "Accumulable",
  5382. "Basic"
  5383. ]
  5384. }
  5385. },
  5386. "input_key": [
  5387. {
  5388. "Column": [
  5389. 0,
  5390. "a"
  5391. ]
  5392. }
  5393. ],
  5394. "mfp_after": {
  5395. "expressions": [],
  5396. "predicates": [],
  5397. "projection": [
  5398. 0,
  5399. 1,
  5400. 2,
  5401. 3,
  5402. 4,
  5403. 5,
  5404. 6
  5405. ],
  5406. "input_arity": 7
  5407. }
  5408. }
  5409. }
  5410. }
  5411. }
  5412. ],
  5413. "sources": []
  5414. }
  5415. EOF
  5416. # Test Reduce::Collated (global aggregate).
  5417. query T multiline
  5418. EXPLAIN PHYSICAL PLAN AS JSON FOR
  5419. MATERIALIZED VIEW collated_global_mv
  5420. ----
  5421. {
  5422. "plans": [
  5423. {
  5424. "id": "materialize.public.collated_global_mv",
  5425. "plan": {
  5426. "lir_id": 11,
  5427. "node": {
  5428. "Let": {
  5429. "id": 0,
  5430. "value": {
  5431. "lir_id": 2,
  5432. "node": {
  5433. "Reduce": {
  5434. "input": {
  5435. "lir_id": 1,
  5436. "node": {
  5437. "Get": {
  5438. "id": {
  5439. "Global": {
  5440. "User": 1
  5441. }
  5442. },
  5443. "keys": {
  5444. "raw": false,
  5445. "arranged": [
  5446. [
  5447. [
  5448. {
  5449. "Column": [
  5450. 0,
  5451. "a"
  5452. ]
  5453. }
  5454. ],
  5455. [
  5456. 0,
  5457. 1
  5458. ],
  5459. [
  5460. 1
  5461. ]
  5462. ]
  5463. ],
  5464. "types": [
  5465. {
  5466. "scalar_type": "Int32",
  5467. "nullable": true
  5468. },
  5469. {
  5470. "scalar_type": "Int32",
  5471. "nullable": true
  5472. }
  5473. ]
  5474. },
  5475. "plan": {
  5476. "Arrangement": [
  5477. [
  5478. {
  5479. "Column": [
  5480. 0,
  5481. "a"
  5482. ]
  5483. }
  5484. ],
  5485. null,
  5486. {
  5487. "expressions": [],
  5488. "predicates": [],
  5489. "projection": [
  5490. 1
  5491. ],
  5492. "input_arity": 2
  5493. }
  5494. ]
  5495. }
  5496. }
  5497. }
  5498. },
  5499. "key_val_plan": {
  5500. "key_plan": {
  5501. "mfp": {
  5502. "expressions": [],
  5503. "predicates": [],
  5504. "projection": [],
  5505. "input_arity": 1
  5506. }
  5507. },
  5508. "val_plan": {
  5509. "mfp": {
  5510. "expressions": [
  5511. {
  5512. "CallUnary": {
  5513. "func": {
  5514. "CastInt32ToString": null
  5515. },
  5516. "expr": {
  5517. "Column": [
  5518. 0,
  5519. "b"
  5520. ]
  5521. }
  5522. }
  5523. },
  5524. {
  5525. "CallVariadic": {
  5526. "func": {
  5527. "RecordCreate": {
  5528. "field_names": [
  5529. ""
  5530. ]
  5531. }
  5532. },
  5533. "exprs": [
  5534. {
  5535. "CallVariadic": {
  5536. "func": {
  5537. "RecordCreate": {
  5538. "field_names": [
  5539. "value",
  5540. "sep"
  5541. ]
  5542. }
  5543. },
  5544. "exprs": [
  5545. {
  5546. "CallBinary": {
  5547. "func": "TextConcat",
  5548. "expr1": {
  5549. "Column": [
  5550. 1,
  5551. null
  5552. ]
  5553. },
  5554. "expr2": {
  5555. "Literal": [
  5556. {
  5557. "Ok": {
  5558. "data": [
  5559. 19,
  5560. 1,
  5561. 49
  5562. ]
  5563. }
  5564. },
  5565. {
  5566. "scalar_type": "String",
  5567. "nullable": false
  5568. }
  5569. ]
  5570. }
  5571. }
  5572. },
  5573. {
  5574. "Literal": [
  5575. {
  5576. "Ok": {
  5577. "data": [
  5578. 19,
  5579. 1,
  5580. 44
  5581. ]
  5582. }
  5583. },
  5584. {
  5585. "scalar_type": "String",
  5586. "nullable": false
  5587. }
  5588. ]
  5589. }
  5590. ]
  5591. }
  5592. }
  5593. ]
  5594. }
  5595. },
  5596. {
  5597. "CallVariadic": {
  5598. "func": {
  5599. "RecordCreate": {
  5600. "field_names": [
  5601. ""
  5602. ]
  5603. }
  5604. },
  5605. "exprs": [
  5606. {
  5607. "CallVariadic": {
  5608. "func": {
  5609. "RecordCreate": {
  5610. "field_names": [
  5611. "value",
  5612. "sep"
  5613. ]
  5614. }
  5615. },
  5616. "exprs": [
  5617. {
  5618. "CallBinary": {
  5619. "func": "TextConcat",
  5620. "expr1": {
  5621. "Column": [
  5622. 1,
  5623. null
  5624. ]
  5625. },
  5626. "expr2": {
  5627. "Literal": [
  5628. {
  5629. "Ok": {
  5630. "data": [
  5631. 19,
  5632. 1,
  5633. 50
  5634. ]
  5635. }
  5636. },
  5637. {
  5638. "scalar_type": "String",
  5639. "nullable": false
  5640. }
  5641. ]
  5642. }
  5643. }
  5644. },
  5645. {
  5646. "Literal": [
  5647. {
  5648. "Ok": {
  5649. "data": [
  5650. 19,
  5651. 1,
  5652. 44
  5653. ]
  5654. }
  5655. },
  5656. {
  5657. "scalar_type": "String",
  5658. "nullable": false
  5659. }
  5660. ]
  5661. }
  5662. ]
  5663. }
  5664. }
  5665. ]
  5666. }
  5667. }
  5668. ],
  5669. "predicates": [],
  5670. "projection": [
  5671. 0,
  5672. 2,
  5673. 0,
  5674. 0,
  5675. 0,
  5676. 3
  5677. ],
  5678. "input_arity": 1
  5679. }
  5680. }
  5681. },
  5682. "plan": {
  5683. "Collation": {
  5684. "accumulable": {
  5685. "full_aggrs": [
  5686. {
  5687. "func": "Count",
  5688. "expr": {
  5689. "Column": [
  5690. 0,
  5691. "b"
  5692. ]
  5693. },
  5694. "distinct": true
  5695. },
  5696. {
  5697. "func": "SumInt32",
  5698. "expr": {
  5699. "Column": [
  5700. 0,
  5701. "b"
  5702. ]
  5703. },
  5704. "distinct": false
  5705. }
  5706. ],
  5707. "simple_aggrs": [
  5708. [
  5709. 1,
  5710. 4,
  5711. {
  5712. "func": "SumInt32",
  5713. "expr": {
  5714. "Column": [
  5715. 0,
  5716. "b"
  5717. ]
  5718. },
  5719. "distinct": false
  5720. }
  5721. ]
  5722. ],
  5723. "distinct_aggrs": [
  5724. [
  5725. 0,
  5726. 0,
  5727. {
  5728. "func": "Count",
  5729. "expr": {
  5730. "Column": [
  5731. 0,
  5732. "b"
  5733. ]
  5734. },
  5735. "distinct": true
  5736. }
  5737. ]
  5738. ]
  5739. },
  5740. "hierarchical": {
  5741. "Bucketed": {
  5742. "aggr_funcs": [
  5743. "MinInt32",
  5744. "MaxInt32"
  5745. ],
  5746. "skips": [
  5747. 2,
  5748. 0
  5749. ],
  5750. "buckets": [
  5751. 268435456,
  5752. 16777216,
  5753. 1048576,
  5754. 65536,
  5755. 4096,
  5756. 256,
  5757. 16
  5758. ]
  5759. }
  5760. },
  5761. "basic": {
  5762. "Multiple": [
  5763. [
  5764. 1,
  5765. {
  5766. "func": {
  5767. "StringAgg": {
  5768. "order_by": []
  5769. }
  5770. },
  5771. "expr": {
  5772. "CallVariadic": {
  5773. "func": {
  5774. "RecordCreate": {
  5775. "field_names": [
  5776. ""
  5777. ]
  5778. }
  5779. },
  5780. "exprs": [
  5781. {
  5782. "CallVariadic": {
  5783. "func": {
  5784. "RecordCreate": {
  5785. "field_names": [
  5786. "value",
  5787. "sep"
  5788. ]
  5789. }
  5790. },
  5791. "exprs": [
  5792. {
  5793. "CallBinary": {
  5794. "func": "TextConcat",
  5795. "expr1": {
  5796. "CallUnary": {
  5797. "func": {
  5798. "CastInt32ToString": null
  5799. },
  5800. "expr": {
  5801. "Column": [
  5802. 0,
  5803. "b"
  5804. ]
  5805. }
  5806. }
  5807. },
  5808. "expr2": {
  5809. "Literal": [
  5810. {
  5811. "Ok": {
  5812. "data": [
  5813. 19,
  5814. 1,
  5815. 49
  5816. ]
  5817. }
  5818. },
  5819. {
  5820. "scalar_type": "String",
  5821. "nullable": false
  5822. }
  5823. ]
  5824. }
  5825. }
  5826. },
  5827. {
  5828. "Literal": [
  5829. {
  5830. "Ok": {
  5831. "data": [
  5832. 19,
  5833. 1,
  5834. 44
  5835. ]
  5836. }
  5837. },
  5838. {
  5839. "scalar_type": "String",
  5840. "nullable": false
  5841. }
  5842. ]
  5843. }
  5844. ]
  5845. }
  5846. }
  5847. ]
  5848. }
  5849. },
  5850. "distinct": false
  5851. }
  5852. ],
  5853. [
  5854. 5,
  5855. {
  5856. "func": {
  5857. "StringAgg": {
  5858. "order_by": []
  5859. }
  5860. },
  5861. "expr": {
  5862. "CallVariadic": {
  5863. "func": {
  5864. "RecordCreate": {
  5865. "field_names": [
  5866. ""
  5867. ]
  5868. }
  5869. },
  5870. "exprs": [
  5871. {
  5872. "CallVariadic": {
  5873. "func": {
  5874. "RecordCreate": {
  5875. "field_names": [
  5876. "value",
  5877. "sep"
  5878. ]
  5879. }
  5880. },
  5881. "exprs": [
  5882. {
  5883. "CallBinary": {
  5884. "func": "TextConcat",
  5885. "expr1": {
  5886. "CallUnary": {
  5887. "func": {
  5888. "CastInt32ToString": null
  5889. },
  5890. "expr": {
  5891. "Column": [
  5892. 0,
  5893. "b"
  5894. ]
  5895. }
  5896. }
  5897. },
  5898. "expr2": {
  5899. "Literal": [
  5900. {
  5901. "Ok": {
  5902. "data": [
  5903. 19,
  5904. 1,
  5905. 50
  5906. ]
  5907. }
  5908. },
  5909. {
  5910. "scalar_type": "String",
  5911. "nullable": false
  5912. }
  5913. ]
  5914. }
  5915. }
  5916. },
  5917. {
  5918. "Literal": [
  5919. {
  5920. "Ok": {
  5921. "data": [
  5922. 19,
  5923. 1,
  5924. 44
  5925. ]
  5926. }
  5927. },
  5928. {
  5929. "scalar_type": "String",
  5930. "nullable": false
  5931. }
  5932. ]
  5933. }
  5934. ]
  5935. }
  5936. }
  5937. ]
  5938. }
  5939. },
  5940. "distinct": false
  5941. }
  5942. ]
  5943. ]
  5944. },
  5945. "aggregate_types": [
  5946. "Accumulable",
  5947. "Basic",
  5948. "Hierarchical",
  5949. "Hierarchical",
  5950. "Accumulable",
  5951. "Basic"
  5952. ]
  5953. }
  5954. },
  5955. "input_key": null,
  5956. "mfp_after": {
  5957. "expressions": [],
  5958. "predicates": [],
  5959. "projection": [
  5960. 0,
  5961. 1,
  5962. 2,
  5963. 3,
  5964. 4,
  5965. 5
  5966. ],
  5967. "input_arity": 6
  5968. }
  5969. }
  5970. }
  5971. },
  5972. "body": {
  5973. "lir_id": 10,
  5974. "node": {
  5975. "Union": {
  5976. "inputs": [
  5977. {
  5978. "lir_id": 9,
  5979. "node": {
  5980. "ArrangeBy": {
  5981. "input": {
  5982. "lir_id": 3,
  5983. "node": {
  5984. "Get": {
  5985. "id": {
  5986. "Local": 0
  5987. },
  5988. "keys": {
  5989. "raw": false,
  5990. "arranged": [
  5991. [
  5992. [],
  5993. [
  5994. 0,
  5995. 1,
  5996. 2,
  5997. 3,
  5998. 4,
  5999. 5
  6000. ],
  6001. [
  6002. 0,
  6003. 1,
  6004. 2,
  6005. 3,
  6006. 4,
  6007. 5
  6008. ]
  6009. ]
  6010. ],
  6011. "types": null
  6012. },
  6013. "plan": "PassArrangements"
  6014. }
  6015. }
  6016. },
  6017. "forms": {
  6018. "raw": true,
  6019. "arranged": [],
  6020. "types": null
  6021. },
  6022. "input_key": [],
  6023. "input_mfp": {
  6024. "expressions": [],
  6025. "predicates": [],
  6026. "projection": [
  6027. 0,
  6028. 1,
  6029. 2,
  6030. 3,
  6031. 4,
  6032. 5
  6033. ],
  6034. "input_arity": 6
  6035. }
  6036. }
  6037. }
  6038. },
  6039. {
  6040. "lir_id": 8,
  6041. "node": {
  6042. "Mfp": {
  6043. "input": {
  6044. "lir_id": 7,
  6045. "node": {
  6046. "Union": {
  6047. "inputs": [
  6048. {
  6049. "lir_id": 5,
  6050. "node": {
  6051. "Negate": {
  6052. "input": {
  6053. "lir_id": 4,
  6054. "node": {
  6055. "Get": {
  6056. "id": {
  6057. "Local": 0
  6058. },
  6059. "keys": {
  6060. "raw": false,
  6061. "arranged": [
  6062. [
  6063. [],
  6064. [
  6065. 0,
  6066. 1,
  6067. 2,
  6068. 3,
  6069. 4,
  6070. 5
  6071. ],
  6072. [
  6073. 0,
  6074. 1,
  6075. 2,
  6076. 3,
  6077. 4,
  6078. 5
  6079. ]
  6080. ]
  6081. ],
  6082. "types": null
  6083. },
  6084. "plan": {
  6085. "Arrangement": [
  6086. [],
  6087. null,
  6088. {
  6089. "expressions": [],
  6090. "predicates": [],
  6091. "projection": [],
  6092. "input_arity": 6
  6093. }
  6094. ]
  6095. }
  6096. }
  6097. }
  6098. }
  6099. }
  6100. }
  6101. },
  6102. {
  6103. "lir_id": 6,
  6104. "node": {
  6105. "Constant": {
  6106. "rows": {
  6107. "Ok": [
  6108. [
  6109. {
  6110. "data": []
  6111. },
  6112. 0,
  6113. 1
  6114. ]
  6115. ]
  6116. }
  6117. }
  6118. }
  6119. }
  6120. ],
  6121. "consolidate_output": true
  6122. }
  6123. }
  6124. },
  6125. "mfp": {
  6126. "expressions": [
  6127. {
  6128. "Literal": [
  6129. {
  6130. "Ok": {
  6131. "data": [
  6132. 49
  6133. ]
  6134. }
  6135. },
  6136. {
  6137. "scalar_type": "Int64",
  6138. "nullable": false
  6139. }
  6140. ]
  6141. },
  6142. {
  6143. "Literal": [
  6144. {
  6145. "Ok": {
  6146. "data": [
  6147. 0
  6148. ]
  6149. }
  6150. },
  6151. {
  6152. "scalar_type": "String",
  6153. "nullable": true
  6154. }
  6155. ]
  6156. },
  6157. {
  6158. "Literal": [
  6159. {
  6160. "Ok": {
  6161. "data": [
  6162. 0
  6163. ]
  6164. }
  6165. },
  6166. {
  6167. "scalar_type": "Int32",
  6168. "nullable": true
  6169. }
  6170. ]
  6171. },
  6172. {
  6173. "Literal": [
  6174. {
  6175. "Ok": {
  6176. "data": [
  6177. 0
  6178. ]
  6179. }
  6180. },
  6181. {
  6182. "scalar_type": "Int32",
  6183. "nullable": true
  6184. }
  6185. ]
  6186. },
  6187. {
  6188. "Literal": [
  6189. {
  6190. "Ok": {
  6191. "data": [
  6192. 0
  6193. ]
  6194. }
  6195. },
  6196. {
  6197. "scalar_type": "Int64",
  6198. "nullable": true
  6199. }
  6200. ]
  6201. },
  6202. {
  6203. "Literal": [
  6204. {
  6205. "Ok": {
  6206. "data": [
  6207. 0
  6208. ]
  6209. }
  6210. },
  6211. {
  6212. "scalar_type": "String",
  6213. "nullable": true
  6214. }
  6215. ]
  6216. }
  6217. ],
  6218. "predicates": [],
  6219. "projection": [
  6220. 0,
  6221. 1,
  6222. 2,
  6223. 3,
  6224. 4,
  6225. 5
  6226. ],
  6227. "input_arity": 0
  6228. },
  6229. "input_key_val": null
  6230. }
  6231. }
  6232. }
  6233. ],
  6234. "consolidate_output": false
  6235. }
  6236. }
  6237. }
  6238. }
  6239. }
  6240. }
  6241. }
  6242. ],
  6243. "sources": []
  6244. }
  6245. EOF
  6246. # Test Reduce::Collated (global aggregate, one-shot).
  6247. query T multiline
  6248. EXPLAIN PHYSICAL PLAN AS JSON FOR
  6249. SELECT * FROM collated_global
  6250. ----
  6251. {
  6252. "plans": [
  6253. {
  6254. "id": "Explained Query",
  6255. "plan": {
  6256. "lir_id": 11,
  6257. "node": {
  6258. "Let": {
  6259. "id": 0,
  6260. "value": {
  6261. "lir_id": 2,
  6262. "node": {
  6263. "Reduce": {
  6264. "input": {
  6265. "lir_id": 1,
  6266. "node": {
  6267. "Get": {
  6268. "id": {
  6269. "Global": {
  6270. "User": 1
  6271. }
  6272. },
  6273. "keys": {
  6274. "raw": false,
  6275. "arranged": [
  6276. [
  6277. [
  6278. {
  6279. "Column": [
  6280. 0,
  6281. "a"
  6282. ]
  6283. }
  6284. ],
  6285. [
  6286. 0,
  6287. 1
  6288. ],
  6289. [
  6290. 1
  6291. ]
  6292. ]
  6293. ],
  6294. "types": [
  6295. {
  6296. "scalar_type": "Int32",
  6297. "nullable": true
  6298. },
  6299. {
  6300. "scalar_type": "Int32",
  6301. "nullable": true
  6302. }
  6303. ]
  6304. },
  6305. "plan": {
  6306. "Arrangement": [
  6307. [
  6308. {
  6309. "Column": [
  6310. 0,
  6311. "a"
  6312. ]
  6313. }
  6314. ],
  6315. null,
  6316. {
  6317. "expressions": [],
  6318. "predicates": [],
  6319. "projection": [
  6320. 1
  6321. ],
  6322. "input_arity": 2
  6323. }
  6324. ]
  6325. }
  6326. }
  6327. }
  6328. },
  6329. "key_val_plan": {
  6330. "key_plan": {
  6331. "mfp": {
  6332. "expressions": [],
  6333. "predicates": [],
  6334. "projection": [],
  6335. "input_arity": 1
  6336. }
  6337. },
  6338. "val_plan": {
  6339. "mfp": {
  6340. "expressions": [
  6341. {
  6342. "CallUnary": {
  6343. "func": {
  6344. "CastInt32ToString": null
  6345. },
  6346. "expr": {
  6347. "Column": [
  6348. 0,
  6349. "b"
  6350. ]
  6351. }
  6352. }
  6353. },
  6354. {
  6355. "CallVariadic": {
  6356. "func": {
  6357. "RecordCreate": {
  6358. "field_names": [
  6359. ""
  6360. ]
  6361. }
  6362. },
  6363. "exprs": [
  6364. {
  6365. "CallVariadic": {
  6366. "func": {
  6367. "RecordCreate": {
  6368. "field_names": [
  6369. "value",
  6370. "sep"
  6371. ]
  6372. }
  6373. },
  6374. "exprs": [
  6375. {
  6376. "CallBinary": {
  6377. "func": "TextConcat",
  6378. "expr1": {
  6379. "Column": [
  6380. 1,
  6381. null
  6382. ]
  6383. },
  6384. "expr2": {
  6385. "Literal": [
  6386. {
  6387. "Ok": {
  6388. "data": [
  6389. 19,
  6390. 1,
  6391. 49
  6392. ]
  6393. }
  6394. },
  6395. {
  6396. "scalar_type": "String",
  6397. "nullable": false
  6398. }
  6399. ]
  6400. }
  6401. }
  6402. },
  6403. {
  6404. "Literal": [
  6405. {
  6406. "Ok": {
  6407. "data": [
  6408. 19,
  6409. 1,
  6410. 44
  6411. ]
  6412. }
  6413. },
  6414. {
  6415. "scalar_type": "String",
  6416. "nullable": false
  6417. }
  6418. ]
  6419. }
  6420. ]
  6421. }
  6422. }
  6423. ]
  6424. }
  6425. },
  6426. {
  6427. "CallVariadic": {
  6428. "func": {
  6429. "RecordCreate": {
  6430. "field_names": [
  6431. ""
  6432. ]
  6433. }
  6434. },
  6435. "exprs": [
  6436. {
  6437. "CallVariadic": {
  6438. "func": {
  6439. "RecordCreate": {
  6440. "field_names": [
  6441. "value",
  6442. "sep"
  6443. ]
  6444. }
  6445. },
  6446. "exprs": [
  6447. {
  6448. "CallBinary": {
  6449. "func": "TextConcat",
  6450. "expr1": {
  6451. "Column": [
  6452. 1,
  6453. null
  6454. ]
  6455. },
  6456. "expr2": {
  6457. "Literal": [
  6458. {
  6459. "Ok": {
  6460. "data": [
  6461. 19,
  6462. 1,
  6463. 50
  6464. ]
  6465. }
  6466. },
  6467. {
  6468. "scalar_type": "String",
  6469. "nullable": false
  6470. }
  6471. ]
  6472. }
  6473. }
  6474. },
  6475. {
  6476. "Literal": [
  6477. {
  6478. "Ok": {
  6479. "data": [
  6480. 19,
  6481. 1,
  6482. 44
  6483. ]
  6484. }
  6485. },
  6486. {
  6487. "scalar_type": "String",
  6488. "nullable": false
  6489. }
  6490. ]
  6491. }
  6492. ]
  6493. }
  6494. }
  6495. ]
  6496. }
  6497. }
  6498. ],
  6499. "predicates": [],
  6500. "projection": [
  6501. 0,
  6502. 2,
  6503. 0,
  6504. 0,
  6505. 0,
  6506. 3
  6507. ],
  6508. "input_arity": 1
  6509. }
  6510. }
  6511. },
  6512. "plan": {
  6513. "Collation": {
  6514. "accumulable": {
  6515. "full_aggrs": [
  6516. {
  6517. "func": "Count",
  6518. "expr": {
  6519. "Column": [
  6520. 0,
  6521. "b"
  6522. ]
  6523. },
  6524. "distinct": true
  6525. },
  6526. {
  6527. "func": "SumInt32",
  6528. "expr": {
  6529. "Column": [
  6530. 0,
  6531. "b"
  6532. ]
  6533. },
  6534. "distinct": false
  6535. }
  6536. ],
  6537. "simple_aggrs": [
  6538. [
  6539. 1,
  6540. 4,
  6541. {
  6542. "func": "SumInt32",
  6543. "expr": {
  6544. "Column": [
  6545. 0,
  6546. "b"
  6547. ]
  6548. },
  6549. "distinct": false
  6550. }
  6551. ]
  6552. ],
  6553. "distinct_aggrs": [
  6554. [
  6555. 0,
  6556. 0,
  6557. {
  6558. "func": "Count",
  6559. "expr": {
  6560. "Column": [
  6561. 0,
  6562. "b"
  6563. ]
  6564. },
  6565. "distinct": true
  6566. }
  6567. ]
  6568. ]
  6569. },
  6570. "hierarchical": {
  6571. "Monotonic": {
  6572. "aggr_funcs": [
  6573. "MinInt32",
  6574. "MaxInt32"
  6575. ],
  6576. "skips": [
  6577. 2,
  6578. 0
  6579. ],
  6580. "must_consolidate": true
  6581. }
  6582. },
  6583. "basic": {
  6584. "Multiple": [
  6585. [
  6586. 1,
  6587. {
  6588. "func": {
  6589. "StringAgg": {
  6590. "order_by": []
  6591. }
  6592. },
  6593. "expr": {
  6594. "CallVariadic": {
  6595. "func": {
  6596. "RecordCreate": {
  6597. "field_names": [
  6598. ""
  6599. ]
  6600. }
  6601. },
  6602. "exprs": [
  6603. {
  6604. "CallVariadic": {
  6605. "func": {
  6606. "RecordCreate": {
  6607. "field_names": [
  6608. "value",
  6609. "sep"
  6610. ]
  6611. }
  6612. },
  6613. "exprs": [
  6614. {
  6615. "CallBinary": {
  6616. "func": "TextConcat",
  6617. "expr1": {
  6618. "CallUnary": {
  6619. "func": {
  6620. "CastInt32ToString": null
  6621. },
  6622. "expr": {
  6623. "Column": [
  6624. 0,
  6625. "b"
  6626. ]
  6627. }
  6628. }
  6629. },
  6630. "expr2": {
  6631. "Literal": [
  6632. {
  6633. "Ok": {
  6634. "data": [
  6635. 19,
  6636. 1,
  6637. 49
  6638. ]
  6639. }
  6640. },
  6641. {
  6642. "scalar_type": "String",
  6643. "nullable": false
  6644. }
  6645. ]
  6646. }
  6647. }
  6648. },
  6649. {
  6650. "Literal": [
  6651. {
  6652. "Ok": {
  6653. "data": [
  6654. 19,
  6655. 1,
  6656. 44
  6657. ]
  6658. }
  6659. },
  6660. {
  6661. "scalar_type": "String",
  6662. "nullable": false
  6663. }
  6664. ]
  6665. }
  6666. ]
  6667. }
  6668. }
  6669. ]
  6670. }
  6671. },
  6672. "distinct": false
  6673. }
  6674. ],
  6675. [
  6676. 5,
  6677. {
  6678. "func": {
  6679. "StringAgg": {
  6680. "order_by": []
  6681. }
  6682. },
  6683. "expr": {
  6684. "CallVariadic": {
  6685. "func": {
  6686. "RecordCreate": {
  6687. "field_names": [
  6688. ""
  6689. ]
  6690. }
  6691. },
  6692. "exprs": [
  6693. {
  6694. "CallVariadic": {
  6695. "func": {
  6696. "RecordCreate": {
  6697. "field_names": [
  6698. "value",
  6699. "sep"
  6700. ]
  6701. }
  6702. },
  6703. "exprs": [
  6704. {
  6705. "CallBinary": {
  6706. "func": "TextConcat",
  6707. "expr1": {
  6708. "CallUnary": {
  6709. "func": {
  6710. "CastInt32ToString": null
  6711. },
  6712. "expr": {
  6713. "Column": [
  6714. 0,
  6715. "b"
  6716. ]
  6717. }
  6718. }
  6719. },
  6720. "expr2": {
  6721. "Literal": [
  6722. {
  6723. "Ok": {
  6724. "data": [
  6725. 19,
  6726. 1,
  6727. 50
  6728. ]
  6729. }
  6730. },
  6731. {
  6732. "scalar_type": "String",
  6733. "nullable": false
  6734. }
  6735. ]
  6736. }
  6737. }
  6738. },
  6739. {
  6740. "Literal": [
  6741. {
  6742. "Ok": {
  6743. "data": [
  6744. 19,
  6745. 1,
  6746. 44
  6747. ]
  6748. }
  6749. },
  6750. {
  6751. "scalar_type": "String",
  6752. "nullable": false
  6753. }
  6754. ]
  6755. }
  6756. ]
  6757. }
  6758. }
  6759. ]
  6760. }
  6761. },
  6762. "distinct": false
  6763. }
  6764. ]
  6765. ]
  6766. },
  6767. "aggregate_types": [
  6768. "Accumulable",
  6769. "Basic",
  6770. "Hierarchical",
  6771. "Hierarchical",
  6772. "Accumulable",
  6773. "Basic"
  6774. ]
  6775. }
  6776. },
  6777. "input_key": null,
  6778. "mfp_after": {
  6779. "expressions": [],
  6780. "predicates": [],
  6781. "projection": [
  6782. 0,
  6783. 1,
  6784. 2,
  6785. 3,
  6786. 4,
  6787. 5
  6788. ],
  6789. "input_arity": 6
  6790. }
  6791. }
  6792. }
  6793. },
  6794. "body": {
  6795. "lir_id": 10,
  6796. "node": {
  6797. "Union": {
  6798. "inputs": [
  6799. {
  6800. "lir_id": 9,
  6801. "node": {
  6802. "ArrangeBy": {
  6803. "input": {
  6804. "lir_id": 3,
  6805. "node": {
  6806. "Get": {
  6807. "id": {
  6808. "Local": 0
  6809. },
  6810. "keys": {
  6811. "raw": false,
  6812. "arranged": [
  6813. [
  6814. [],
  6815. [
  6816. 0,
  6817. 1,
  6818. 2,
  6819. 3,
  6820. 4,
  6821. 5
  6822. ],
  6823. [
  6824. 0,
  6825. 1,
  6826. 2,
  6827. 3,
  6828. 4,
  6829. 5
  6830. ]
  6831. ]
  6832. ],
  6833. "types": null
  6834. },
  6835. "plan": "PassArrangements"
  6836. }
  6837. }
  6838. },
  6839. "forms": {
  6840. "raw": true,
  6841. "arranged": [],
  6842. "types": null
  6843. },
  6844. "input_key": [],
  6845. "input_mfp": {
  6846. "expressions": [],
  6847. "predicates": [],
  6848. "projection": [
  6849. 0,
  6850. 1,
  6851. 2,
  6852. 3,
  6853. 4,
  6854. 5
  6855. ],
  6856. "input_arity": 6
  6857. }
  6858. }
  6859. }
  6860. },
  6861. {
  6862. "lir_id": 8,
  6863. "node": {
  6864. "Mfp": {
  6865. "input": {
  6866. "lir_id": 7,
  6867. "node": {
  6868. "Union": {
  6869. "inputs": [
  6870. {
  6871. "lir_id": 5,
  6872. "node": {
  6873. "Negate": {
  6874. "input": {
  6875. "lir_id": 4,
  6876. "node": {
  6877. "Get": {
  6878. "id": {
  6879. "Local": 0
  6880. },
  6881. "keys": {
  6882. "raw": false,
  6883. "arranged": [
  6884. [
  6885. [],
  6886. [
  6887. 0,
  6888. 1,
  6889. 2,
  6890. 3,
  6891. 4,
  6892. 5
  6893. ],
  6894. [
  6895. 0,
  6896. 1,
  6897. 2,
  6898. 3,
  6899. 4,
  6900. 5
  6901. ]
  6902. ]
  6903. ],
  6904. "types": null
  6905. },
  6906. "plan": {
  6907. "Arrangement": [
  6908. [],
  6909. null,
  6910. {
  6911. "expressions": [],
  6912. "predicates": [],
  6913. "projection": [],
  6914. "input_arity": 6
  6915. }
  6916. ]
  6917. }
  6918. }
  6919. }
  6920. }
  6921. }
  6922. }
  6923. },
  6924. {
  6925. "lir_id": 6,
  6926. "node": {
  6927. "Constant": {
  6928. "rows": {
  6929. "Ok": [
  6930. [
  6931. {
  6932. "data": []
  6933. },
  6934. 0,
  6935. 1
  6936. ]
  6937. ]
  6938. }
  6939. }
  6940. }
  6941. }
  6942. ],
  6943. "consolidate_output": true
  6944. }
  6945. }
  6946. },
  6947. "mfp": {
  6948. "expressions": [
  6949. {
  6950. "Literal": [
  6951. {
  6952. "Ok": {
  6953. "data": [
  6954. 49
  6955. ]
  6956. }
  6957. },
  6958. {
  6959. "scalar_type": "Int64",
  6960. "nullable": false
  6961. }
  6962. ]
  6963. },
  6964. {
  6965. "Literal": [
  6966. {
  6967. "Ok": {
  6968. "data": [
  6969. 0
  6970. ]
  6971. }
  6972. },
  6973. {
  6974. "scalar_type": "String",
  6975. "nullable": true
  6976. }
  6977. ]
  6978. },
  6979. {
  6980. "Literal": [
  6981. {
  6982. "Ok": {
  6983. "data": [
  6984. 0
  6985. ]
  6986. }
  6987. },
  6988. {
  6989. "scalar_type": "Int32",
  6990. "nullable": true
  6991. }
  6992. ]
  6993. },
  6994. {
  6995. "Literal": [
  6996. {
  6997. "Ok": {
  6998. "data": [
  6999. 0
  7000. ]
  7001. }
  7002. },
  7003. {
  7004. "scalar_type": "Int32",
  7005. "nullable": true
  7006. }
  7007. ]
  7008. },
  7009. {
  7010. "Literal": [
  7011. {
  7012. "Ok": {
  7013. "data": [
  7014. 0
  7015. ]
  7016. }
  7017. },
  7018. {
  7019. "scalar_type": "Int64",
  7020. "nullable": true
  7021. }
  7022. ]
  7023. },
  7024. {
  7025. "Literal": [
  7026. {
  7027. "Ok": {
  7028. "data": [
  7029. 0
  7030. ]
  7031. }
  7032. },
  7033. {
  7034. "scalar_type": "String",
  7035. "nullable": true
  7036. }
  7037. ]
  7038. }
  7039. ],
  7040. "predicates": [],
  7041. "projection": [
  7042. 0,
  7043. 1,
  7044. 2,
  7045. 3,
  7046. 4,
  7047. 5
  7048. ],
  7049. "input_arity": 0
  7050. },
  7051. "input_key_val": null
  7052. }
  7053. }
  7054. }
  7055. ],
  7056. "consolidate_output": false
  7057. }
  7058. }
  7059. }
  7060. }
  7061. }
  7062. }
  7063. }
  7064. ],
  7065. "sources": []
  7066. }
  7067. EOF
  7068. # Test Join::Differential (acyclic).
  7069. query T multiline
  7070. EXPLAIN PHYSICAL PLAN WITH(non negative) AS JSON FOR
  7071. SELECT b + d, c + e, a + e
  7072. FROM t, u, v
  7073. WHERE a = c AND d = e AND b + d > 42
  7074. ----
  7075. {
  7076. "plans": [
  7077. {
  7078. "id": "Explained Query",
  7079. "plan": {
  7080. "lir_id": 6,
  7081. "node": {
  7082. "Join": {
  7083. "inputs": [
  7084. {
  7085. "lir_id": 1,
  7086. "node": {
  7087. "Get": {
  7088. "id": {
  7089. "Global": {
  7090. "User": 1
  7091. }
  7092. },
  7093. "keys": {
  7094. "raw": false,
  7095. "arranged": [
  7096. [
  7097. [
  7098. {
  7099. "Column": [
  7100. 0,
  7101. "a"
  7102. ]
  7103. }
  7104. ],
  7105. [
  7106. 0,
  7107. 1
  7108. ],
  7109. [
  7110. 1
  7111. ]
  7112. ]
  7113. ],
  7114. "types": [
  7115. {
  7116. "scalar_type": "Int32",
  7117. "nullable": true
  7118. },
  7119. {
  7120. "scalar_type": "Int32",
  7121. "nullable": true
  7122. }
  7123. ]
  7124. },
  7125. "plan": "PassArrangements"
  7126. }
  7127. }
  7128. },
  7129. {
  7130. "lir_id": 3,
  7131. "node": {
  7132. "ArrangeBy": {
  7133. "input": {
  7134. "lir_id": 2,
  7135. "node": {
  7136. "Get": {
  7137. "id": {
  7138. "Global": {
  7139. "User": 2
  7140. }
  7141. },
  7142. "keys": {
  7143. "raw": true,
  7144. "arranged": [],
  7145. "types": null
  7146. },
  7147. "plan": {
  7148. "Collection": {
  7149. "expressions": [],
  7150. "predicates": [],
  7151. "projection": [
  7152. 0,
  7153. 1
  7154. ],
  7155. "input_arity": 2
  7156. }
  7157. }
  7158. }
  7159. }
  7160. },
  7161. "forms": {
  7162. "raw": true,
  7163. "arranged": [
  7164. [
  7165. [
  7166. {
  7167. "Column": [
  7168. 0,
  7169. "c"
  7170. ]
  7171. }
  7172. ],
  7173. [
  7174. 0,
  7175. 1
  7176. ],
  7177. [
  7178. 1
  7179. ]
  7180. ],
  7181. [
  7182. [
  7183. {
  7184. "Column": [
  7185. 1,
  7186. "d"
  7187. ]
  7188. }
  7189. ],
  7190. [
  7191. 1,
  7192. 0
  7193. ],
  7194. [
  7195. 0
  7196. ]
  7197. ]
  7198. ],
  7199. "types": [
  7200. {
  7201. "scalar_type": "Int32",
  7202. "nullable": false
  7203. },
  7204. {
  7205. "scalar_type": "Int32",
  7206. "nullable": false
  7207. }
  7208. ]
  7209. },
  7210. "input_key": null,
  7211. "input_mfp": {
  7212. "expressions": [],
  7213. "predicates": [],
  7214. "projection": [
  7215. 0,
  7216. 1
  7217. ],
  7218. "input_arity": 2
  7219. }
  7220. }
  7221. }
  7222. },
  7223. {
  7224. "lir_id": 5,
  7225. "node": {
  7226. "ArrangeBy": {
  7227. "input": {
  7228. "lir_id": 4,
  7229. "node": {
  7230. "Get": {
  7231. "id": {
  7232. "Global": {
  7233. "User": 3
  7234. }
  7235. },
  7236. "keys": {
  7237. "raw": true,
  7238. "arranged": [],
  7239. "types": null
  7240. },
  7241. "plan": {
  7242. "Collection": {
  7243. "expressions": [],
  7244. "predicates": [],
  7245. "projection": [
  7246. 0
  7247. ],
  7248. "input_arity": 1
  7249. }
  7250. }
  7251. }
  7252. }
  7253. },
  7254. "forms": {
  7255. "raw": true,
  7256. "arranged": [
  7257. [
  7258. [
  7259. {
  7260. "Column": [
  7261. 0,
  7262. "e"
  7263. ]
  7264. }
  7265. ],
  7266. [
  7267. 0
  7268. ],
  7269. []
  7270. ]
  7271. ],
  7272. "types": [
  7273. {
  7274. "scalar_type": "Int32",
  7275. "nullable": false
  7276. }
  7277. ]
  7278. },
  7279. "input_key": null,
  7280. "input_mfp": {
  7281. "expressions": [],
  7282. "predicates": [],
  7283. "projection": [
  7284. 0
  7285. ],
  7286. "input_arity": 1
  7287. }
  7288. }
  7289. }
  7290. }
  7291. ],
  7292. "plan": {
  7293. "Delta": {
  7294. "path_plans": [
  7295. {
  7296. "source_relation": 0,
  7297. "source_key": [
  7298. {
  7299. "Column": [
  7300. 0,
  7301. "a"
  7302. ]
  7303. }
  7304. ],
  7305. "initial_closure": {
  7306. "ready_equivalences": [],
  7307. "before": {
  7308. "mfp": {
  7309. "expressions": [],
  7310. "predicates": [],
  7311. "projection": [
  7312. 0,
  7313. 1
  7314. ],
  7315. "input_arity": 2
  7316. }
  7317. }
  7318. },
  7319. "stage_plans": [
  7320. {
  7321. "lookup_relation": 1,
  7322. "stream_key": [
  7323. {
  7324. "Column": [
  7325. 0,
  7326. "a"
  7327. ]
  7328. }
  7329. ],
  7330. "stream_thinning": [
  7331. 1
  7332. ],
  7333. "lookup_key": [
  7334. {
  7335. "Column": [
  7336. 0,
  7337. "c"
  7338. ]
  7339. }
  7340. ],
  7341. "closure": {
  7342. "ready_equivalences": [],
  7343. "before": {
  7344. "mfp": {
  7345. "expressions": [
  7346. {
  7347. "CallBinary": {
  7348. "func": "AddInt32",
  7349. "expr1": {
  7350. "Column": [
  7351. 1,
  7352. "b"
  7353. ]
  7354. },
  7355. "expr2": {
  7356. "Column": [
  7357. 2,
  7358. "d"
  7359. ]
  7360. }
  7361. }
  7362. },
  7363. {
  7364. "CallBinary": {
  7365. "func": "AddInt32",
  7366. "expr1": {
  7367. "Column": [
  7368. 0,
  7369. "a"
  7370. ]
  7371. },
  7372. "expr2": {
  7373. "Column": [
  7374. 2,
  7375. "d"
  7376. ]
  7377. }
  7378. }
  7379. }
  7380. ],
  7381. "predicates": [
  7382. [
  7383. 4,
  7384. {
  7385. "CallBinary": {
  7386. "func": "Gt",
  7387. "expr1": {
  7388. "Column": [
  7389. 3,
  7390. null
  7391. ]
  7392. },
  7393. "expr2": {
  7394. "Literal": [
  7395. {
  7396. "Ok": {
  7397. "data": [
  7398. 45,
  7399. 42
  7400. ]
  7401. }
  7402. },
  7403. {
  7404. "scalar_type": "Int32",
  7405. "nullable": false
  7406. }
  7407. ]
  7408. }
  7409. }
  7410. }
  7411. ]
  7412. ],
  7413. "projection": [
  7414. 2,
  7415. 3,
  7416. 4
  7417. ],
  7418. "input_arity": 3
  7419. }
  7420. }
  7421. }
  7422. },
  7423. {
  7424. "lookup_relation": 2,
  7425. "stream_key": [
  7426. {
  7427. "Column": [
  7428. 0,
  7429. "d"
  7430. ]
  7431. }
  7432. ],
  7433. "stream_thinning": [
  7434. 1,
  7435. 2
  7436. ],
  7437. "lookup_key": [
  7438. {
  7439. "Column": [
  7440. 0,
  7441. "e"
  7442. ]
  7443. }
  7444. ],
  7445. "closure": {
  7446. "ready_equivalences": [],
  7447. "before": {
  7448. "mfp": {
  7449. "expressions": [],
  7450. "predicates": [],
  7451. "projection": [
  7452. 1,
  7453. 2
  7454. ],
  7455. "input_arity": 3
  7456. }
  7457. }
  7458. }
  7459. }
  7460. ],
  7461. "final_closure": {
  7462. "ready_equivalences": [],
  7463. "before": {
  7464. "mfp": {
  7465. "expressions": [],
  7466. "predicates": [],
  7467. "projection": [
  7468. 0,
  7469. 1,
  7470. 1
  7471. ],
  7472. "input_arity": 2
  7473. }
  7474. }
  7475. }
  7476. },
  7477. {
  7478. "source_relation": 1,
  7479. "source_key": [
  7480. {
  7481. "Column": [
  7482. 0,
  7483. "c"
  7484. ]
  7485. }
  7486. ],
  7487. "initial_closure": {
  7488. "ready_equivalences": [],
  7489. "before": {
  7490. "mfp": {
  7491. "expressions": [],
  7492. "predicates": [],
  7493. "projection": [
  7494. 0,
  7495. 1
  7496. ],
  7497. "input_arity": 2
  7498. }
  7499. }
  7500. },
  7501. "stage_plans": [
  7502. {
  7503. "lookup_relation": 0,
  7504. "stream_key": [
  7505. {
  7506. "Column": [
  7507. 0,
  7508. "c"
  7509. ]
  7510. }
  7511. ],
  7512. "stream_thinning": [
  7513. 1
  7514. ],
  7515. "lookup_key": [
  7516. {
  7517. "Column": [
  7518. 0,
  7519. "a"
  7520. ]
  7521. }
  7522. ],
  7523. "closure": {
  7524. "ready_equivalences": [],
  7525. "before": {
  7526. "mfp": {
  7527. "expressions": [
  7528. {
  7529. "CallBinary": {
  7530. "func": "AddInt32",
  7531. "expr1": {
  7532. "Column": [
  7533. 2,
  7534. "b"
  7535. ]
  7536. },
  7537. "expr2": {
  7538. "Column": [
  7539. 1,
  7540. "d"
  7541. ]
  7542. }
  7543. }
  7544. },
  7545. {
  7546. "CallBinary": {
  7547. "func": "AddInt32",
  7548. "expr1": {
  7549. "Column": [
  7550. 0,
  7551. "a"
  7552. ]
  7553. },
  7554. "expr2": {
  7555. "Column": [
  7556. 1,
  7557. "d"
  7558. ]
  7559. }
  7560. }
  7561. }
  7562. ],
  7563. "predicates": [
  7564. [
  7565. 4,
  7566. {
  7567. "CallBinary": {
  7568. "func": "Gt",
  7569. "expr1": {
  7570. "Column": [
  7571. 3,
  7572. null
  7573. ]
  7574. },
  7575. "expr2": {
  7576. "Literal": [
  7577. {
  7578. "Ok": {
  7579. "data": [
  7580. 45,
  7581. 42
  7582. ]
  7583. }
  7584. },
  7585. {
  7586. "scalar_type": "Int32",
  7587. "nullable": false
  7588. }
  7589. ]
  7590. }
  7591. }
  7592. }
  7593. ]
  7594. ],
  7595. "projection": [
  7596. 1,
  7597. 3,
  7598. 4
  7599. ],
  7600. "input_arity": 3
  7601. }
  7602. }
  7603. }
  7604. },
  7605. {
  7606. "lookup_relation": 2,
  7607. "stream_key": [
  7608. {
  7609. "Column": [
  7610. 0,
  7611. "d"
  7612. ]
  7613. }
  7614. ],
  7615. "stream_thinning": [
  7616. 1,
  7617. 2
  7618. ],
  7619. "lookup_key": [
  7620. {
  7621. "Column": [
  7622. 0,
  7623. "e"
  7624. ]
  7625. }
  7626. ],
  7627. "closure": {
  7628. "ready_equivalences": [],
  7629. "before": {
  7630. "mfp": {
  7631. "expressions": [],
  7632. "predicates": [],
  7633. "projection": [
  7634. 1,
  7635. 2
  7636. ],
  7637. "input_arity": 3
  7638. }
  7639. }
  7640. }
  7641. }
  7642. ],
  7643. "final_closure": {
  7644. "ready_equivalences": [],
  7645. "before": {
  7646. "mfp": {
  7647. "expressions": [],
  7648. "predicates": [],
  7649. "projection": [
  7650. 0,
  7651. 1,
  7652. 1
  7653. ],
  7654. "input_arity": 2
  7655. }
  7656. }
  7657. }
  7658. },
  7659. {
  7660. "source_relation": 2,
  7661. "source_key": [
  7662. {
  7663. "Column": [
  7664. 0,
  7665. "e"
  7666. ]
  7667. }
  7668. ],
  7669. "initial_closure": {
  7670. "ready_equivalences": [],
  7671. "before": {
  7672. "mfp": {
  7673. "expressions": [],
  7674. "predicates": [],
  7675. "projection": [
  7676. 0
  7677. ],
  7678. "input_arity": 1
  7679. }
  7680. }
  7681. },
  7682. "stage_plans": [
  7683. {
  7684. "lookup_relation": 1,
  7685. "stream_key": [
  7686. {
  7687. "Column": [
  7688. 0,
  7689. "e"
  7690. ]
  7691. }
  7692. ],
  7693. "stream_thinning": [],
  7694. "lookup_key": [
  7695. {
  7696. "Column": [
  7697. 1,
  7698. "d"
  7699. ]
  7700. }
  7701. ],
  7702. "closure": {
  7703. "ready_equivalences": [],
  7704. "before": {
  7705. "mfp": {
  7706. "expressions": [],
  7707. "predicates": [],
  7708. "projection": [
  7709. 1,
  7710. 0
  7711. ],
  7712. "input_arity": 2
  7713. }
  7714. }
  7715. }
  7716. },
  7717. {
  7718. "lookup_relation": 0,
  7719. "stream_key": [
  7720. {
  7721. "Column": [
  7722. 0,
  7723. "c"
  7724. ]
  7725. }
  7726. ],
  7727. "stream_thinning": [
  7728. 1
  7729. ],
  7730. "lookup_key": [
  7731. {
  7732. "Column": [
  7733. 0,
  7734. "a"
  7735. ]
  7736. }
  7737. ],
  7738. "closure": {
  7739. "ready_equivalences": [],
  7740. "before": {
  7741. "mfp": {
  7742. "expressions": [
  7743. {
  7744. "CallBinary": {
  7745. "func": "AddInt32",
  7746. "expr1": {
  7747. "Column": [
  7748. 2,
  7749. "b"
  7750. ]
  7751. },
  7752. "expr2": {
  7753. "Column": [
  7754. 1,
  7755. "d"
  7756. ]
  7757. }
  7758. }
  7759. },
  7760. {
  7761. "CallBinary": {
  7762. "func": "AddInt32",
  7763. "expr1": {
  7764. "Column": [
  7765. 0,
  7766. "a"
  7767. ]
  7768. },
  7769. "expr2": {
  7770. "Column": [
  7771. 1,
  7772. "d"
  7773. ]
  7774. }
  7775. }
  7776. }
  7777. ],
  7778. "predicates": [
  7779. [
  7780. 4,
  7781. {
  7782. "CallBinary": {
  7783. "func": "Gt",
  7784. "expr1": {
  7785. "Column": [
  7786. 3,
  7787. null
  7788. ]
  7789. },
  7790. "expr2": {
  7791. "Literal": [
  7792. {
  7793. "Ok": {
  7794. "data": [
  7795. 45,
  7796. 42
  7797. ]
  7798. }
  7799. },
  7800. {
  7801. "scalar_type": "Int32",
  7802. "nullable": false
  7803. }
  7804. ]
  7805. }
  7806. }
  7807. }
  7808. ]
  7809. ],
  7810. "projection": [
  7811. 3,
  7812. 4
  7813. ],
  7814. "input_arity": 3
  7815. }
  7816. }
  7817. }
  7818. }
  7819. ],
  7820. "final_closure": {
  7821. "ready_equivalences": [],
  7822. "before": {
  7823. "mfp": {
  7824. "expressions": [],
  7825. "predicates": [],
  7826. "projection": [
  7827. 0,
  7828. 1,
  7829. 1
  7830. ],
  7831. "input_arity": 2
  7832. }
  7833. }
  7834. }
  7835. }
  7836. ]
  7837. }
  7838. }
  7839. }
  7840. }
  7841. }
  7842. }
  7843. ],
  7844. "sources": [
  7845. {
  7846. "id": {
  7847. "User": 2
  7848. },
  7849. "op": {
  7850. "expressions": [],
  7851. "predicates": [
  7852. [
  7853. 1,
  7854. {
  7855. "CallUnary": {
  7856. "func": {
  7857. "Not": null
  7858. },
  7859. "expr": {
  7860. "CallUnary": {
  7861. "func": {
  7862. "IsNull": null
  7863. },
  7864. "expr": {
  7865. "Column": [
  7866. 0,
  7867. "c"
  7868. ]
  7869. }
  7870. }
  7871. }
  7872. }
  7873. }
  7874. ],
  7875. [
  7876. 2,
  7877. {
  7878. "CallUnary": {
  7879. "func": {
  7880. "Not": null
  7881. },
  7882. "expr": {
  7883. "CallUnary": {
  7884. "func": {
  7885. "IsNull": null
  7886. },
  7887. "expr": {
  7888. "Column": [
  7889. 1,
  7890. "d"
  7891. ]
  7892. }
  7893. }
  7894. }
  7895. }
  7896. }
  7897. ]
  7898. ],
  7899. "projection": [
  7900. 0,
  7901. 1
  7902. ],
  7903. "input_arity": 2
  7904. }
  7905. },
  7906. {
  7907. "id": {
  7908. "User": 3
  7909. },
  7910. "op": {
  7911. "expressions": [],
  7912. "predicates": [
  7913. [
  7914. 1,
  7915. {
  7916. "CallUnary": {
  7917. "func": {
  7918. "Not": null
  7919. },
  7920. "expr": {
  7921. "CallUnary": {
  7922. "func": {
  7923. "IsNull": null
  7924. },
  7925. "expr": {
  7926. "Column": [
  7927. 0,
  7928. "e"
  7929. ]
  7930. }
  7931. }
  7932. }
  7933. }
  7934. }
  7935. ]
  7936. ],
  7937. "projection": [
  7938. 0
  7939. ],
  7940. "input_arity": 2
  7941. }
  7942. }
  7943. ]
  7944. }
  7945. EOF
  7946. # Create indexes required for differential join tests
  7947. statement ok
  7948. CREATE INDEX u_c_idx ON U(c);
  7949. statement ok
  7950. CREATE INDEX u_d_idx ON U(d);
  7951. statement ok
  7952. CREATE INDEX v_e_idx ON V(e);
  7953. # Test Join::Differential (cyclic).
  7954. query T multiline
  7955. EXPLAIN PHYSICAL PLAN WITH(non negative) AS JSON FOR
  7956. SELECT a, b, c, d, e, f
  7957. FROM t, u, v
  7958. WHERE a = c AND d = e AND f = a
  7959. ----
  7960. {
  7961. "plans": [
  7962. {
  7963. "id": "Explained Query",
  7964. "plan": {
  7965. "lir_id": 6,
  7966. "node": {
  7967. "Join": {
  7968. "inputs": [
  7969. {
  7970. "lir_id": 1,
  7971. "node": {
  7972. "Get": {
  7973. "id": {
  7974. "Global": {
  7975. "User": 1
  7976. }
  7977. },
  7978. "keys": {
  7979. "raw": false,
  7980. "arranged": [
  7981. [
  7982. [
  7983. {
  7984. "Column": [
  7985. 0,
  7986. "a"
  7987. ]
  7988. }
  7989. ],
  7990. [
  7991. 0,
  7992. 1
  7993. ],
  7994. [
  7995. 1
  7996. ]
  7997. ]
  7998. ],
  7999. "types": [
  8000. {
  8001. "scalar_type": "Int32",
  8002. "nullable": true
  8003. },
  8004. {
  8005. "scalar_type": "Int32",
  8006. "nullable": true
  8007. }
  8008. ]
  8009. },
  8010. "plan": "PassArrangements"
  8011. }
  8012. }
  8013. },
  8014. {
  8015. "lir_id": 3,
  8016. "node": {
  8017. "ArrangeBy": {
  8018. "input": {
  8019. "lir_id": 2,
  8020. "node": {
  8021. "Get": {
  8022. "id": {
  8023. "Global": {
  8024. "User": 2
  8025. }
  8026. },
  8027. "keys": {
  8028. "raw": false,
  8029. "arranged": [
  8030. [
  8031. [
  8032. {
  8033. "Column": [
  8034. 0,
  8035. "c"
  8036. ]
  8037. }
  8038. ],
  8039. [
  8040. 0,
  8041. 1
  8042. ],
  8043. [
  8044. 1
  8045. ]
  8046. ]
  8047. ],
  8048. "types": [
  8049. {
  8050. "scalar_type": "Int32",
  8051. "nullable": true
  8052. },
  8053. {
  8054. "scalar_type": "Int32",
  8055. "nullable": true
  8056. }
  8057. ]
  8058. },
  8059. "plan": {
  8060. "Arrangement": [
  8061. [
  8062. {
  8063. "Column": [
  8064. 0,
  8065. "c"
  8066. ]
  8067. }
  8068. ],
  8069. null,
  8070. {
  8071. "expressions": [],
  8072. "predicates": [
  8073. [
  8074. 1,
  8075. {
  8076. "CallUnary": {
  8077. "func": {
  8078. "Not": null
  8079. },
  8080. "expr": {
  8081. "CallUnary": {
  8082. "func": {
  8083. "IsNull": null
  8084. },
  8085. "expr": {
  8086. "Column": [
  8087. 0,
  8088. "c"
  8089. ]
  8090. }
  8091. }
  8092. }
  8093. }
  8094. }
  8095. ],
  8096. [
  8097. 2,
  8098. {
  8099. "CallUnary": {
  8100. "func": {
  8101. "Not": null
  8102. },
  8103. "expr": {
  8104. "CallUnary": {
  8105. "func": {
  8106. "IsNull": null
  8107. },
  8108. "expr": {
  8109. "Column": [
  8110. 1,
  8111. "d"
  8112. ]
  8113. }
  8114. }
  8115. }
  8116. }
  8117. }
  8118. ]
  8119. ],
  8120. "projection": [
  8121. 0,
  8122. 1
  8123. ],
  8124. "input_arity": 2
  8125. }
  8126. ]
  8127. }
  8128. }
  8129. }
  8130. },
  8131. "forms": {
  8132. "raw": true,
  8133. "arranged": [
  8134. [
  8135. [
  8136. {
  8137. "Column": [
  8138. 0,
  8139. "c"
  8140. ]
  8141. }
  8142. ],
  8143. [
  8144. 0,
  8145. 1
  8146. ],
  8147. [
  8148. 1
  8149. ]
  8150. ],
  8151. [
  8152. [
  8153. {
  8154. "Column": [
  8155. 0,
  8156. "c"
  8157. ]
  8158. },
  8159. {
  8160. "Column": [
  8161. 1,
  8162. "d"
  8163. ]
  8164. }
  8165. ],
  8166. [
  8167. 0,
  8168. 1
  8169. ],
  8170. []
  8171. ]
  8172. ],
  8173. "types": [
  8174. {
  8175. "scalar_type": "Int32",
  8176. "nullable": false
  8177. },
  8178. {
  8179. "scalar_type": "Int32",
  8180. "nullable": false
  8181. }
  8182. ]
  8183. },
  8184. "input_key": null,
  8185. "input_mfp": {
  8186. "expressions": [],
  8187. "predicates": [],
  8188. "projection": [
  8189. 0,
  8190. 1
  8191. ],
  8192. "input_arity": 2
  8193. }
  8194. }
  8195. }
  8196. },
  8197. {
  8198. "lir_id": 5,
  8199. "node": {
  8200. "ArrangeBy": {
  8201. "input": {
  8202. "lir_id": 4,
  8203. "node": {
  8204. "Get": {
  8205. "id": {
  8206. "Global": {
  8207. "User": 3
  8208. }
  8209. },
  8210. "keys": {
  8211. "raw": false,
  8212. "arranged": [
  8213. [
  8214. [
  8215. {
  8216. "Column": [
  8217. 0,
  8218. "e"
  8219. ]
  8220. }
  8221. ],
  8222. [
  8223. 0,
  8224. 1
  8225. ],
  8226. [
  8227. 1
  8228. ]
  8229. ]
  8230. ],
  8231. "types": [
  8232. {
  8233. "scalar_type": "Int32",
  8234. "nullable": true
  8235. },
  8236. {
  8237. "scalar_type": "Int32",
  8238. "nullable": true
  8239. }
  8240. ]
  8241. },
  8242. "plan": {
  8243. "Arrangement": [
  8244. [
  8245. {
  8246. "Column": [
  8247. 0,
  8248. "e"
  8249. ]
  8250. }
  8251. ],
  8252. null,
  8253. {
  8254. "expressions": [],
  8255. "predicates": [
  8256. [
  8257. 1,
  8258. {
  8259. "CallUnary": {
  8260. "func": {
  8261. "Not": null
  8262. },
  8263. "expr": {
  8264. "CallUnary": {
  8265. "func": {
  8266. "IsNull": null
  8267. },
  8268. "expr": {
  8269. "Column": [
  8270. 0,
  8271. "e"
  8272. ]
  8273. }
  8274. }
  8275. }
  8276. }
  8277. }
  8278. ],
  8279. [
  8280. 2,
  8281. {
  8282. "CallUnary": {
  8283. "func": {
  8284. "Not": null
  8285. },
  8286. "expr": {
  8287. "CallUnary": {
  8288. "func": {
  8289. "IsNull": null
  8290. },
  8291. "expr": {
  8292. "Column": [
  8293. 1,
  8294. "f"
  8295. ]
  8296. }
  8297. }
  8298. }
  8299. }
  8300. }
  8301. ]
  8302. ],
  8303. "projection": [
  8304. 0,
  8305. 1
  8306. ],
  8307. "input_arity": 2
  8308. }
  8309. ]
  8310. }
  8311. }
  8312. }
  8313. },
  8314. "forms": {
  8315. "raw": true,
  8316. "arranged": [
  8317. [
  8318. [
  8319. {
  8320. "Column": [
  8321. 0,
  8322. "e"
  8323. ]
  8324. },
  8325. {
  8326. "Column": [
  8327. 1,
  8328. "f"
  8329. ]
  8330. }
  8331. ],
  8332. [
  8333. 0,
  8334. 1
  8335. ],
  8336. []
  8337. ]
  8338. ],
  8339. "types": [
  8340. {
  8341. "scalar_type": "Int32",
  8342. "nullable": false
  8343. },
  8344. {
  8345. "scalar_type": "Int32",
  8346. "nullable": false
  8347. }
  8348. ]
  8349. },
  8350. "input_key": null,
  8351. "input_mfp": {
  8352. "expressions": [],
  8353. "predicates": [],
  8354. "projection": [
  8355. 0,
  8356. 1
  8357. ],
  8358. "input_arity": 2
  8359. }
  8360. }
  8361. }
  8362. }
  8363. ],
  8364. "plan": {
  8365. "Delta": {
  8366. "path_plans": [
  8367. {
  8368. "source_relation": 0,
  8369. "source_key": [
  8370. {
  8371. "Column": [
  8372. 0,
  8373. "a"
  8374. ]
  8375. }
  8376. ],
  8377. "initial_closure": {
  8378. "ready_equivalences": [],
  8379. "before": {
  8380. "mfp": {
  8381. "expressions": [],
  8382. "predicates": [],
  8383. "projection": [
  8384. 0,
  8385. 1
  8386. ],
  8387. "input_arity": 2
  8388. }
  8389. }
  8390. },
  8391. "stage_plans": [
  8392. {
  8393. "lookup_relation": 1,
  8394. "stream_key": [
  8395. {
  8396. "Column": [
  8397. 0,
  8398. "a"
  8399. ]
  8400. }
  8401. ],
  8402. "stream_thinning": [
  8403. 1
  8404. ],
  8405. "lookup_key": [
  8406. {
  8407. "Column": [
  8408. 0,
  8409. "c"
  8410. ]
  8411. }
  8412. ],
  8413. "closure": {
  8414. "ready_equivalences": [],
  8415. "before": {
  8416. "mfp": {
  8417. "expressions": [],
  8418. "predicates": [],
  8419. "projection": [
  8420. 0,
  8421. 1,
  8422. 2
  8423. ],
  8424. "input_arity": 3
  8425. }
  8426. }
  8427. }
  8428. },
  8429. {
  8430. "lookup_relation": 2,
  8431. "stream_key": [
  8432. {
  8433. "Column": [
  8434. 2,
  8435. "d"
  8436. ]
  8437. },
  8438. {
  8439. "Column": [
  8440. 0,
  8441. "a"
  8442. ]
  8443. }
  8444. ],
  8445. "stream_thinning": [
  8446. 1
  8447. ],
  8448. "lookup_key": [
  8449. {
  8450. "Column": [
  8451. 0,
  8452. "e"
  8453. ]
  8454. },
  8455. {
  8456. "Column": [
  8457. 1,
  8458. "f"
  8459. ]
  8460. }
  8461. ],
  8462. "closure": {
  8463. "ready_equivalences": [],
  8464. "before": {
  8465. "mfp": {
  8466. "expressions": [],
  8467. "predicates": [],
  8468. "projection": [
  8469. 1,
  8470. 2,
  8471. 0
  8472. ],
  8473. "input_arity": 3
  8474. }
  8475. }
  8476. }
  8477. }
  8478. ],
  8479. "final_closure": {
  8480. "ready_equivalences": [],
  8481. "before": {
  8482. "mfp": {
  8483. "expressions": [],
  8484. "predicates": [],
  8485. "projection": [
  8486. 0,
  8487. 1,
  8488. 0,
  8489. 2,
  8490. 2,
  8491. 0
  8492. ],
  8493. "input_arity": 3
  8494. }
  8495. }
  8496. }
  8497. },
  8498. {
  8499. "source_relation": 1,
  8500. "source_key": [
  8501. {
  8502. "Column": [
  8503. 0,
  8504. "c"
  8505. ]
  8506. }
  8507. ],
  8508. "initial_closure": {
  8509. "ready_equivalences": [],
  8510. "before": {
  8511. "mfp": {
  8512. "expressions": [],
  8513. "predicates": [],
  8514. "projection": [
  8515. 0,
  8516. 1
  8517. ],
  8518. "input_arity": 2
  8519. }
  8520. }
  8521. },
  8522. "stage_plans": [
  8523. {
  8524. "lookup_relation": 2,
  8525. "stream_key": [
  8526. {
  8527. "Column": [
  8528. 1,
  8529. "d"
  8530. ]
  8531. },
  8532. {
  8533. "Column": [
  8534. 0,
  8535. "c"
  8536. ]
  8537. }
  8538. ],
  8539. "stream_thinning": [],
  8540. "lookup_key": [
  8541. {
  8542. "Column": [
  8543. 0,
  8544. "e"
  8545. ]
  8546. },
  8547. {
  8548. "Column": [
  8549. 1,
  8550. "f"
  8551. ]
  8552. }
  8553. ],
  8554. "closure": {
  8555. "ready_equivalences": [],
  8556. "before": {
  8557. "mfp": {
  8558. "expressions": [],
  8559. "predicates": [],
  8560. "projection": [
  8561. 1,
  8562. 0
  8563. ],
  8564. "input_arity": 2
  8565. }
  8566. }
  8567. }
  8568. },
  8569. {
  8570. "lookup_relation": 0,
  8571. "stream_key": [
  8572. {
  8573. "Column": [
  8574. 0,
  8575. "c"
  8576. ]
  8577. }
  8578. ],
  8579. "stream_thinning": [
  8580. 1
  8581. ],
  8582. "lookup_key": [
  8583. {
  8584. "Column": [
  8585. 0,
  8586. "a"
  8587. ]
  8588. }
  8589. ],
  8590. "closure": {
  8591. "ready_equivalences": [],
  8592. "before": {
  8593. "mfp": {
  8594. "expressions": [],
  8595. "predicates": [],
  8596. "projection": [
  8597. 0,
  8598. 2,
  8599. 1
  8600. ],
  8601. "input_arity": 3
  8602. }
  8603. }
  8604. }
  8605. }
  8606. ],
  8607. "final_closure": {
  8608. "ready_equivalences": [],
  8609. "before": {
  8610. "mfp": {
  8611. "expressions": [],
  8612. "predicates": [],
  8613. "projection": [
  8614. 0,
  8615. 1,
  8616. 0,
  8617. 2,
  8618. 2,
  8619. 0
  8620. ],
  8621. "input_arity": 3
  8622. }
  8623. }
  8624. }
  8625. },
  8626. {
  8627. "source_relation": 2,
  8628. "source_key": [
  8629. {
  8630. "Column": [
  8631. 0,
  8632. "e"
  8633. ]
  8634. },
  8635. {
  8636. "Column": [
  8637. 1,
  8638. "f"
  8639. ]
  8640. }
  8641. ],
  8642. "initial_closure": {
  8643. "ready_equivalences": [],
  8644. "before": {
  8645. "mfp": {
  8646. "expressions": [],
  8647. "predicates": [],
  8648. "projection": [
  8649. 0,
  8650. 1
  8651. ],
  8652. "input_arity": 2
  8653. }
  8654. }
  8655. },
  8656. "stage_plans": [
  8657. {
  8658. "lookup_relation": 1,
  8659. "stream_key": [
  8660. {
  8661. "Column": [
  8662. 1,
  8663. "f"
  8664. ]
  8665. },
  8666. {
  8667. "Column": [
  8668. 0,
  8669. "e"
  8670. ]
  8671. }
  8672. ],
  8673. "stream_thinning": [],
  8674. "lookup_key": [
  8675. {
  8676. "Column": [
  8677. 0,
  8678. "c"
  8679. ]
  8680. },
  8681. {
  8682. "Column": [
  8683. 1,
  8684. "d"
  8685. ]
  8686. }
  8687. ],
  8688. "closure": {
  8689. "ready_equivalences": [],
  8690. "before": {
  8691. "mfp": {
  8692. "expressions": [],
  8693. "predicates": [],
  8694. "projection": [
  8695. 1,
  8696. 0
  8697. ],
  8698. "input_arity": 2
  8699. }
  8700. }
  8701. }
  8702. },
  8703. {
  8704. "lookup_relation": 0,
  8705. "stream_key": [
  8706. {
  8707. "Column": [
  8708. 1,
  8709. "f"
  8710. ]
  8711. }
  8712. ],
  8713. "stream_thinning": [
  8714. 0
  8715. ],
  8716. "lookup_key": [
  8717. {
  8718. "Column": [
  8719. 0,
  8720. "a"
  8721. ]
  8722. }
  8723. ],
  8724. "closure": {
  8725. "ready_equivalences": [],
  8726. "before": {
  8727. "mfp": {
  8728. "expressions": [],
  8729. "predicates": [],
  8730. "projection": [
  8731. 0,
  8732. 2,
  8733. 1
  8734. ],
  8735. "input_arity": 3
  8736. }
  8737. }
  8738. }
  8739. }
  8740. ],
  8741. "final_closure": {
  8742. "ready_equivalences": [],
  8743. "before": {
  8744. "mfp": {
  8745. "expressions": [],
  8746. "predicates": [],
  8747. "projection": [
  8748. 0,
  8749. 1,
  8750. 0,
  8751. 2,
  8752. 2,
  8753. 0
  8754. ],
  8755. "input_arity": 3
  8756. }
  8757. }
  8758. }
  8759. }
  8760. ]
  8761. }
  8762. }
  8763. }
  8764. }
  8765. }
  8766. }
  8767. ],
  8768. "sources": []
  8769. }
  8770. EOF
  8771. # Test Join::Delta (star).
  8772. query T multiline
  8773. EXPLAIN PHYSICAL PLAN WITH(non negative) AS JSON FOR
  8774. SELECT a, b, c, d, e, f
  8775. FROM t, u, v
  8776. WHERE a = c and a = e
  8777. ----
  8778. {
  8779. "plans": [
  8780. {
  8781. "id": "Explained Query",
  8782. "plan": {
  8783. "lir_id": 4,
  8784. "node": {
  8785. "Join": {
  8786. "inputs": [
  8787. {
  8788. "lir_id": 1,
  8789. "node": {
  8790. "Get": {
  8791. "id": {
  8792. "Global": {
  8793. "User": 1
  8794. }
  8795. },
  8796. "keys": {
  8797. "raw": false,
  8798. "arranged": [
  8799. [
  8800. [
  8801. {
  8802. "Column": [
  8803. 0,
  8804. "a"
  8805. ]
  8806. }
  8807. ],
  8808. [
  8809. 0,
  8810. 1
  8811. ],
  8812. [
  8813. 1
  8814. ]
  8815. ]
  8816. ],
  8817. "types": [
  8818. {
  8819. "scalar_type": "Int32",
  8820. "nullable": true
  8821. },
  8822. {
  8823. "scalar_type": "Int32",
  8824. "nullable": true
  8825. }
  8826. ]
  8827. },
  8828. "plan": "PassArrangements"
  8829. }
  8830. }
  8831. },
  8832. {
  8833. "lir_id": 2,
  8834. "node": {
  8835. "Get": {
  8836. "id": {
  8837. "Global": {
  8838. "User": 2
  8839. }
  8840. },
  8841. "keys": {
  8842. "raw": false,
  8843. "arranged": [
  8844. [
  8845. [
  8846. {
  8847. "Column": [
  8848. 0,
  8849. "c"
  8850. ]
  8851. }
  8852. ],
  8853. [
  8854. 0,
  8855. 1
  8856. ],
  8857. [
  8858. 1
  8859. ]
  8860. ]
  8861. ],
  8862. "types": [
  8863. {
  8864. "scalar_type": "Int32",
  8865. "nullable": true
  8866. },
  8867. {
  8868. "scalar_type": "Int32",
  8869. "nullable": true
  8870. }
  8871. ]
  8872. },
  8873. "plan": "PassArrangements"
  8874. }
  8875. }
  8876. },
  8877. {
  8878. "lir_id": 3,
  8879. "node": {
  8880. "Get": {
  8881. "id": {
  8882. "Global": {
  8883. "User": 3
  8884. }
  8885. },
  8886. "keys": {
  8887. "raw": false,
  8888. "arranged": [
  8889. [
  8890. [
  8891. {
  8892. "Column": [
  8893. 0,
  8894. "e"
  8895. ]
  8896. }
  8897. ],
  8898. [
  8899. 0,
  8900. 1
  8901. ],
  8902. [
  8903. 1
  8904. ]
  8905. ]
  8906. ],
  8907. "types": [
  8908. {
  8909. "scalar_type": "Int32",
  8910. "nullable": true
  8911. },
  8912. {
  8913. "scalar_type": "Int32",
  8914. "nullable": true
  8915. }
  8916. ]
  8917. },
  8918. "plan": "PassArrangements"
  8919. }
  8920. }
  8921. }
  8922. ],
  8923. "plan": {
  8924. "Delta": {
  8925. "path_plans": [
  8926. {
  8927. "source_relation": 0,
  8928. "source_key": [
  8929. {
  8930. "Column": [
  8931. 0,
  8932. "a"
  8933. ]
  8934. }
  8935. ],
  8936. "initial_closure": {
  8937. "ready_equivalences": [],
  8938. "before": {
  8939. "mfp": {
  8940. "expressions": [],
  8941. "predicates": [
  8942. [
  8943. 1,
  8944. {
  8945. "CallUnary": {
  8946. "func": {
  8947. "Not": null
  8948. },
  8949. "expr": {
  8950. "CallUnary": {
  8951. "func": {
  8952. "IsNull": null
  8953. },
  8954. "expr": {
  8955. "Column": [
  8956. 0,
  8957. "a"
  8958. ]
  8959. }
  8960. }
  8961. }
  8962. }
  8963. }
  8964. ]
  8965. ],
  8966. "projection": [
  8967. 0,
  8968. 1
  8969. ],
  8970. "input_arity": 2
  8971. }
  8972. }
  8973. },
  8974. "stage_plans": [
  8975. {
  8976. "lookup_relation": 1,
  8977. "stream_key": [
  8978. {
  8979. "Column": [
  8980. 0,
  8981. "a"
  8982. ]
  8983. }
  8984. ],
  8985. "stream_thinning": [
  8986. 1
  8987. ],
  8988. "lookup_key": [
  8989. {
  8990. "Column": [
  8991. 0,
  8992. "c"
  8993. ]
  8994. }
  8995. ],
  8996. "closure": {
  8997. "ready_equivalences": [],
  8998. "before": {
  8999. "mfp": {
  9000. "expressions": [],
  9001. "predicates": [],
  9002. "projection": [
  9003. 0,
  9004. 1,
  9005. 2
  9006. ],
  9007. "input_arity": 3
  9008. }
  9009. }
  9010. }
  9011. },
  9012. {
  9013. "lookup_relation": 2,
  9014. "stream_key": [
  9015. {
  9016. "Column": [
  9017. 0,
  9018. "a"
  9019. ]
  9020. }
  9021. ],
  9022. "stream_thinning": [
  9023. 1,
  9024. 2
  9025. ],
  9026. "lookup_key": [
  9027. {
  9028. "Column": [
  9029. 0,
  9030. "e"
  9031. ]
  9032. }
  9033. ],
  9034. "closure": {
  9035. "ready_equivalences": [],
  9036. "before": {
  9037. "mfp": {
  9038. "expressions": [],
  9039. "predicates": [],
  9040. "projection": [
  9041. 0,
  9042. 1,
  9043. 2,
  9044. 3
  9045. ],
  9046. "input_arity": 4
  9047. }
  9048. }
  9049. }
  9050. }
  9051. ],
  9052. "final_closure": {
  9053. "ready_equivalences": [],
  9054. "before": {
  9055. "mfp": {
  9056. "expressions": [],
  9057. "predicates": [],
  9058. "projection": [
  9059. 0,
  9060. 1,
  9061. 0,
  9062. 2,
  9063. 0,
  9064. 3
  9065. ],
  9066. "input_arity": 4
  9067. }
  9068. }
  9069. }
  9070. },
  9071. {
  9072. "source_relation": 1,
  9073. "source_key": [
  9074. {
  9075. "Column": [
  9076. 0,
  9077. "c"
  9078. ]
  9079. }
  9080. ],
  9081. "initial_closure": {
  9082. "ready_equivalences": [],
  9083. "before": {
  9084. "mfp": {
  9085. "expressions": [],
  9086. "predicates": [],
  9087. "projection": [
  9088. 0,
  9089. 1
  9090. ],
  9091. "input_arity": 2
  9092. }
  9093. }
  9094. },
  9095. "stage_plans": [
  9096. {
  9097. "lookup_relation": 0,
  9098. "stream_key": [
  9099. {
  9100. "Column": [
  9101. 0,
  9102. "c"
  9103. ]
  9104. }
  9105. ],
  9106. "stream_thinning": [
  9107. 1
  9108. ],
  9109. "lookup_key": [
  9110. {
  9111. "Column": [
  9112. 0,
  9113. "a"
  9114. ]
  9115. }
  9116. ],
  9117. "closure": {
  9118. "ready_equivalences": [],
  9119. "before": {
  9120. "mfp": {
  9121. "expressions": [],
  9122. "predicates": [
  9123. [
  9124. 1,
  9125. {
  9126. "CallUnary": {
  9127. "func": {
  9128. "Not": null
  9129. },
  9130. "expr": {
  9131. "CallUnary": {
  9132. "func": {
  9133. "IsNull": null
  9134. },
  9135. "expr": {
  9136. "Column": [
  9137. 0,
  9138. "a"
  9139. ]
  9140. }
  9141. }
  9142. }
  9143. }
  9144. }
  9145. ]
  9146. ],
  9147. "projection": [
  9148. 0,
  9149. 2,
  9150. 0,
  9151. 1
  9152. ],
  9153. "input_arity": 3
  9154. }
  9155. }
  9156. }
  9157. },
  9158. {
  9159. "lookup_relation": 2,
  9160. "stream_key": [
  9161. {
  9162. "Column": [
  9163. 2,
  9164. "c"
  9165. ]
  9166. }
  9167. ],
  9168. "stream_thinning": [
  9169. 0,
  9170. 1,
  9171. 3
  9172. ],
  9173. "lookup_key": [
  9174. {
  9175. "Column": [
  9176. 0,
  9177. "e"
  9178. ]
  9179. }
  9180. ],
  9181. "closure": {
  9182. "ready_equivalences": [],
  9183. "before": {
  9184. "mfp": {
  9185. "expressions": [],
  9186. "predicates": [],
  9187. "projection": [
  9188. 1,
  9189. 2,
  9190. 3,
  9191. 4
  9192. ],
  9193. "input_arity": 5
  9194. }
  9195. }
  9196. }
  9197. }
  9198. ],
  9199. "final_closure": {
  9200. "ready_equivalences": [],
  9201. "before": {
  9202. "mfp": {
  9203. "expressions": [],
  9204. "predicates": [],
  9205. "projection": [
  9206. 0,
  9207. 1,
  9208. 0,
  9209. 2,
  9210. 0,
  9211. 3
  9212. ],
  9213. "input_arity": 4
  9214. }
  9215. }
  9216. }
  9217. },
  9218. {
  9219. "source_relation": 2,
  9220. "source_key": [
  9221. {
  9222. "Column": [
  9223. 0,
  9224. "e"
  9225. ]
  9226. }
  9227. ],
  9228. "initial_closure": {
  9229. "ready_equivalences": [],
  9230. "before": {
  9231. "mfp": {
  9232. "expressions": [],
  9233. "predicates": [],
  9234. "projection": [
  9235. 0,
  9236. 1
  9237. ],
  9238. "input_arity": 2
  9239. }
  9240. }
  9241. },
  9242. "stage_plans": [
  9243. {
  9244. "lookup_relation": 0,
  9245. "stream_key": [
  9246. {
  9247. "Column": [
  9248. 0,
  9249. "e"
  9250. ]
  9251. }
  9252. ],
  9253. "stream_thinning": [
  9254. 1
  9255. ],
  9256. "lookup_key": [
  9257. {
  9258. "Column": [
  9259. 0,
  9260. "a"
  9261. ]
  9262. }
  9263. ],
  9264. "closure": {
  9265. "ready_equivalences": [],
  9266. "before": {
  9267. "mfp": {
  9268. "expressions": [],
  9269. "predicates": [
  9270. [
  9271. 1,
  9272. {
  9273. "CallUnary": {
  9274. "func": {
  9275. "Not": null
  9276. },
  9277. "expr": {
  9278. "CallUnary": {
  9279. "func": {
  9280. "IsNull": null
  9281. },
  9282. "expr": {
  9283. "Column": [
  9284. 0,
  9285. "a"
  9286. ]
  9287. }
  9288. }
  9289. }
  9290. }
  9291. }
  9292. ]
  9293. ],
  9294. "projection": [
  9295. 0,
  9296. 2,
  9297. 0,
  9298. 1
  9299. ],
  9300. "input_arity": 3
  9301. }
  9302. }
  9303. }
  9304. },
  9305. {
  9306. "lookup_relation": 1,
  9307. "stream_key": [
  9308. {
  9309. "Column": [
  9310. 2,
  9311. "e"
  9312. ]
  9313. }
  9314. ],
  9315. "stream_thinning": [
  9316. 0,
  9317. 1,
  9318. 3
  9319. ],
  9320. "lookup_key": [
  9321. {
  9322. "Column": [
  9323. 0,
  9324. "c"
  9325. ]
  9326. }
  9327. ],
  9328. "closure": {
  9329. "ready_equivalences": [],
  9330. "before": {
  9331. "mfp": {
  9332. "expressions": [],
  9333. "predicates": [],
  9334. "projection": [
  9335. 1,
  9336. 2,
  9337. 4,
  9338. 3
  9339. ],
  9340. "input_arity": 5
  9341. }
  9342. }
  9343. }
  9344. }
  9345. ],
  9346. "final_closure": {
  9347. "ready_equivalences": [],
  9348. "before": {
  9349. "mfp": {
  9350. "expressions": [],
  9351. "predicates": [],
  9352. "projection": [
  9353. 0,
  9354. 1,
  9355. 0,
  9356. 2,
  9357. 0,
  9358. 3
  9359. ],
  9360. "input_arity": 4
  9361. }
  9362. }
  9363. }
  9364. }
  9365. ]
  9366. }
  9367. }
  9368. }
  9369. }
  9370. }
  9371. }
  9372. ],
  9373. "sources": []
  9374. }
  9375. EOF