decorrelated_plan_as_json.slt 405 KB

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