diff --git a/regression-test/data/limit/sql/predicateNotProjected.sql.generated.out b/regression-test/data/limit/sql/predicateNotProjected.sql.generated.out new file mode 100644 index 00000000000000..455c11c4d77390 --- /dev/null +++ b/regression-test/data/limit/sql/predicateNotProjected.sql.generated.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !predicateNotProjected -- +0 +1 +2 + diff --git a/regression-test/data/limit/sql/useRestrictiveLimitFromSubq.sql.generated.out b/regression-test/data/limit/sql/useRestrictiveLimitFromSubq.sql.generated.out new file mode 100644 index 00000000000000..601966fdebbf3a --- /dev/null +++ b/regression-test/data/limit/sql/useRestrictiveLimitFromSubq.sql.generated.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !useRestrictiveLimitFromSubq -- +2 + diff --git a/regression-test/data/limit/sql/withGroupBy.sql.generated.out b/regression-test/data/limit/sql/withGroupBy.sql.generated.out new file mode 100644 index 00000000000000..b6d65a6224cb6d --- /dev/null +++ b/regression-test/data/limit/sql/withGroupBy.sql.generated.out @@ -0,0 +1,5 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withGroupBy -- +5 4 +5 3 + diff --git a/regression-test/data/limit/sql/withGroupByAndOrderByInSubq.sql.generated.out b/regression-test/data/limit/sql/withGroupByAndOrderByInSubq.sql.generated.out new file mode 100644 index 00000000000000..6828203108c859 --- /dev/null +++ b/regression-test/data/limit/sql/withGroupByAndOrderByInSubq.sql.generated.out @@ -0,0 +1,5 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withGroupByAndOrderByInSubq -- +5 0 +5 1 + diff --git a/regression-test/data/limit/sql/withGroupByInSubq.sql.generated.out b/regression-test/data/limit/sql/withGroupByInSubq.sql.generated.out new file mode 100644 index 00000000000000..0554f517f45b93 --- /dev/null +++ b/regression-test/data/limit/sql/withGroupByInSubq.sql.generated.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withGroupByInSubq -- +20 + diff --git a/regression-test/data/limit/sql/withJoinInSubq.sql.generated.out b/regression-test/data/limit/sql/withJoinInSubq.sql.generated.out new file mode 100644 index 00000000000000..9163b4364d8432 --- /dev/null +++ b/regression-test/data/limit/sql/withJoinInSubq.sql.generated.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withJoinInSubq -- +5 + diff --git a/regression-test/data/limit/sql/withLimitZero.sql.generated.out b/regression-test/data/limit/sql/withLimitZero.sql.generated.out new file mode 100644 index 00000000000000..f2283c20af4f62 --- /dev/null +++ b/regression-test/data/limit/sql/withLimitZero.sql.generated.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withLimitZero -- +0 + diff --git a/regression-test/data/limit/sql/withSimpleLimit.sql.generated.out b/regression-test/data/limit/sql/withSimpleLimit.sql.generated.out new file mode 100644 index 00000000000000..1f02389b039930 --- /dev/null +++ b/regression-test/data/limit/sql/withSimpleLimit.sql.generated.out @@ -0,0 +1,8 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withSimpleLimit -- +24 +23 +22 +21 +20 + diff --git a/regression-test/data/limit/sql/withSubq.sql.generated.out b/regression-test/data/limit/sql/withSubq.sql.generated.out new file mode 100644 index 00000000000000..c44b8c9919d6cc --- /dev/null +++ b/regression-test/data/limit/sql/withSubq.sql.generated.out @@ -0,0 +1,4 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !withSubq -- +10 + diff --git a/regression-test/data/set_operations/sql/except_1.sql.generated.out b/regression-test/data/set_operations/sql/except_1.sql.generated.out new file mode 100644 index 00000000000000..4962aaf40ffe5f --- /dev/null +++ b/regression-test/data/set_operations/sql/except_1.sql.generated.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !except_1 -- +CHINA +VIETNAM +PERU + diff --git a/regression-test/data/set_operations/sql/except_2.sql.generated.out b/regression-test/data/set_operations/sql/except_2.sql.generated.out new file mode 100644 index 00000000000000..ed3b369ea279fa --- /dev/null +++ b/regression-test/data/set_operations/sql/except_2.sql.generated.out @@ -0,0 +1,6 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !except_2 -- +PERU +CHINA +VIETNAM + diff --git a/regression-test/data/set_operations/sql/except_3.sql.generated.out b/regression-test/data/set_operations/sql/except_3.sql.generated.out new file mode 100644 index 00000000000000..aab9b5d96a946e --- /dev/null +++ b/regression-test/data/set_operations/sql/except_3.sql.generated.out @@ -0,0 +1,8 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !except_3 -- +10 +3 +\N +6 +1 + diff --git a/regression-test/data/set_operations/sql/intersect_1.sql.generated.out b/regression-test/data/set_operations/sql/intersect_1.sql.generated.out new file mode 100644 index 00000000000000..ab4bc05908bdce --- /dev/null +++ b/regression-test/data/set_operations/sql/intersect_1.sql.generated.out @@ -0,0 +1,9 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !intersect_1 -- +JAPAN +INDONESIA +CHINA +INDIA +PERU +VIETNAM + diff --git a/regression-test/data/set_operations/sql/intersect_2.sql.generated.out b/regression-test/data/set_operations/sql/intersect_2.sql.generated.out new file mode 100644 index 00000000000000..f278675bb6d9ea --- /dev/null +++ b/regression-test/data/set_operations/sql/intersect_2.sql.generated.out @@ -0,0 +1,10 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !intersect_2 -- +7 +9 +4 +\N +8 +5 +2 + diff --git a/regression-test/data/window_functions/sf0.01/lineitem.csv.gz b/regression-test/data/window_functions/sf0.01/lineitem.csv.gz new file mode 100644 index 00000000000000..7f83fad5b8da7a Binary files /dev/null and b/regression-test/data/window_functions/sf0.01/lineitem.csv.gz differ diff --git a/regression-test/data/window_functions/sf0.01/nation.csv b/regression-test/data/window_functions/sf0.01/nation.csv new file mode 100644 index 00000000000000..d92875f2e4d3d9 --- /dev/null +++ b/regression-test/data/window_functions/sf0.01/nation.csv @@ -0,0 +1,25 @@ +0,ALGERIA,0, haggle. carefully final deposits detect slyly agai +1,ARGENTINA,1,al foxes promise slyly according to the regular accounts. bold requests alon +2,BRAZIL,1,y alongside of the pending deposits. carefully special packages are about the ironic forges. slyly special +3,CANADA,1,eas hang ironic silent packages. slyly regular packages are furiously over the tithes. fluffily bold +4,EGYPT,4,y above the carefully unusual theodolites. final dugouts are quickly across the furiously regular d +5,ETHIOPIA,0,ven packages wake quickly. regu +6,FRANCE,3,refully final requests. regular ironi +7,GERMANY,3,l platelets. regular accounts x-ray: unusual regular acco +8,INDIA,2,ss excuses cajole slyly across the packages. deposits print aroun +9,INDONESIA,2, slyly express asymptotes. regular deposits haggle slyly. carefully ironic hockey players sleep blithely. carefull +10,IRAN,4,efully alongside of the slyly final dependencies. +11,IRAQ,4,nic deposits boost atop the quickly final requests? quickly regula +12,JAPAN,2,ously. final express gifts cajole a +13,JORDAN,4,ic deposits are blithely about the carefully regular pa +14,KENYA,0, pending excuses haggle furiously deposits. pending express pinto beans wake fluffily past t +15,MOROCCO,0,rns. blithely bold courts among the closely regular packages use furiously bold platelets? +16,MOZAMBIQUE,0,s. ironic unusual asymptotes wake blithely r +17,PERU,1,platelets. blithely pending dependencies use fluffily across the even pinto beans. carefully silent accoun +18,CHINA,2,c dependencies. furiously express notornis sleep slyly regular accounts. ideas sleep. depos +19,ROMANIA,3,ular asymptotes are about the furious multipliers. express dependencies nag above the ironically ironic account +20,SAUDI ARABIA,4,ts. silent requests haggle. closely express packages sleep across the blithely +21,VIETNAM,2,hely enticingly express accounts. even final +22,RUSSIA,3, requests against the platelets use never according to the quickly regular pint +23,UNITED KINGDOM,3,eans boost carefully special requests. accounts are. carefull +24,UNITED STATES,1,y final packages. slow foxes cajole quickly. quickly silent platelets breach ironic accounts. unusual pinto be diff --git a/regression-test/data/window_functions/sf0.01/region.csv b/regression-test/data/window_functions/sf0.01/region.csv new file mode 100644 index 00000000000000..26c343b5c7b4ee --- /dev/null +++ b/regression-test/data/window_functions/sf0.01/region.csv @@ -0,0 +1,5 @@ +0,AFRICA,lar deposits. blithely final packages cajole. regular waters are final requests. regular accounts are according to +1,AMERICA,hs use ironic even requests. s +2,ASIA,ges. thinly even pinto beans ca +3,EUROPE,ly final courts cajole furiously final excuse +4,MIDDLE EAST,uickly special accounts cajole carefully blithely close requests. carefully final asymptotes haggle furiousl diff --git a/regression-test/data/window_functions/sql/leadLag.sql.generated.out b/regression-test/data/window_functions/sql/leadLag.sql.generated.out new file mode 100644 index 00000000000000..1aff8a3bc58ca1 --- /dev/null +++ b/regression-test/data/window_functions/sql/leadLag.sql.generated.out @@ -0,0 +1,33 @@ +-- ! leadLag -- +20135|100|0.0|null|28134.48|null +52067|54|0.0|0.07|44546.26|28134.48 +31911|100|0.02|0.07|3516.81|null +27014|27|0.02|0.09|10550.43|3516.81 +10727|73|0.02|null|19928.59|10550.43 +48032|27|0.02|0.03|22273.13|19928.59 +49095|27|0.02|0.02|24617.67|22273.13 +17092|54|0.02|0.02|33995.83|24617.67 +21056|100|0.02|0.0|38684.91|33995.83 +8673|54|0.02|0.1|57441.23|38684.91 +58279|54|0.03|0.07|14067.24|null +44387|27|0.03|0.02|23445.4|14067.24 +24643|54|0.03|0.02|35168.1|23445.4 +47365|100|0.04|0.06|2344.54|null +1509|27|0.04|null|16411.78|2344.54 +14918|27|0.04|0.04|38684.91|16411.78 +30406|73|0.04|0.09|45718.53|38684.91 +12901|27|0.04|0.04|53924.42|45718.53 +27394|54|0.05|0.03|22273.13|null +33600|100|0.05|0.02|37512.64|22273.13 +37063|100|0.06|0.05|14067.24|null +37186|54|0.07|0.05|5861.35|null +52258|54|0.07|0.0|19928.59|5861.35 +21314|27|0.07|0.04|28134.48|19928.59 +56898|27|0.07|0.08|41029.45|28134.48 +37185|73|0.07|0.04|42201.72|41029.45 +50304|100|0.07|0.04|56268.96|42201.72 +30822|100|0.07|0.02|58613.5|56268.96 +52736|27|0.08|0.02|15239.51|null +21346|27|0.09|0.07|4689.08|null +28326|73|0.09|0.02|42201.72|4689.08 +1985|54|0.1|null|38684.91|null diff --git a/regression-test/data/window_functions/sql/noOrderAllRowsPeers_order.sql.generated.out b/regression-test/data/window_functions/sql/noOrderAllRowsPeers_order.sql.generated.out new file mode 100644 index 00000000000000..b293ad735a2d5d --- /dev/null +++ b/regression-test/data/window_functions/sql/noOrderAllRowsPeers_order.sql.generated.out @@ -0,0 +1,35 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !noOrderAllRowsPeers_order -- +27014|27|0.02|1 +12901|27|0.04|1 +14918|27|0.04|1 +21314|27|0.07|1 +48032|27|0.02|1 +49095|27|0.02|1 +56898|27|0.07|1 +44387|27|0.03|1 +1509|27|0.04|1 +21346|27|0.09|1 +52736|27|0.08|1 +58279|54|0.03|1 +24643|54|0.03|1 +27394|54|0.05|1 +37186|54|0.07|1 +1985|54|0.1|1 +8673|54|0.02|1 +17092|54|0.02|1 +52067|54|0.0|1 +52258|54|0.07|1 +30406|73|0.04|1 +37185|73|0.07|1 +10727|73|0.02|1 +28326|73|0.09|1 +20135|100|0.0|1 +21056|100|0.02|1 +47365|100|0.04|1 +37063|100|0.06|1 +33600|100|0.05|1 +31911|100|0.02|1 +30822|100|0.07|1 +50304|100|0.07|1 + diff --git a/regression-test/data/window_functions/sql/rangeCurrent.sql.generated.out b/regression-test/data/window_functions/sql/rangeCurrent.sql.generated.out new file mode 100644 index 00000000000000..62189e74eb02fe --- /dev/null +++ b/regression-test/data/window_functions/sql/rangeCurrent.sql.generated.out @@ -0,0 +1,28 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !rangeCurrent -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 9 +18 9 +21 9 +12 9 +8 8 +22 22 +23 22 +7 7 +6 6 +19 6 +10 10 +13 10 +11 10 +20 10 +4 4 + diff --git a/regression-test/data/window_functions/sql/rangeUnbounded.sql.generated.out b/regression-test/data/window_functions/sql/rangeUnbounded.sql.generated.out new file mode 100644 index 00000000000000..0548c8e723bdf8 --- /dev/null +++ b/regression-test/data/window_functions/sql/rangeUnbounded.sql.generated.out @@ -0,0 +1,28 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !rangeUnbounded -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 8 +18 8 +21 8 +12 8 +8 8 +22 6 +23 6 +7 6 +6 6 +19 6 +10 4 +13 4 +11 4 +20 4 +4 4 + diff --git a/regression-test/data/window_functions/sql/rowsDifferentOrders.sql.generated.out b/regression-test/data/window_functions/sql/rowsDifferentOrders.sql.generated.out new file mode 100644 index 00000000000000..0e220f17ac5f0e --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsDifferentOrders.sql.generated.out @@ -0,0 +1,34 @@ +-- ! rowsDifferentOrders -- +1509|27|16411.78|279000.26|0.04|0.04 +12901|27|53924.42|262588.48|0.04|0.04 +14918|27|38684.91|208664.06|0.04|0.04 +21314|27|28134.48|169979.15|0.07|0.0475 +21346|27|4689.08|141844.67|0.09|0.056 +27014|27|10550.43|137155.59|0.02|0.05 +44387|27|23445.4|126605.16|0.03|0.04714 +48032|27|22273.13|103159.76|0.02|0.04375 +49095|27|24617.67|80886.63|0.02|0.04111 +52736|27|15239.51|56268.96|0.08|0.045 +56898|27|41029.45|41029.45|0.07|0.04727 +1985|54|38684.91|271966.64|0.1|0.1 +8673|54|57441.23|233281.73|0.02|0.06 +17092|54|33995.83|175840.5|0.02|0.04667 +24643|54|35168.1|141844.67|0.03|0.0425 +27394|54|22273.13|106676.57|0.05|0.044 +37186|54|5861.35|84403.44|0.07|0.04833 +52067|54|44546.26|78542.09|0.0|0.04143 +52258|54|19928.59|33995.83|0.07|0.045 +58279|54|14067.24|14067.24|0.03|0.04333 +10727|73|19928.59|150050.56|0.02|0.02 +28326|73|42201.72|130121.97|0.09|0.055 +30406|73|45718.53|87920.25|0.04|0.05 +37185|73|42201.72|42201.72|0.07|0.055 +20135|100|28134.48|239143.08|0.0|0.0 +21056|100|38684.91|211008.6|0.02|0.01 +30822|100|58613.5|172323.69|0.07|0.03 +31911|100|3516.81|113710.19|0.02|0.0275 +33600|100|37512.64|110193.38|0.05|0.032 +37063|100|14067.24|72680.74|0.06|0.03667 +47365|100|2344.54|58613.5|0.04|0.03714 +50304|100|56268.96|56268.96|0.07|0.04125 + diff --git a/regression-test/data/window_functions/sql/rowsDisjointWindows.sql.generated.out b/regression-test/data/window_functions/sql/rowsDisjointWindows.sql.generated.out new file mode 100644 index 00000000000000..4d332b9235da11 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsDisjointWindows.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsDisjointWindows -- +1509|27|14.0|null|16411.78|70336.2|0.04|0.05 +12901|27|46.0|14.0|53924.42|92609.33|0.04|0.04714 +14918|27|33.0|60.0|38684.91|66819.39|0.04|0.04 +21314|27|24.0|93.0|28134.48|32823.56|0.07|0.044 +21346|27|4.00|117.0|4689.08|15239.51|0.09|0.0475 +27014|27|9.0|121.0|10550.43|33995.83|0.02|0.05667 +44387|27|20.0|130.0|23445.4|45718.53|0.03|0.075 +48032|27|19.0|150.0|22273.13|46890.8|0.02|0.07 +49095|27|21.0|169.0|24617.67|39857.18|0.02|null +52736|27|13.0|190.0|15239.51|56268.96|0.08|null +56898|27|35.0|203.0|41029.45|41029.45|0.07|null +1985|54|33.0|null|38684.91|96126.14|0.1|0.04167 +8673|54|49.0|33.0|57441.23|91437.06|0.02|0.044 +17092|54|29.0|82.0|33995.83|69163.93|0.02|0.0425 +24643|54|30.0|111.0|35168.1|57441.23|0.03|0.03333 +27394|54|19.0|141.0|22273.13|28134.48|0.05|0.05 +37186|54|5.0|160.0|5861.35|50407.61|0.07|0.03 +52067|54|38.0|165.0|44546.26|64474.85|0.0|null +52258|54|17.0|203.0|19928.59|33995.83|0.07|null +58279|54|12.0|220.0|14067.24|14067.24|0.03|null +10727|73|17.0|null|19928.59|62130.31|0.02|0.07 +28326|73|36.0|17.0|42201.72|87920.25|0.09|null +30406|73|39.0|53.0|45718.53|87920.25|0.04|null +37185|73|36.0|92.0|42201.72|42201.72|0.07|null +20135|100|24.0|null|28134.48|66819.39|0.0|0.048 +21056|100|33.0|24.0|38684.91|97298.41|0.02|0.055 +30822|100|50.0|57.0|58613.5|62130.31|0.07|0.05667 +31911|100|3.0|107.0|3516.81|41029.45|0.02|0.055 +33600|100|32.0|110.0|37512.64|51579.88|0.05|0.07 +37063|100|12.0|142.0|14067.24|16411.78|0.06|null +47365|100|2.0|154.0|2344.54|58613.5|0.04|null +50304|100|48.0|156.0|56268.96|56268.96|0.07|null diff --git a/regression-test/data/window_functions/sql/rowsFirstLast.sql.generated.out b/regression-test/data/window_functions/sql/rowsFirstLast.sql.generated.out new file mode 100644 index 00000000000000..1d7fa0aa21a896 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsFirstLast.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsFirstLast -- +12901|27|53924.42|53924.42|4689.08 +56898|27|41029.45|53924.42|4689.08 +14918|27|38684.91|53924.42|4689.08 +21314|27|28134.48|53924.42|4689.08 +49095|27|24617.67|53924.42|4689.08 +44387|27|23445.4|53924.42|4689.08 +48032|27|22273.13|53924.42|4689.08 +1509|27|16411.78|53924.42|4689.08 +52736|27|15239.51|53924.42|4689.08 +27014|27|10550.43|53924.42|4689.08 +21346|27|4689.08|53924.42|4689.08 +8673|54|57441.23|57441.23|5861.35 +52067|54|44546.26|57441.23|5861.35 +1985|54|38684.91|57441.23|5861.35 +24643|54|35168.1|57441.23|5861.35 +17092|54|33995.83|57441.23|5861.35 +27394|54|22273.13|57441.23|5861.35 +52258|54|19928.59|57441.23|5861.35 +58279|54|14067.24|57441.23|5861.35 +37186|54|5861.35|57441.23|5861.35 +30406|73|45718.53|45718.53|19928.59 +37185|73|42201.72|45718.53|19928.59 +28326|73|42201.72|45718.53|19928.59 +10727|73|19928.59|45718.53|19928.59 +30822|100|58613.5|58613.5|2344.54 +50304|100|56268.96|58613.5|2344.54 +21056|100|38684.91|58613.5|2344.54 +33600|100|37512.64|58613.5|2344.54 +20135|100|28134.48|58613.5|2344.54 +37063|100|14067.24|58613.5|2344.54 +31911|100|3516.81|58613.5|2344.54 +47365|100|2344.54|58613.5|2344.54 diff --git a/regression-test/data/window_functions/sql/rowsFrame2F3F.sql.generated.out b/regression-test/data/window_functions/sql/rowsFrame2F3F.sql.generated.out new file mode 100644 index 00000000000000..dddecacf1281e3 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsFrame2F3F.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsFrame2F3F -- +1509|27|14.0|57.0 +12901|27|46.0|28.0 +14918|27|33.0|13.0 +21314|27|24.0|29.0 +21346|27|4.0|39.0 +27014|27|9.0|40.0 +44387|27|20.0|34.0 +48032|27|19.0|48.0 +49095|27|21.0|35.0 +52736|27|13.0|null +56898|27|35.0|null +1985|54|33.0|59.0 +8673|54|49.0|49.0 +17092|54|29.0|24.0 +24643|54|30.0|43.0 +27394|54|19.0|55.0 +37186|54|5.0|29.0 +52067|54|38.0|12.0 +52258|54|17.0|null +58279|54|12.0|null +10727|73|17.0|75.0 +28326|73|36.0|36.0 +30406|73|39.0|null +37185|73|36.0|null +20135|100|24.0|53.0 +21056|100|33.0|35.0 +30822|100|50.0|44.0 +31911|100|3.0|14.0 +33600|100|32.0|50.0 +37063|100|12.0|48.0 +47365|100|2.0|null +50304|100|48.0|null diff --git a/regression-test/data/window_functions/sql/rowsFrame2FUBF.sql.generated.out b/regression-test/data/window_functions/sql/rowsFrame2FUBF.sql.generated.out new file mode 100644 index 00000000000000..deae200f24ac9c --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsFrame2FUBF.sql.generated.out @@ -0,0 +1,34 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !rowsFrame2FUBF -- +1509|27|14.0|178.0 +12901|27|46.0|145.0 +14918|27|33.0|121.0 +21314|27|24.0|117.0 +21346|27|4.0|108.0 +27014|27|9.0|88.0 +44387|27|20.0|69.0 +48032|27|19.0|48.0 +49095|27|21.0|35.0 +52736|27|13.0|null +56898|27|35.0|null +1985|54|33.0|150.0 +8673|54|49.0|121.0 +17092|54|29.0|91.0 +24643|54|30.0|72.0 +27394|54|19.0|67.0 +37186|54|5.0|29.0 +52067|54|38.0|12.0 +52258|54|17.0|null +58279|54|12.0|null +10727|73|17.0|75.0 +28326|73|36.0|36.0 +30406|73|39.0|null +37185|73|36.0|null +20135|100|24.0|147.0 +21056|100|33.0|97.0 +30822|100|50.0|94.0 +31911|100|3.0|62.0 +33600|100|32.0|50.0 +37063|100|12.0|48.0 +47365|100|2.0|null +50304|100|48.0|null diff --git a/regression-test/data/window_functions/sql/rowsFrame3P2P.sql.generated.out b/regression-test/data/window_functions/sql/rowsFrame3P2P.sql.generated.out new file mode 100644 index 00000000000000..e3d9faa9228429 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsFrame3P2P.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsFrame3P2P -- +1509|27|14.0|null +12901|27|46.0|null +14918|27|33.0|14.0 +21314|27|24.0|60.0 +21346|27|4.0|79.0 +27014|27|9.0|57.0 +44387|27|20.0|28.0 +48032|27|19.0|13.0 +49095|27|21.0|29.0 +52736|27|13.0|39.0 +56898|27|35.0|40.0 +1985|54|33.0|null +8673|54|49.0|null +17092|54|29.0|33.0 +24643|54|30.0|82.0 +27394|54|19.0|78.0 +37186|54|5.0|59.0 +52067|54|38.0|49.0 +52258|54|17.0|24.0 +58279|54|12.0|43.0 +10727|73|17.0|null +28326|73|36.0|null +30406|73|39.0|17.0 +37185|73|36.0|53.0 +20135|100|24.0|null +21056|100|33.0|null +30822|100|50.0|24.0 +31911|100|3.0|57.0 +33600|100|32.0|83.0 +37063|100|12.0|53.0 +47365|100|2.0|35.0 +50304|100|48.0|44.0 diff --git a/regression-test/data/window_functions/sql/rowsFrameUBP2P.sql.generated.out b/regression-test/data/window_functions/sql/rowsFrameUBP2P.sql.generated.out new file mode 100644 index 00000000000000..0b89c4d96af4a1 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsFrameUBP2P.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsFrameUBP2P -- +1509|27|14.0|null +12901|27|46.0|null +14918|27|33.0|14.0 +21314|27|24.0|60.0 +21346|27|4.0|93.0 +27014|27|9.0|117.0 +44387|27|20.0|121.0 +48032|27|19.0|130.0 +49095|27|21.0|150.0 +52736|27|13.0|169.0 +56898|27|35.0|190.0 +1985|54|33.0|null +8673|54|49.0|null +17092|54|29.0|33.0 +24643|54|30.0|82.0 +27394|54|19.0|111.0 +37186|54|5.0|141.0 +52067|54|38.0|160.0 +52258|54|17.0|165.0 +58279|54|12.0|203.0 +10727|73|17.0|null +28326|73|36.0|null +30406|73|39.0|17.0 +37185|73|36.0|53.0 +20135|100|24.0|null +21056|100|33.0|null +30822|100|50.0|24.0 +31911|100|3.0|57.0 +33600|100|32.0|107.0 +37063|100|12.0|110.0 +47365|100|2.0|142.0 +50304|100|48.0|154.0 diff --git a/regression-test/data/window_functions/sql/rowsIdenticalWindows.sql.generated.out b/regression-test/data/window_functions/sql/rowsIdenticalWindows.sql.generated.out new file mode 100644 index 00000000000000..19f970a87952f2 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsIdenticalWindows.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsIdenticalWindows -- +1509|27|14.0|14.0|16411.78|16411.78|0.04|0.04 +12901|27|46.0|60.0|53924.42|70336.2|0.04|0.04 +14918|27|33.0|93.0|38684.91|109021.11|0.04|0.04 +21314|27|24.0|117.0|28134.48|137155.59|0.07|0.0475 +21346|27|4.0|121.0|4689.08|141844.67|0.09|0.056 +27014|27|9.0|130.0|10550.43|152395.1|0.02|0.05 +44387|27|20.0|150.0|23445.4|175840.5|0.03|0.04714 +48032|27|19.0|169.0|22273.13|198113.63|0.02|0.04375 +49095|27|21.0|190.0|24617.67|222731.3|0.02|0.04111 +52736|27|13.0|203.0|15239.51|237970.81|0.08|0.045 +56898|27|35.0|238.0|41029.45|279000.26|0.07|0.04727 +1985|54|33.0|33.0|38684.91|38684.91|0.1|0.1 +8673|54|49.0|82.0|57441.23|96126.14|0.02|0.06 +17092|54|29.0|111.0|33995.83|130121.97|0.02|0.04667 +24643|54|30.0|141.0|35168.1|165290.07|0.03|0.0425 +27394|54|19.0|160.0|22273.13|187563.2|0.05|0.044 +37186|54|5.0|165.0|5861.35|193424.55|0.07|0.04833 +52067|54|38.0|203.0|44546.26|237970.81|0.0|0.04143 +52258|54|17.0|220.0|19928.59|257899.4|0.07|0.045 +58279|54|12.0|232.0|14067.24|271966.64|0.03|0.04333 +10727|73|17.0|17.0|19928.59|19928.59|0.02|0.02 +28326|73|36.0|53.0|42201.72|62130.31|0.09|0.055 +30406|73|39.0|92.0|45718.53|107848.84|0.04|0.05 +37185|73|36.0|128.0|42201.72|150050.56|0.07|0.055 +20135|100|24.0|24.0|28134.48|28134.48|0.0|0.0 +21056|100|33.0|57.0|38684.91|66819.39|0.02|0.01 +30822|100|50.0|107.0|58613.5|125432.89|0.07|0.03 +31911|100|3.0|110.0|3516.81|128949.7|0.02|0.0275 +33600|100|32.0|142.0|37512.64|166462.34|0.05|0.032 +37063|100|12.0|154.0|14067.24|180529.58|0.06|0.03667 +47365|100|2.0|156.0|2344.54|182874.12|0.04|0.03714 +50304|100|48.0|204.0|56268.96|239143.08|0.07|0.04125 diff --git a/regression-test/data/window_functions/sql/rowsIntersectingWindows.sql.generated.out b/regression-test/data/window_functions/sql/rowsIntersectingWindows.sql.generated.out new file mode 100644 index 00000000000000..dada44586ad99d --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsIntersectingWindows.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsIntersectingWindows -- +1509|27|14.0|60.0|16411.78|109021.11|0.04|0.04727 +12901|27|46.0|93.0|53924.42|137155.59|0.04|0.048 +14918|27|33.0|117.0|38684.91|125432.89|0.04|0.04889 +21314|27|24.0|121.0|28134.48|82058.9|0.07|0.05 +21346|27|4.0|116.0|4689.08|66819.39|0.09|0.04714 +27014|27|9.0|90.0|10550.43|60958.04|0.02|0.04 +44387|27|20.0|76.0|23445.4|80886.63|0.03|0.044 +48032|27|19.0|73.0|22273.13|85575.71|0.02|0.0475 +49095|27|21.0|82.0|24617.67|103159.76|0.02|0.05667 +52736|27|13.0|108.0|15239.51|80886.63|0.08|0.075 +56898|27|35.0|88.0|41029.45|56268.96|0.07|0.07 +1985|54|33.0|82.0|38684.91|130121.97|0.1|0.04333 +8673|54|49.0|111.0|57441.23|165290.07|0.02|0.03625 +17092|54|29.0|141.|33995.83|148878.29|0.02|0.03857 +24643|54|30.0|160.0|35168.1|97298.41|0.03|0.04167 +27394|54|19.0|132.0|22273.13|107848.84|0.05|0.044 +37186|54|5.0|121.0|5861.35|92609.33|0.07|0.0425 +52067|54|38.0|109.0|44546.26|84403.44|0.0|0.03333 +52258|54|17.0|91.0|19928.59|78542.09|0.07|0.05 +58279|54|12.0|72.0|14067.24|33995.83|0.03|0.03 +10727|73|17.0|53.0|19928.59|107848.84|0.02|0.055 +28326|73|36.0|92.0|42201.72|150050.56|0.09|0.06667 +30406|73|39.0|128.0|45718.53|130121.97|0.04|0.055 +37185|73|36.0|128.0|42201.72|87920.25|0.07|0.07 +20135|100|24.0|57.0|28134.48|125432.89|0.0|0.04125 +21056|100|33.0|107.0|38684.91|128949.7|0.02|0.04714 +30822|100|50.0|110.0|58613.5|138327.86|0.07|0.05167 +31911|100|3.0|142.0|3516.81|113710.19|0.02|0.048 +33600|100|32.0|130.0|37512.64|57441.23|0.05|0.055 +37063|100|12.0|99.0|14067.24|110193.38|0.06|0.05667 +47365|100|2.0|97.0|2344.54|72680.74|0.04|0.055 +50304|100|48.0|94.0|56268.96|58613.5|0.07|0.07 diff --git a/regression-test/data/window_functions/sql/rowsUBPImplicitCR.sql.generated.out b/regression-test/data/window_functions/sql/rowsUBPImplicitCR.sql.generated.out new file mode 100644 index 00000000000000..2fdf21ef3236a1 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsUBPImplicitCR.sql.generated.out @@ -0,0 +1,33 @@ +-- ! rowsUBPImplicitCR -- +1509|27|14.0|14.0 +12901|27|46.0|60.0 +14918|27|33.0|93.0 +21314|27|24.0|117.0 +21346|27|4.0|121.0 +27014|27|9.0|130.0 +44387|27|20.0|150.0 +48032|27|19.0|169.0 +49095|27|21.0|190.0 +52736|27|13.0|203.0 +56898|27|35.0|238.0 +1985|54|33.0|33.0 +8673|54|49.0|82.0 +17092|54|29.0|111.0 +24643|54|30.0|141.0 +27394|54|19.0|160.0 +37186|54|5.0|165.0 +52067|54|38.0|203.0 +52258|54|17.0|220.0 +58279|54|12.0|232.0 +10727|73|17.0|17.0 +28326|73|36.0|53.0 +30406|73|39.0|92.0 +37185|73|36.0|128.0 +20135|100|24.0|24.0 +21056|100|33.0|57.0 +30822|100|50.0|107.0 +31911|100|3.0|110.0 +33600|100|32.0|142.0 +37063|100|12.0|154.0 +47365|100|2.0|156.0 +50304|100|48.0|204.0 diff --git a/regression-test/data/window_functions/sql/rowsUnbounded.sql.generated.out b/regression-test/data/window_functions/sql/rowsUnbounded.sql.generated.out new file mode 100644 index 00000000000000..24840801ea6167 --- /dev/null +++ b/regression-test/data/window_functions/sql/rowsUnbounded.sql.generated.out @@ -0,0 +1,28 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !rowsUnbounded -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 8 +18 8 +21 8 +12 8 +8 8 +22 6 +23 6 +7 6 +6 6 +19 6 +10 4 +13 4 +11 4 +20 4 +4 4 + diff --git a/regression-test/data/window_functions/sql/windowSpecificationAAcpA.sql.generated.out b/regression-test/data/window_functions/sql/windowSpecificationAAcpA.sql.generated.out new file mode 100644 index 00000000000000..89b758f4fe7524 --- /dev/null +++ b/regression-test/data/window_functions/sql/windowSpecificationAAcpA.sql.generated.out @@ -0,0 +1,35 @@ +-- ! windowSpecificationAAcpA -- +54|1985|272|33.0|33.0|0.1 +54|8673|272|82.0|33.0|0.12 +54|17092|272|111.0|33.0|0.14 +54|24643|272|141.0|33.0|0.17 +54|27394|272|160.0|33.0|0.22 +54|37186|272|165.0|33.0|0.29 +54|52067|272|203.0|33.0|0.29 +54|52258|272|220.0|33.0|0.36 +54|58279|272|232.0|33.0|0.39 +55|11876|273|14.0|14.0|0.05 +55|22243|273|50.0|14.0|0.05 +55|25826|273|89.0|14.0|0.08 +55|26496|273|102.0|14.0|0.11 +55|36582|273|125.0|14.0|0.2 +55|55011|273|138.0|14.0|0.26 +73|10727|272|17.0|17.0|0.02 +73|28326|272|53.0|17.0|0.11 +73|30406|272|92.0|17.0|0.15 +73|37185|272|128.0|17.0|0.22 +74|455|273|44.0|44.0|0.05 +74|14661|273|76.0|44.0|0.05 +74|20037|273|118.0|44.0|0.14 +74|22113|273|140.0|44.0|0.19 +74|43782|273|186.0|44.0|0.24 +74|45319|273|202.0|44.0|0.24 +74|53056|273|251.0|44.0|0.3 +100|20135|272|24.0|24.0|0.0 +100|21056|272|57.0|24.0|0.02 +100|30822|272|107.0|24.0|0.09 +100|31911|272|110.0|24.0|0.11 +100|33600|272|142.0|24.0|0.16 +100|37063|272|154.0|24.0|0.22 +100|47365|272|156.0|24.0|0.26 +100|50304|272|204.0|24.0|0.33 diff --git a/regression-test/data/window_functions/sql/windowSpecificationABA.sql.generated.out b/regression-test/data/window_functions/sql/windowSpecificationABA.sql.generated.out new file mode 100644 index 00000000000000..b3f775fccad47c --- /dev/null +++ b/regression-test/data/window_functions/sql/windowSpecificationABA.sql.generated.out @@ -0,0 +1,35 @@ +-- ! windowSpecificationABA -- +54|1985|272|33.0|33.0|0.1 +54|8673|272|82.0|49.0|0.12 +54|17092|272|111.0|29.0|0.14 +54|24643|272|141.0|30.0|0.17 +54|27394|272|160.0|19.0|0.22 +54|37186|272|165.0|5.0|0.29 +54|52067|272|203.0|38.0|0.29 +54|52258|272|220.0|17.0|0.36 +54|58279|272|232.0|12.0|0.39 +55|11876|273|14.0|14.0|0.05 +55|22243|273|50.0|36.0|0.05 +55|25826|273|89.0|39.0|0.08 +55|26496|273|102.0|13.0|0.11 +55|36582|273|125.0|23.0|0.2 +55|55011|273|138.0|13.0|0.26 +73|10727|272|17.0|17.0|0.02 +73|28326|272|53.0|36.0|0.11 +73|30406|272|92.0|39.0|0.15 +73|37185|272|128.0|36.0|0.22 +74|455|273|44.0|44.0|0.05 +74|14661|273|76.0|32.0|0.05 +74|20037|273|118.0|42.0|0.14 +74|22113|273|140.0|22.0|0.19 +74|43782|273|186.0|46.0|0.24 +74|45319|273|202.0|16.0|0.24 +74|53056|273|251.0|49.0|0.3 +100|20135|272|24.0|24.0|0.0 +100|21056|272|57.0|33.0|0.02 +100|30822|272|107.0|50.0|0.09 +100|31911|272|110.0|3.0|0.11 +100|33600|272|142.0|32.0|0.16 +100|37063|272|154.0|12.0|0.22 +100|47365|272|156.0|2.0|0.26 +100|50304|272|204.0|48.0|0.33 diff --git a/regression-test/data/window_functions/sql/windowSpecificationABcpA.sql.generated.out b/regression-test/data/window_functions/sql/windowSpecificationABcpA.sql.generated.out new file mode 100644 index 00000000000000..1866920e405def --- /dev/null +++ b/regression-test/data/window_functions/sql/windowSpecificationABcpA.sql.generated.out @@ -0,0 +1,35 @@ +-- ! windowSpecificationABcpA -- +54|1985|272|33.0|0.0|0.1 +54|8673|272|82.0|33.0|0.12 +54|17092|272|111.0|17.0|0.14 +54|24643|272|141.0|33.0|0.17 +54|27394|272|160.0|30.0|0.22 +54|37186|272|165.0|36.0|0.29 +54|52067|272|203.0|48.0|0.29 +54|52258|272|220.0|38.0|0.36 +54|58279|272|232.0|17.0|0.39 +55|11876|273|14.0|44.0|0.05 +55|22243|273|50.0|22.0|0.05 +55|25826|273|89.0|36.0|0.08 +55|26496|273|102.0|39.0|0.11 +55|36582|273|125.0|13.0|0.2 +55|55011|273|138.0|49.0|0.26 +73|10727|272|17.0|49.0|0.02 +73|28326|272|53.0|19.0|0.11 +73|30406|272|92.0|36.0|0.15 +73|37185|272|128.0|12.0|0.22 +74|455|273|44.0|0.0|0.05 +74|14661|273|76.0|14.0|0.05 +74|20037|273|118.0|32.0|0.14 +74|22113|273|140.0|42.0|0.19 +74|43782|273|186.0|23.0|0.24 +74|45319|273|202.0|46.0|0.24 +74|53056|273|251.0|16.0|0.3 +100|20135|272|24.0|29.0|0.0 +100|21056|272|57.0|24.0|0.02 +100|30822|272|107.0|39.0|0.09 +100|31911|272|110.0|50.0|0.11 +100|33600|272|142.0|3.0|0.16 +100|37063|272|154.0|32.0|0.22 +100|47365|272|156.0|5.0|0.26 +100|50304|272|204.0|2.0|0.33 diff --git a/regression-test/data/window_functions/window_functions.out b/regression-test/data/window_functions/window_functions.out new file mode 100644 index 00000000000000..3924defbbcf617 --- /dev/null +++ b/regression-test/data/window_functions/window_functions.out @@ -0,0 +1,112 @@ +-- This file is automatically generated. You should know what you did if you want to edit this +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 9 +18 9 +21 9 +12 9 +8 8 +22 22 +23 22 +7 7 +6 6 +19 6 +10 10 +13 10 +11 10 +20 10 +4 4 + +-- !window_functions -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 8 +18 8 +21 8 +12 8 +8 8 +22 6 +23 6 +7 6 +6 6 +19 6 +10 4 +13 4 +11 4 +20 4 +4 4 + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- +0 0 +14 0 +15 0 +16 0 +5 0 +1 1 +3 1 +17 1 +2 1 +24 1 +9 8 +18 8 +21 8 +12 8 +8 8 +22 6 +23 6 +7 6 +6 6 +19 6 +10 4 +13 4 +11 4 +20 4 +4 4 + +-- !window_functions -- + +-- !window_functions -- + +-- !window_functions -- + diff --git a/regression-test/suites/limit/sql/predicateNotProjected.sql b/regression-test/suites/limit/sql/predicateNotProjected.sql new file mode 100644 index 00000000000000..e112bdb37684ac --- /dev/null +++ b/regression-test/suites/limit/sql/predicateNotProjected.sql @@ -0,0 +1,3 @@ +-- database: presto; groups: limit; tables: nation +SELECT n_nationkey FROM nation WHERE n_name < 'INDIA' +ORDER BY n_nationkey LIMIT 3 \ No newline at end of file diff --git a/regression-test/suites/limit/sql/useRestrictiveLimitFromSubq.sql b/regression-test/suites/limit/sql/useRestrictiveLimitFromSubq.sql new file mode 100644 index 00000000000000..c7a1a6659a8fa2 --- /dev/null +++ b/regression-test/suites/limit/sql/useRestrictiveLimitFromSubq.sql @@ -0,0 +1,2 @@ +-- database: presto; groups: limit; tables: nation +SELECT COUNT(*) FROM (SELECT * FROM tpch_tiny_nation LIMIT 2) AS foo LIMIT 5 diff --git a/regression-test/suites/limit/sql/withGroupBy.sql b/regression-test/suites/limit/sql/withGroupBy.sql new file mode 100644 index 00000000000000..e534c8a58dfae9 --- /dev/null +++ b/regression-test/suites/limit/sql/withGroupBy.sql @@ -0,0 +1,4 @@ +-- database: presto; groups: limit; tables: nation +SELECT COUNT(*), regionkey FROM tpch_tiny_nation GROUP BY regionkey +ORDER BY regionkey DESC +LIMIT 2 diff --git a/regression-test/suites/limit/sql/withGroupByAndOrderByInSubq.sql b/regression-test/suites/limit/sql/withGroupByAndOrderByInSubq.sql new file mode 100644 index 00000000000000..46aacc56331dfd --- /dev/null +++ b/regression-test/suites/limit/sql/withGroupByAndOrderByInSubq.sql @@ -0,0 +1,4 @@ +-- database: presto; groups: limit; tables: nation +SELECT foo.c, foo.regionkey FROM + (SELECT regionkey, COUNT(*) AS c FROM tpch_tiny_nation + GROUP BY regionkey ORDER BY regionkey LIMIT 2) foo diff --git a/regression-test/suites/limit/sql/withGroupByInSubq.sql b/regression-test/suites/limit/sql/withGroupByInSubq.sql new file mode 100644 index 00000000000000..dc01b0ca927e8d --- /dev/null +++ b/regression-test/suites/limit/sql/withGroupByInSubq.sql @@ -0,0 +1,4 @@ +-- database: presto; groups: limit; tables: partsupp +SELECT COUNT(*) FROM ( + SELECT suppkey, COUNT(*) FROM tpch_tiny_partsupp + GROUP BY suppkey LIMIT 20) t1 diff --git a/regression-test/suites/limit/sql/withJoinInSubq.sql b/regression-test/suites/limit/sql/withJoinInSubq.sql new file mode 100644 index 00000000000000..2abb6d48ef9efe --- /dev/null +++ b/regression-test/suites/limit/sql/withJoinInSubq.sql @@ -0,0 +1 @@ +SELECT COUNT(*) FROM (SELECT n1.regionkey, n1.nationkey FROM tpch_tiny_nation n1 JOIN tpch_tiny_nation n2 ON n1.regionkey = n2.regionkey LIMIT 5) foo diff --git a/regression-test/suites/limit/sql/withLimitZero.sql b/regression-test/suites/limit/sql/withLimitZero.sql new file mode 100644 index 00000000000000..e23586184c01f8 --- /dev/null +++ b/regression-test/suites/limit/sql/withLimitZero.sql @@ -0,0 +1,3 @@ +-- database: presto; groups: limit; tables: nation +SELECT COUNT(*) FROM + (SELECT * FROM tpch_tiny_nation LIMIT 0) foo diff --git a/regression-test/suites/limit/sql/withSimpleLimit.sql b/regression-test/suites/limit/sql/withSimpleLimit.sql new file mode 100644 index 00000000000000..5bc373a41d2ca5 --- /dev/null +++ b/regression-test/suites/limit/sql/withSimpleLimit.sql @@ -0,0 +1,2 @@ +-- database: presto; groups: limit; tables: nation +SELECT nationkey from tpch_tiny_nation ORDER BY nationkey DESC LIMIT 5 diff --git a/regression-test/suites/limit/sql/withSubq.sql b/regression-test/suites/limit/sql/withSubq.sql new file mode 100644 index 00000000000000..ebb14262df064d --- /dev/null +++ b/regression-test/suites/limit/sql/withSubq.sql @@ -0,0 +1,2 @@ +-- database: presto; groups: limit; tables: nation +SELECT COUNT(*) FROM (SELECT * FROM tpch_tiny_nation LIMIT 10) t1 diff --git a/regression-test/suites/set_operations/sql/except_1.sql b/regression-test/suites/set_operations/sql/except_1.sql new file mode 100644 index 00000000000000..d3ebdd9c58fe9e --- /dev/null +++ b/regression-test/suites/set_operations/sql/except_1.sql @@ -0,0 +1,10 @@ +-- database: presto; tables: nation, workers; groups: set_operation; +-- delimiter: |; ignoreOrder: true; +--! name: except_uniointersect +SELECT name FROM tpch_tiny_nation WHERE nationkey = 17 +EXCEPT +SELECT name FROM tpch_tiny_nation WHERE regionkey = 2 +UNION +(SELECT name FROM tpch_tiny_nation WHERE regionkey = 2 +INTERSECT +SELECT name FROM tpch_tiny_nation WHERE nationkey > 15) diff --git a/regression-test/suites/set_operations/sql/except_2.sql b/regression-test/suites/set_operations/sql/except_2.sql new file mode 100644 index 00000000000000..952ff1c491e29d --- /dev/null +++ b/regression-test/suites/set_operations/sql/except_2.sql @@ -0,0 +1,10 @@ +-- database: presto; tables: nation, workers; groups: set_operation; +-- delimiter: |; ignoreOrder: true; +--! name: except_uniointersect +SELECT name FROM tpch_tiny_nation WHERE nationkey = 17 +EXCEPT +SELECT name FROM tpch_tiny_nation WHERE regionkey = 2 +UNION ALL +(SELECT name FROM tpch_tiny_nation WHERE regionkey = 2 +INTERSECT +SELECT name FROM tpch_tiny_nation WHERE nationkey > 15) diff --git a/regression-test/suites/set_operations/sql/except_3.sql b/regression-test/suites/set_operations/sql/except_3.sql new file mode 100644 index 00000000000000..b91921da67d69f --- /dev/null +++ b/regression-test/suites/set_operations/sql/except_3.sql @@ -0,0 +1,6 @@ +-- database: presto; tables: nation, tpch_tiny_workers; groups: set_operation; +-- delimiter: |; ignoreOrder: true; +--! name: except_uniointersect +SELECT id_employee FROM tpch_tiny_workers +EXCEPT +SELECT department FROM tpch_tiny_workers where department IS NOT NULL diff --git a/regression-test/suites/set_operations/sql/intersect_1.sql b/regression-test/suites/set_operations/sql/intersect_1.sql new file mode 100644 index 00000000000000..f2c060dba248b4 --- /dev/null +++ b/regression-test/suites/set_operations/sql/intersect_1.sql @@ -0,0 +1,8 @@ +-- database: presto; tables: nation, workers; groups: set_operation; +-- delimiter: |; ignoreOrder: true; +--! name: intersect_and_union +SELECT name FROM tpch_tiny_nation WHERE nationkey = 17 +INTERSECT +SELECT name FROM tpch_tiny_nation WHERE regionkey = 1 +UNION +SELECT name FROM tpch_tiny_nation WHERE regionkey = 2 diff --git a/regression-test/suites/set_operations/sql/intersect_2.sql b/regression-test/suites/set_operations/sql/intersect_2.sql new file mode 100644 index 00000000000000..0643c0af082c32 --- /dev/null +++ b/regression-test/suites/set_operations/sql/intersect_2.sql @@ -0,0 +1,8 @@ +-- database: presto; tables: nation, workers; groups: set_operation; +-- delimiter: |; ignoreOrder: true; +--! name: intersect_and_union +SELECT id_employee +FROM tpch_tiny_workers +INTERSECT +SELECT department +FROM tpch_tiny_workers diff --git a/regression-test/suites/tpcds/tpcds.groovy b/regression-test/suites/tpcds/load.groovy similarity index 98% rename from regression-test/suites/tpcds/tpcds.groovy rename to regression-test/suites/tpcds/load.groovy index 6e8ba85949bb46..1c5545ec231e6d 100644 --- a/regression-test/suites/tpcds/tpcds.groovy +++ b/regression-test/suites/tpcds/load.groovy @@ -36,11 +36,11 @@ for (String table in tables) { sql new File("""${scriptDir}/ddl/${table}.sql""").text } -for (String table_name in tables) { +for (String table in tables) { streamLoad { // you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy // db 'regression_test' - table table_name + table table // default label is UUID: // set 'label' UUID.randomUUID().toString() diff --git a/regression-test/suites/window_functions/ddl/partsupp.sql b/regression-test/suites/window_functions/ddl/partsupp.sql new file mode 100644 index 00000000000000..43a0af0575f078 --- /dev/null +++ b/regression-test/suites/window_functions/ddl/partsupp.sql @@ -0,0 +1,7 @@ +CREATE TABLE IF NOT EXISTS tpch_tiny_partsupp ( + partkey bigint, + suppkey bigint, + availqty integer, + supplycost double, + comment varchar(199) +) DUPLICATE KEY(partkey, suppkey) DISTRIBUTED BY HASH(partkey) BUCKETS 3 PROPERTIES ("replication_num" = "1") diff --git a/regression-test/suites/window_functions/ddl/workers.sql b/regression-test/suites/window_functions/ddl/workers.sql new file mode 100644 index 00000000000000..1ba2c331bcc3ba --- /dev/null +++ b/regression-test/suites/window_functions/ddl/workers.sql @@ -0,0 +1,10 @@ +CREATE TABLE IF NOT EXISTS tpch_tiny_workers ( + id_employee INT, + first_name VARCHAR(32), + last_name VARCHAR(32), + date_of_employment DATE, + department TINYINT(1), + id_department INT, + name VARCHAR(32), + salary INT +) DUPLICATE KEY(id_employee) DISTRIBUTED BY HASH(first_name) BUCKETS 3 PROPERTIES ("replication_num" = "1") diff --git a/regression-test/suites/window_functions/load.groovy b/regression-test/suites/window_functions/load.groovy new file mode 100644 index 00000000000000..4e4891e290aba1 --- /dev/null +++ b/regression-test/suites/window_functions/load.groovy @@ -0,0 +1,65 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +// The cases is copied from https://github.com/trinodb/trino/tree/master +// /testing/trino-product-tests/src/main/resources/sql-tests/testcases/window_functions +// and modified by Doris. + +def url = 'https://doris-build.oss-cn-beijing-internal.aliyuncs.com/regression/tpch/sf0.01/' + +def tables = ['lineitem', 'region', 'nation', 'part', 'supplier', 'partsupp', 'workers'] + +for (String table in tables) { + sql """ DROP TABLE IF EXISTS tpch_tiny_${table} """ +} + +scriptDir = new File(getClass().protectionDomain.codeSource.location.path).parent + +for (String table in tables) { + sql new File("""${scriptDir}/ddl/${table}.sql""").text +} + +for (String table_name in tables) { + streamLoad { + // you can skip declare db, because a default db already specify in ${DORIS_HOME}/conf/regression-conf.groovy + // db 'regression_test' + table "tpch_tiny_${table_name}" + + // default column_separator is specify in doris fe config, usually is '\t'. + // this line change to ',' + set 'column_separator', '|' + set 'compress_type', 'GZ' + // relate to ${DORIS_HOME}/regression-test/data/demo/streamload_input.csv. + // also, you can stream load a http stream, e.g. http://xxx/some.csv + file """${url+table_name}.csv.gz""" + + time 10000 // limit inflight 10s + + // if declared a check callback, the default check condition will ignore. + // So you must check all condition + check { result, exception, startTime, endTime -> + if (exception != null) { + throw exception + } + log.info("Stream load result: ${result}".toString()) + def json = parseJson(result) + assertEquals('success', json.Status.toLowerCase()) + assertEquals(json.NumberTotalRows, json.NumberLoadedRows) + assertTrue(json.NumberLoadedRows > 0 && json.LoadBytes > 0) + } + } +} diff --git a/regression-test/suites/window_functions/sql/leadLag.sql b/regression-test/suites/window_functions/sql/leadLag.sql new file mode 100644 index 00000000000000..23945209719a02 --- /dev/null +++ b/regression-test/suites/window_functions/sql/leadLag.sql @@ -0,0 +1,6 @@ +select orderkey, suppkey, +discount, +lead(discount, 1, null) over (partition by suppkey order by orderkey desc) next_discount, +extendedprice, +lag(extendedprice, 1, null) over (partition by discount order by extendedprice) previous_extendedprice +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/noOrderAllRowsPeers_order.sql b/regression-test/suites/window_functions/sql/noOrderAllRowsPeers_order.sql new file mode 100644 index 00000000000000..3cecb648059837 --- /dev/null +++ b/regression-test/suites/window_functions/sql/noOrderAllRowsPeers_order.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, discount, +rank() over (partition by suppkey) +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rangeCurrent.sql b/regression-test/suites/window_functions/sql/rangeCurrent.sql new file mode 100644 index 00000000000000..b91b88e8d63f8b --- /dev/null +++ b/regression-test/suites/window_functions/sql/rangeCurrent.sql @@ -0,0 +1 @@ +SELECT nationkey, min(nationkey) OVER (PARTITION BY regionkey ORDER BY comment RANGE BETWEEN UNBOUNDED PRECEDING AND CURRENT ROW) AS min FROM tpch_tiny_nation diff --git a/regression-test/suites/window_functions/sql/rangeNoPartition.sql b/regression-test/suites/window_functions/sql/rangeNoPartition.sql new file mode 100644 index 00000000000000..2b0a5784f5f390 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rangeNoPartition.sql @@ -0,0 +1,4 @@ +select orderkey, discount, extendedprice, +min(extendedprice) over (order by discount range current row) min_extendedprice, +max(extendedprice) over (order by discount range current row) max_extendedprice +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rangeUnbounded.sql b/regression-test/suites/window_functions/sql/rangeUnbounded.sql new file mode 100644 index 00000000000000..0aea743974510a --- /dev/null +++ b/regression-test/suites/window_functions/sql/rangeUnbounded.sql @@ -0,0 +1 @@ +SELECT nationkey, min(nationkey) OVER (PARTITION BY regionkey ORDER BY comment RANGE BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS min FROM tpch_tiny_nation diff --git a/regression-test/suites/window_functions/sql/rankFunctionsImplicitExplicitFrame.sql b/regression-test/suites/window_functions/sql/rankFunctionsImplicitExplicitFrame.sql new file mode 100644 index 00000000000000..5480be31af2381 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rankFunctionsImplicitExplicitFrame.sql @@ -0,0 +1,4 @@ +select orderkey, discount, +dense_rank() over (order by discount), +rank() over (order by discount range between unbounded preceding and current row) +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsBounded.sql b/regression-test/suites/window_functions/sql/rowsBounded.sql new file mode 100644 index 00000000000000..62a344c4e07bb4 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsBounded.sql @@ -0,0 +1 @@ +SELECT nationkey, min(nationkey) OVER (PARTITION BY regionkey ORDER BY nationkey ROWS BETWEEN 2 PRECEDING AND 1 FOLLOWING) AS min FROM tpch_tiny_nation diff --git a/regression-test/suites/window_functions/sql/rowsDifferentOrders.sql b/regression-test/suites/window_functions/sql/rowsDifferentOrders.sql new file mode 100644 index 00000000000000..df8a069650c965 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsDifferentOrders.sql @@ -0,0 +1,6 @@ +select orderkey, suppkey, +extendedprice, +round(sum(extendedprice) over (partition by suppkey order by orderkey desc rows between unbounded preceding and current row), 5) total_extendedprice, +discount, +round(avg(discount) over (partition by suppkey order by orderkey asc rows between unbounded preceding and current row), 5) avg_discount +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsDisjointWindows.sql b/regression-test/suites/window_functions/sql/rowsDisjointWindows.sql new file mode 100644 index 00000000000000..2a629f1559e3d0 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsDisjointWindows.sql @@ -0,0 +1,9 @@ +select orderkey, suppkey, +quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and 1 preceding), 5) total_quantity, +extendedprice, +round(sum(extendedprice) over (partition by suppkey order by orderkey rows between current row and 1 following), 5) +total_extendedprice, +discount, +round(avg(discount) over (partition by suppkey order by orderkey rows between 3 following and unbounded following), 5) avg_discount +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsFirstLast.sql b/regression-test/suites/window_functions/sql/rowsFirstLast.sql new file mode 100644 index 00000000000000..fdd2b23757ab82 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsFirstLast.sql @@ -0,0 +1,4 @@ +select orderkey, suppkey, extendedprice, +first_value(extendedprice) over (partition by suppkey order by extendedprice desc rows between unbounded preceding and unbounded following), +last_value(extendedprice) over (partition by suppkey order by extendedprice desc rows between unbounded preceding and unbounded following) +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsFrame2F3F.sql b/regression-test/suites/window_functions/sql/rowsFrame2F3F.sql new file mode 100644 index 00000000000000..bd63e42b3e0f27 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsFrame2F3F.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between 2 following and 3 following), 5) total_quantity +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsFrame2FUBF.sql b/regression-test/suites/window_functions/sql/rowsFrame2FUBF.sql new file mode 100644 index 00000000000000..278ee2f6d82382 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsFrame2FUBF.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between 2 following and unbounded following), 5) total_quantity +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsFrame3P2P.sql b/regression-test/suites/window_functions/sql/rowsFrame3P2P.sql new file mode 100644 index 00000000000000..f8803e8a943872 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsFrame3P2P.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between 3 preceding and 2 preceding), 5) total_quantity +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsFrameUBP2P.sql b/regression-test/suites/window_functions/sql/rowsFrameUBP2P.sql new file mode 100644 index 00000000000000..9d6990a1c38fbc --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsFrameUBP2P.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and 2 preceding), 5) total_quantity +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsIdenticalWindows.sql b/regression-test/suites/window_functions/sql/rowsIdenticalWindows.sql new file mode 100644 index 00000000000000..8cf51f0db1eca2 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsIdenticalWindows.sql @@ -0,0 +1,9 @@ +select orderkey, suppkey, +quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 5) total_quantity, +extendedprice, +round(sum(extendedprice) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 5) +total_extendedprice, +discount, +round(avg(discount) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 5) avg_discount +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsIntersectingWindows.sql b/regression-test/suites/window_functions/sql/rowsIntersectingWindows.sql new file mode 100644 index 00000000000000..84f90e8d441a36 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsIntersectingWindows.sql @@ -0,0 +1,9 @@ +select orderkey, suppkey, +quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows between 3 preceding and 1 following), 5) total_quantity, +extendedprice, +round(sum(extendedprice) over (partition by suppkey order by orderkey rows between 1 preceding and 2 following), 5) +total_extendedprice, +discount, +round(avg(discount) over (partition by suppkey order by orderkey rows between current row and unbounded following), 5) avg_discount +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsUBPImplicitCR.sql b/regression-test/suites/window_functions/sql/rowsUBPImplicitCR.sql new file mode 100644 index 00000000000000..a1a3757cf8add4 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsUBPImplicitCR.sql @@ -0,0 +1,3 @@ +select orderkey, suppkey, quantity, +round(sum(quantity) over (partition by suppkey order by orderkey rows unbounded preceding), 5) total_quantity +from tpch_tiny_lineitem where partkey = 272 diff --git a/regression-test/suites/window_functions/sql/rowsUnbounded.sql b/regression-test/suites/window_functions/sql/rowsUnbounded.sql new file mode 100644 index 00000000000000..b6e2f3b0cd29b5 --- /dev/null +++ b/regression-test/suites/window_functions/sql/rowsUnbounded.sql @@ -0,0 +1 @@ +SELECT nationkey, min(nationkey) OVER (PARTITION BY regionkey ORDER BY comment ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) AS min FROM tpch_tiny_nation diff --git a/regression-test/suites/window_functions/sql/windowSpecificationAAcpA.sql b/regression-test/suites/window_functions/sql/windowSpecificationAAcpA.sql new file mode 100644 index 00000000000000..37bb4d1d8e4f73 --- /dev/null +++ b/regression-test/suites/window_functions/sql/windowSpecificationAAcpA.sql @@ -0,0 +1,7 @@ +select +suppkey, orderkey, partkey, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_quantity_A, +first_value(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row) first_value_quantity_A, +round(sum(discount) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_discount_A + +from tpch_tiny_lineitem where (partkey = 272 or partkey = 273) and suppkey > 50 diff --git a/regression-test/suites/window_functions/sql/windowSpecificationABA.sql b/regression-test/suites/window_functions/sql/windowSpecificationABA.sql new file mode 100644 index 00000000000000..e28e493d91c958 --- /dev/null +++ b/regression-test/suites/window_functions/sql/windowSpecificationABA.sql @@ -0,0 +1,7 @@ +select +suppkey, orderkey, partkey, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_quantity_A, +round(sum(quantity) over (partition by orderkey order by shipdate rows between UNBOUNDED preceding and CURRENT ROW), 3) sum_quantity_B, +round(sum(discount) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_discount_A + +from tpch_tiny_lineitem where (partkey = 272 or partkey = 273) and suppkey > 50 diff --git a/regression-test/suites/window_functions/sql/windowSpecificationABcpA.sql b/regression-test/suites/window_functions/sql/windowSpecificationABcpA.sql new file mode 100644 index 00000000000000..784fd60757f0c6 --- /dev/null +++ b/regression-test/suites/window_functions/sql/windowSpecificationABcpA.sql @@ -0,0 +1,7 @@ +select +suppkey, orderkey, partkey, +round(sum(quantity) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_quantity_A, +lag(quantity, 1, 0.0) over (partition by partkey order by orderkey) lag_quantity_B, +round(sum(discount) over (partition by suppkey order by orderkey rows between unbounded preceding and current row), 3) sum_discount_A + +from tpch_tiny_lineitem where (partkey = 272 or partkey = 273) and suppkey > 50