diff --git a/fe/src/main/java/com/cloudera/impala/analysis/SelectStmt.java b/fe/src/main/java/com/cloudera/impala/analysis/SelectStmt.java index aaf2762fd..24ffe5b0d 100644 --- a/fe/src/main/java/com/cloudera/impala/analysis/SelectStmt.java +++ b/fe/src/main/java/com/cloudera/impala/analysis/SelectStmt.java @@ -243,12 +243,10 @@ public class SelectStmt extends QueryStmt { * @param desc * @throws AnalysisException */ - private void expandStar(Analyzer analyzer, String alias, - TupleDescriptor desc) + private void expandStar(Analyzer analyzer, String alias, TupleDescriptor desc) throws AnalysisException { - for (Column col: desc.getTable().getColumns()) { - resultExprs.add( - new SlotRef(new TableName(null, alias), col.getName())); + for (Column col: desc.getTable().getColumnsInHiveOrder()) { + resultExprs.add(new SlotRef(new TableName(null, alias), col.getName())); colLabels.add(col.getName().toLowerCase()); } } diff --git a/fe/src/main/java/com/cloudera/impala/catalog/HBaseTable.java b/fe/src/main/java/com/cloudera/impala/catalog/HBaseTable.java index 7a4bcb1a7..4cf3c6129 100644 --- a/fe/src/main/java/com/cloudera/impala/catalog/HBaseTable.java +++ b/fe/src/main/java/com/cloudera/impala/catalog/HBaseTable.java @@ -333,6 +333,14 @@ public class HBaseTable extends Table { return (long) ((isCompressed ? 2 : 1) * (hdfsSize / bytesPerRow)); } + /** + * Hive returns the columns in order of their declaration for HBase tables. + */ + @Override + public ArrayList getColumnsInHiveOrder() { + return colsByPos; + } + @Override public TTableDescriptor toThrift() { THBaseTable tHbaseTable = new THBaseTable(); diff --git a/fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java b/fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java index 200f7db0f..093a3966c 100644 --- a/fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java +++ b/fe/src/test/java/com/cloudera/impala/analysis/AnalyzerTest.java @@ -235,11 +235,11 @@ public class AnalyzerTest { checkLayoutParams("functional.alltypes.bool_col", 1, 2, 0, 0); checkLayoutParams("functional.alltypes.tinyint_col", 1, 3, 0, 1); checkLayoutParams("functional.alltypes.smallint_col", 2, 4, 0, 2); - checkLayoutParams("functional.alltypes.year", 4, 8, 0, 3); - checkLayoutParams("functional.alltypes.month", 4, 12, 0, 4); - checkLayoutParams("functional.alltypes.id", 4, 16, 0, 5); - checkLayoutParams("functional.alltypes.int_col", 4, 20, 0, 6); - checkLayoutParams("functional.alltypes.float_col", 4, 24, 0, 7); + checkLayoutParams("functional.alltypes.id", 4, 8, 0, 3); + checkLayoutParams("functional.alltypes.int_col", 4, 12, 0, 4); + checkLayoutParams("functional.alltypes.float_col", 4, 16, 0, 5); + checkLayoutParams("functional.alltypes.year", 4, 20, 0, 6); + checkLayoutParams("functional.alltypes.month", 4, 24, 0, 7); checkLayoutParams("functional.alltypes.bigint_col", 8, 32, 1, 0); checkLayoutParams("functional.alltypes.double_col", 8, 40, 1, 1); int strSlotSize = PrimitiveType.STRING.getSlotSize(); @@ -331,7 +331,7 @@ public class AnalyzerTest { AnalysisError("select * from " + "(select * from functional.alltypes a join " + "functional.alltypes b on (a.int_col = b.int_col)) x", - "duplicated inline view column alias: 'year' in inline view 'x'"); + "duplicated inline view column alias: 'id' in inline view 'x'"); // subquery on the rhs of the join AnalyzesOk("select x.float_col " + @@ -2217,6 +2217,10 @@ public class AnalyzerTest { "select id, bool_col, tinyint_col, smallint_col, int_col, bigint_col, " + "float_col, double_col, date_string_col, string_col, timestamp_col " + "from functional.alltypes"); + // Select '*' includes partitioning columns at the end. + AnalyzesOk("insert " + qualifier + + " table functional.alltypessmall partition (year, month)" + + "select * from functional.alltypes"); // No corresponding select list items of fully dynamic partitions. AnalysisError("insert " + qualifier + " table functional.alltypessmall " + "partition (year, month)" + @@ -2251,15 +2255,6 @@ public class AnalyzerTest { "Target table 'alltypessmall' and result of select statement are not union " + "compatible.\n" + "Target table expects 11 columns but the select statement returns 13."); - // Select '*' includes partitioning columns - // but they don't appear at the end of the select list. - AnalysisError("insert " + qualifier + - " table functional.alltypessmall partition (year, month)" + - "select * from functional.alltypes", - "Target table 'alltypessmall' and result of select statement are not union " + - "compatible.\n" + - "Incompatible types 'INT' and 'STRING' in column " + - "'functional.alltypes.string_col'."); } /** diff --git a/testdata/workloads/functional-planner/queries/PlannerTest/union.test b/testdata/workloads/functional-planner/queries/PlannerTest/union.test index c2615ef6b..2c31073fc 100644 --- a/testdata/workloads/functional-planner/queries/PlannerTest/union.test +++ b/testdata/workloads/functional-planner/queries/PlannerTest/union.test @@ -252,11 +252,11 @@ NODE 3: // Only UNION ALL, mixed selects with and without from clauses, no nested unions select * from functional.alltypestiny where year=2009 and month=1 union all -select 2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) +select 0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1 union all select * from functional.alltypestiny where year=2009 and month=1 union all -select 2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) +select 1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1 ---- PLAN Plan Fragment 0 UNPARTITIONED @@ -317,11 +317,11 @@ NODE 2: // Only UNION DISTINCT, mixed selects with and without from clauses, no nested unions select * from functional.alltypestiny where year=2009 and month=1 union distinct -select 2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) +select 0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1 union distinct select * from functional.alltypestiny where year=2009 and month=1 union distinct -select 2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) +select 1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1 ---- PLAN Plan Fragment 0 UNPARTITIONED @@ -3164,7 +3164,7 @@ Plan Fragment 0 UNPARTITIONED MERGE (0) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (1) TUPLE IDS: 0 SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (2) @@ -3183,7 +3183,7 @@ Plan Fragment 1 MERGE (5) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (2) TUPLE IDS: 1 @@ -3195,7 +3195,7 @@ Plan Fragment 2 MERGE (4) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (1) TUPLE IDS: 0 ---- SCANRANGELOCATIONS @@ -3221,7 +3221,7 @@ Plan Fragment 0 TUPLE IDS: 2 MERGE (0) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (1) TUPLE IDS: 0 SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (2) @@ -3244,7 +3244,7 @@ Plan Fragment 1 MERGE (6) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (2) TUPLE IDS: 1 @@ -3256,7 +3256,7 @@ Plan Fragment 2 MERGE (5) TUPLE IDS: 2 - PREDICATES: < 5, = FALSE + PREDICATES: < 5, = FALSE SCAN HDFS table=functional.alltypestiny #partitions=1 size=115B (1) TUPLE IDS: 0 ---- SCANRANGELOCATIONS diff --git a/testdata/workloads/functional-query/queries/DataErrorsTest/hdfs-scan-node-errors.test b/testdata/workloads/functional-query/queries/DataErrorsTest/hdfs-scan-node-errors.test index c02070c71..3d9b86cb8 100644 --- a/testdata/workloads/functional-query/queries/DataErrorsTest/hdfs-scan-node-errors.test +++ b/testdata/workloads/functional-query/queries/DataErrorsTest/hdfs-scan-node-errors.test @@ -140,38 +140,38 @@ Error converting column: 4 TO INT (Data is: abc9) file: hdfs: test-warehouse/alltypeserrornonulls$DATABASE/year=2009/month=3 record: 29,false,9,9,abc9,90,9.000000,90.900000,03/01/09,9,2012-03-22 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',NULL -2009,1,1,NULL,1,1,1,10,1,10.1,'01/01/09','1',NULL -2009,1,2,true,NULL,2,2,20,2,20.2,'01/01/09','2',2012-03-22 11:20:01.123000000 -2009,1,3,false,3,NULL,3,30,3,30.3,'01/01/09','3',2012-03-22 11:20:01.123000000 -2009,1,4,true,4,4,NULL,40,4,40.4,'01/01/09','4',2012-03-22 11:20:01.123000000 -2009,1,5,false,5,5,5,NULL,5,50.5,'01/01/09','5',2012-03-22 11:20:01.123000000 -2009,1,6,true,6,6,6,60,NULL,60.6,'01/01/09','6',2012-03-22 11:20:01.123000000 -2009,1,7,false,7,7,7,70,7,NULL,'01/01/09','7',2012-03-22 11:20:01.123000000 -2009,1,8,false,8,8,8,80,8,80.8,'01/01/09','8',2012-03-22 11:20:01.123000000 -2009,1,9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/09','9',2012-03-22 11:20:01.123000000 -2009,2,10,true,0,0,0,0,0,0,'02/01/09','0',2012-03-22 11:20:01.123000000 -2009,2,11,false,1,1,1,10,1,10.1,'02/01/09','1',2012-03-22 11:20:01.123000000 -2009,2,12,true,2,2,2,20,2,20.2,'02/01/09','2',2012-03-22 11:20:01.123000000 -2009,2,13,false,3,3,3,30,NULL,NULL,'02/01/09','3',2012-03-22 11:20:01.123000000 -2009,2,14,true,4,4,4,40,4,40.4,'02/01/09','4',2012-03-22 11:20:01.123000000 -2009,2,15,false,NULL,5,5,50,5,50.5,'02/01/09','5',2012-03-22 11:20:01.123000000 -2009,2,16,true,6,6,6,60,6,60.6,'02/01/09','6',2012-03-22 11:20:01.123000000 -2009,2,17,false,7,7,7,70,7,NULL,'02/01/09','7',2012-03-22 11:20:01.123000000 -2009,2,18,true,8,8,8,80,8,80.8,'02/01/09','8',2012-03-22 11:20:01.123000000 -2009,2,19,false,9,9,9,90,9,90.90000000000001,'02/01/09','9',2012-03-22 11:20:01.123000000 -2009,3,20,true,0,0,0,0,0,0,'03/01/09','0',2012-03-22 11:20:01.123000000 -2009,3,21,false,1,1,1,10,1,10.1,'03/01/09','1',2012-03-22 11:20:01.123000000 -2009,3,22,true,2,2,2,20,2,20.2,'03/01/09','2',2012-03-22 11:20:01.123000000 -2009,3,23,false,3,NULL,3,30,3,30.3,'03/01/09','3',2012-03-22 11:20:01.123000000 -2009,3,24,true,4,4,4,40,4,40.4,'03/01/09','4',2012-03-22 11:20:01.123000000 -2009,3,25,false,5,5,NULL,50,5,50.5,'03/01/09','5',NULL -2009,3,26,true,6,6,6,60,6,60.6,'03/01/09','6',2012-03-22 11:20:01.123000000 -2009,3,27,false,NULL,7,7,70,7,70.7,'03/01/09','7',2012-03-22 11:20:01.123000000 -2009,3,28,true,8,8,8,80,8,80.8,'03/01/09','8',NULL -2009,3,29,false,9,9,NULL,90,9,90.90000000000001,'03/01/09','9',2012-03-22 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',NULL,2009,1 +1,NULL,1,1,1,10,1,10.1,'01/01/09','1',NULL,2009,1 +2,true,NULL,2,2,20,2,20.2,'01/01/09','2',2012-03-22 11:20:01.123000000,2009,1 +3,false,3,NULL,3,30,3,30.3,'01/01/09','3',2012-03-22 11:20:01.123000000,2009,1 +4,true,4,4,NULL,40,4,40.4,'01/01/09','4',2012-03-22 11:20:01.123000000,2009,1 +5,false,5,5,5,NULL,5,50.5,'01/01/09','5',2012-03-22 11:20:01.123000000,2009,1 +6,true,6,6,6,60,NULL,60.6,'01/01/09','6',2012-03-22 11:20:01.123000000,2009,1 +7,false,7,7,7,70,7,NULL,'01/01/09','7',2012-03-22 11:20:01.123000000,2009,1 +8,false,8,8,8,80,8,80.8,'01/01/09','8',2012-03-22 11:20:01.123000000,2009,1 +9,NULL,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/09','9',2012-03-22 11:20:01.123000000,2009,1 +10,true,0,0,0,0,0,0,'02/01/09','0',2012-03-22 11:20:01.123000000,2009,2 +11,false,1,1,1,10,1,10.1,'02/01/09','1',2012-03-22 11:20:01.123000000,2009,2 +12,true,2,2,2,20,2,20.2,'02/01/09','2',2012-03-22 11:20:01.123000000,2009,2 +13,false,3,3,3,30,NULL,NULL,'02/01/09','3',2012-03-22 11:20:01.123000000,2009,2 +14,true,4,4,4,40,4,40.4,'02/01/09','4',2012-03-22 11:20:01.123000000,2009,2 +15,false,NULL,5,5,50,5,50.5,'02/01/09','5',2012-03-22 11:20:01.123000000,2009,2 +16,true,6,6,6,60,6,60.6,'02/01/09','6',2012-03-22 11:20:01.123000000,2009,2 +17,false,7,7,7,70,7,NULL,'02/01/09','7',2012-03-22 11:20:01.123000000,2009,2 +18,true,8,8,8,80,8,80.8,'02/01/09','8',2012-03-22 11:20:01.123000000,2009,2 +19,false,9,9,9,90,9,90.90000000000001,'02/01/09','9',2012-03-22 11:20:01.123000000,2009,2 +20,true,0,0,0,0,0,0,'03/01/09','0',2012-03-22 11:20:01.123000000,2009,3 +21,false,1,1,1,10,1,10.1,'03/01/09','1',2012-03-22 11:20:01.123000000,2009,3 +22,true,2,2,2,20,2,20.2,'03/01/09','2',2012-03-22 11:20:01.123000000,2009,3 +23,false,3,NULL,3,30,3,30.3,'03/01/09','3',2012-03-22 11:20:01.123000000,2009,3 +24,true,4,4,4,40,4,40.4,'03/01/09','4',2012-03-22 11:20:01.123000000,2009,3 +25,false,5,5,NULL,50,5,50.5,'03/01/09','5',NULL,2009,3 +26,true,6,6,6,60,6,60.6,'03/01/09','6',2012-03-22 11:20:01.123000000,2009,3 +27,false,NULL,7,7,70,7,70.7,'03/01/09','7',2012-03-22 11:20:01.123000000,2009,3 +28,true,8,8,8,80,8,80.8,'03/01/09','8',NULL,2009,3 +29,false,9,9,NULL,90,9,90.90000000000001,'03/01/09','9',2012-03-22 00:00:00,2009,3 ==== ---- QUERY select count(*) from functional_text_lzo.bad_text_lzo diff --git a/testdata/workloads/functional-query/queries/QueryTest/create.test b/testdata/workloads/functional-query/queries/QueryTest/create.test index d6fda569f..8d5b860de 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/create.test +++ b/testdata/workloads/functional-query/queries/QueryTest/create.test @@ -115,18 +115,18 @@ id=2/: 2 ---- QUERY select * from ddl_test_db.testtbl_part ---- RESULTS -1,10,'Ten' -2,20,'Twenty' -2,20,'Twenty' +10,'Ten',1 +20,'Twenty',2 +20,'Twenty',2 ---- TYPES -int, int, string +int, string, int ==== ---- QUERY select * from ddl_test_db.testtbl_part where id = 1 ---- RESULTS -1,10,'Ten' +10,'Ten',1 ---- TYPES -int, int, string +int, string, int ==== ---- QUERY use ddl_test_db diff --git a/testdata/workloads/functional-query/queries/QueryTest/distinct.test b/testdata/workloads/functional-query/queries/QueryTest/distinct.test index 8b28b762d..9ff6325b7 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/distinct.test +++ b/testdata/workloads/functional-query/queries/QueryTest/distinct.test @@ -162,28 +162,28 @@ select distinct * from alltypesagg where id < 20 ---- TYPES -int, int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int, int ---- RESULTS -2010,1,1,0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00 -2010,1,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/10','1',2010-01-01 00:01:00 -2010,1,1,10,true,NULL,10,10,100,11,101,'01/01/10','10',2010-01-01 00:10:00.450000000 -2010,1,1,11,false,1,11,11,110,12.10000038146973,111.1,'01/01/10','11',2010-01-01 00:11:00.550000000 -2010,1,1,12,true,2,12,12,120,13.19999980926514,121.2,'01/01/10','12',2010-01-01 00:12:00.660000000 -2010,1,1,13,false,3,13,13,130,14.30000019073486,131.3,'01/01/10','13',2010-01-01 00:13:00.780000000 -2010,1,1,14,true,4,14,14,140,15.39999961853027,141.4,'01/01/10','14',2010-01-01 00:14:00.910000000 -2010,1,1,15,false,5,15,15,150,16.5,151.5,'01/01/10','15',2010-01-01 00:15:01.500000000 -2010,1,1,16,true,6,16,16,160,17.60000038146973,161.6,'01/01/10','16',2010-01-01 00:16:01.200000000 -2010,1,1,17,false,7,17,17,170,18.70000076293945,171.7,'01/01/10','17',2010-01-01 00:17:01.360000000 -2010,1,1,18,true,8,18,18,180,19.79999923706055,181.8,'01/01/10','18',2010-01-01 00:18:01.530000000 -2010,1,1,19,false,9,19,19,190,20.89999961853027,191.9,'01/01/10','19',2010-01-01 00:19:01.710000000 -2010,1,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/10','2',2010-01-01 00:02:00.100000000 -2010,1,1,3,false,3,3,3,30,3.299999952316284,30.3,'01/01/10','3',2010-01-01 00:03:00.300000000 -2010,1,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/10','4',2010-01-01 00:04:00.600000000 -2010,1,1,5,false,5,5,5,50,5.5,50.5,'01/01/10','5',2010-01-01 00:05:00.100000000 -2010,1,1,6,true,6,6,6,60,6.599999904632568,60.6,'01/01/10','6',2010-01-01 00:06:00.150000000 -2010,1,1,7,false,7,7,7,70,7.699999809265137,70.7,'01/01/10','7',2010-01-01 00:07:00.210000000 -2010,1,1,8,true,8,8,8,80,8.800000190734863,80.8,'01/01/10','8',2010-01-01 00:08:00.280000000 -2010,1,1,9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/10','9',2010-01-01 00:09:00.360000000 +0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00,2010,1,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/10','1',2010-01-01 00:01:00,2010,1,1 +10,true,NULL,10,10,100,11,101,'01/01/10','10',2010-01-01 00:10:00.450000000,2010,1,1 +11,false,1,11,11,110,12.10000038146973,111.1,'01/01/10','11',2010-01-01 00:11:00.550000000,2010,1,1 +12,true,2,12,12,120,13.19999980926514,121.2,'01/01/10','12',2010-01-01 00:12:00.660000000,2010,1,1 +13,false,3,13,13,130,14.30000019073486,131.3,'01/01/10','13',2010-01-01 00:13:00.780000000,2010,1,1 +14,true,4,14,14,140,15.39999961853027,141.4,'01/01/10','14',2010-01-01 00:14:00.910000000,2010,1,1 +15,false,5,15,15,150,16.5,151.5,'01/01/10','15',2010-01-01 00:15:01.500000000,2010,1,1 +16,true,6,16,16,160,17.60000038146973,161.6,'01/01/10','16',2010-01-01 00:16:01.200000000,2010,1,1 +17,false,7,17,17,170,18.70000076293945,171.7,'01/01/10','17',2010-01-01 00:17:01.360000000,2010,1,1 +18,true,8,18,18,180,19.79999923706055,181.8,'01/01/10','18',2010-01-01 00:18:01.530000000,2010,1,1 +19,false,9,19,19,190,20.89999961853027,191.9,'01/01/10','19',2010-01-01 00:19:01.710000000,2010,1,1 +2,true,2,2,2,20,2.200000047683716,20.2,'01/01/10','2',2010-01-01 00:02:00.100000000,2010,1,1 +3,false,3,3,3,30,3.299999952316284,30.3,'01/01/10','3',2010-01-01 00:03:00.300000000,2010,1,1 +4,true,4,4,4,40,4.400000095367432,40.4,'01/01/10','4',2010-01-01 00:04:00.600000000,2010,1,1 +5,false,5,5,5,50,5.5,50.5,'01/01/10','5',2010-01-01 00:05:00.100000000,2010,1,1 +6,true,6,6,6,60,6.599999904632568,60.6,'01/01/10','6',2010-01-01 00:06:00.150000000,2010,1,1 +7,false,7,7,7,70,7.699999809265137,70.7,'01/01/10','7',2010-01-01 00:07:00.210000000,2010,1,1 +8,true,8,8,8,80,8.800000190734863,80.8,'01/01/10','8',2010-01-01 00:08:00.280000000,2010,1,1 +9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/10','9',2010-01-01 00:09:00.360000000,2010,1,1 ==== ---- QUERY # distinct w/ explicit select list diff --git a/testdata/workloads/functional-query/queries/QueryTest/hbase-inserts.test b/testdata/workloads/functional-query/queries/QueryTest/hbase-inserts.test index 75629531c..a7423ab64 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/hbase-inserts.test +++ b/testdata/workloads/functional-query/queries/QueryTest/hbase-inserts.test @@ -37,4 +37,13 @@ LIMIT 2 int, boolean ---- RESULTS 9999999,false +==== +---- QUERY +# test insert into ... select * +insert into table hbaseinsertalltypesagg +select * from hbaseinsertalltypesagg +---- RESULTS +: 10001 +---- SETUP +RELOAD hbaseinsertalltypesagg ==== \ No newline at end of file diff --git a/testdata/workloads/functional-query/queries/QueryTest/hdfs-scan-node.test b/testdata/workloads/functional-query/queries/QueryTest/hdfs-scan-node.test index a05d037d8..30d9ecc53 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/hdfs-scan-node.test +++ b/testdata/workloads/functional-query/queries/QueryTest/hdfs-scan-node.test @@ -431,108 +431,108 @@ int ---- QUERY select * from alltypessmall ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,10,true,0,0,0,0,0,0,'01/02/09','0',2009-01-02 00:10:00.450000000 -2009,1,11,false,1,1,1,10,1.100000023841858,10.1,'01/02/09','1',2009-01-02 00:11:00.450000000 -2009,1,12,true,2,2,2,20,2.200000047683716,20.2,'01/02/09','2',2009-01-02 00:12:00.460000000 -2009,1,13,false,3,3,3,30,3.299999952316284,30.3,'01/02/09','3',2009-01-02 00:13:00.480000000 -2009,1,14,true,4,4,4,40,4.400000095367432,40.4,'01/02/09','4',2009-01-02 00:14:00.510000000 -2009,1,15,false,5,5,5,50,5.5,50.5,'01/02/09','5',2009-01-02 00:15:00.550000000 -2009,1,16,true,6,6,6,60,6.599999904632568,60.6,'01/02/09','6',2009-01-02 00:16:00.600000000 -2009,1,17,false,7,7,7,70,7.699999809265137,70.7,'01/02/09','7',2009-01-02 00:17:00.660000000 -2009,1,18,true,8,8,8,80,8.800000190734863,80.8,'01/02/09','8',2009-01-02 00:18:00.730000000 -2009,1,19,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/02/09','9',2009-01-02 00:19:00.810000000 -2009,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000 -2009,1,20,true,0,0,0,0,0,0,'01/03/09','0',2009-01-03 00:20:00.900000000 -2009,1,21,false,1,1,1,10,1.100000023841858,10.1,'01/03/09','1',2009-01-03 00:21:00.900000000 -2009,1,22,true,2,2,2,20,2.200000047683716,20.2,'01/03/09','2',2009-01-03 00:22:00.910000000 -2009,1,23,false,3,3,3,30,3.299999952316284,30.3,'01/03/09','3',2009-01-03 00:23:00.930000000 -2009,1,24,true,4,4,4,40,4.400000095367432,40.4,'01/03/09','4',2009-01-03 00:24:00.960000000 -2009,1,3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000 -2009,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000 -2009,1,5,false,5,5,5,50,5.5,50.5,'01/01/09','5',2009-01-01 00:05:00.100000000 -2009,1,6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000 -2009,1,7,false,7,7,7,70,7.699999809265137,70.7,'01/01/09','7',2009-01-01 00:07:00.210000000 -2009,1,8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000 -2009,1,9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/09','9',2009-01-01 00:09:00.360000000 -2009,2,25,false,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,26,true,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,2,27,false,2,2,2,20,2.200000047683716,20.2,'02/01/09','2',2009-02-01 00:02:00.100000000 -2009,2,28,true,3,3,3,30,3.299999952316284,30.3,'02/01/09','3',2009-02-01 00:03:00.300000000 -2009,2,29,false,4,4,4,40,4.400000095367432,40.4,'02/01/09','4',2009-02-01 00:04:00.600000000 -2009,2,30,true,5,5,5,50,5.5,50.5,'02/01/09','5',2009-02-01 00:05:00.100000000 -2009,2,31,false,6,6,6,60,6.599999904632568,60.6,'02/01/09','6',2009-02-01 00:06:00.150000000 -2009,2,32,true,7,7,7,70,7.699999809265137,70.7,'02/01/09','7',2009-02-01 00:07:00.210000000 -2009,2,33,false,8,8,8,80,8.800000190734863,80.8,'02/01/09','8',2009-02-01 00:08:00.280000000 -2009,2,34,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/01/09','9',2009-02-01 00:09:00.360000000 -2009,2,35,false,0,0,0,0,0,0,'02/02/09','0',2009-02-02 00:10:00.450000000 -2009,2,36,true,1,1,1,10,1.100000023841858,10.1,'02/02/09','1',2009-02-02 00:11:00.450000000 -2009,2,37,false,2,2,2,20,2.200000047683716,20.2,'02/02/09','2',2009-02-02 00:12:00.460000000 -2009,2,38,true,3,3,3,30,3.299999952316284,30.3,'02/02/09','3',2009-02-02 00:13:00.480000000 -2009,2,39,false,4,4,4,40,4.400000095367432,40.4,'02/02/09','4',2009-02-02 00:14:00.510000000 -2009,2,40,true,5,5,5,50,5.5,50.5,'02/02/09','5',2009-02-02 00:15:00.550000000 -2009,2,41,false,6,6,6,60,6.599999904632568,60.6,'02/02/09','6',2009-02-02 00:16:00.600000000 -2009,2,42,true,7,7,7,70,7.699999809265137,70.7,'02/02/09','7',2009-02-02 00:17:00.660000000 -2009,2,43,false,8,8,8,80,8.800000190734863,80.8,'02/02/09','8',2009-02-02 00:18:00.730000000 -2009,2,44,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/02/09','9',2009-02-02 00:19:00.810000000 -2009,2,45,false,0,0,0,0,0,0,'02/03/09','0',2009-02-03 00:20:00.900000000 -2009,2,46,true,1,1,1,10,1.100000023841858,10.1,'02/03/09','1',2009-02-03 00:21:00.900000000 -2009,2,47,false,2,2,2,20,2.200000047683716,20.2,'02/03/09','2',2009-02-03 00:22:00.910000000 -2009,2,48,true,3,3,3,30,3.299999952316284,30.3,'02/03/09','3',2009-02-03 00:23:00.930000000 -2009,2,49,false,4,4,4,40,4.400000095367432,40.4,'02/03/09','4',2009-02-03 00:24:00.960000000 -2009,3,50,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,51,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00 -2009,3,52,true,2,2,2,20,2.200000047683716,20.2,'03/01/09','2',2009-03-01 00:02:00.100000000 -2009,3,53,false,3,3,3,30,3.299999952316284,30.3,'03/01/09','3',2009-03-01 00:03:00.300000000 -2009,3,54,true,4,4,4,40,4.400000095367432,40.4,'03/01/09','4',2009-03-01 00:04:00.600000000 -2009,3,55,false,5,5,5,50,5.5,50.5,'03/01/09','5',2009-03-01 00:05:00.100000000 -2009,3,56,true,6,6,6,60,6.599999904632568,60.6,'03/01/09','6',2009-03-01 00:06:00.150000000 -2009,3,57,false,7,7,7,70,7.699999809265137,70.7,'03/01/09','7',2009-03-01 00:07:00.210000000 -2009,3,58,true,8,8,8,80,8.800000190734863,80.8,'03/01/09','8',2009-03-01 00:08:00.280000000 -2009,3,59,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/01/09','9',2009-03-01 00:09:00.360000000 -2009,3,60,true,0,0,0,0,0,0,'03/02/09','0',2009-03-02 00:10:00.450000000 -2009,3,61,false,1,1,1,10,1.100000023841858,10.1,'03/02/09','1',2009-03-02 00:11:00.450000000 -2009,3,62,true,2,2,2,20,2.200000047683716,20.2,'03/02/09','2',2009-03-02 00:12:00.460000000 -2009,3,63,false,3,3,3,30,3.299999952316284,30.3,'03/02/09','3',2009-03-02 00:13:00.480000000 -2009,3,64,true,4,4,4,40,4.400000095367432,40.4,'03/02/09','4',2009-03-02 00:14:00.510000000 -2009,3,65,false,5,5,5,50,5.5,50.5,'03/02/09','5',2009-03-02 00:15:00.550000000 -2009,3,66,true,6,6,6,60,6.599999904632568,60.6,'03/02/09','6',2009-03-02 00:16:00.600000000 -2009,3,67,false,7,7,7,70,7.699999809265137,70.7,'03/02/09','7',2009-03-02 00:17:00.660000000 -2009,3,68,true,8,8,8,80,8.800000190734863,80.8,'03/02/09','8',2009-03-02 00:18:00.730000000 -2009,3,69,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/02/09','9',2009-03-02 00:19:00.810000000 -2009,3,70,true,0,0,0,0,0,0,'03/03/09','0',2009-03-03 00:20:00.900000000 -2009,3,71,false,1,1,1,10,1.100000023841858,10.1,'03/03/09','1',2009-03-03 00:21:00.900000000 -2009,3,72,true,2,2,2,20,2.200000047683716,20.2,'03/03/09','2',2009-03-03 00:22:00.910000000 -2009,3,73,false,3,3,3,30,3.299999952316284,30.3,'03/03/09','3',2009-03-03 00:23:00.930000000 -2009,3,74,true,4,4,4,40,4.400000095367432,40.4,'03/03/09','4',2009-03-03 00:24:00.960000000 -2009,4,75,false,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00 -2009,4,76,true,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00 -2009,4,77,false,2,2,2,20,2.200000047683716,20.2,'04/01/09','2',2009-04-01 00:02:00.100000000 -2009,4,78,true,3,3,3,30,3.299999952316284,30.3,'04/01/09','3',2009-04-01 00:03:00.300000000 -2009,4,79,false,4,4,4,40,4.400000095367432,40.4,'04/01/09','4',2009-04-01 00:04:00.600000000 -2009,4,80,true,5,5,5,50,5.5,50.5,'04/01/09','5',2009-04-01 00:05:00.100000000 -2009,4,81,false,6,6,6,60,6.599999904632568,60.6,'04/01/09','6',2009-04-01 00:06:00.150000000 -2009,4,82,true,7,7,7,70,7.699999809265137,70.7,'04/01/09','7',2009-04-01 00:07:00.210000000 -2009,4,83,false,8,8,8,80,8.800000190734863,80.8,'04/01/09','8',2009-04-01 00:08:00.280000000 -2009,4,84,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/01/09','9',2009-04-01 00:09:00.360000000 -2009,4,85,false,0,0,0,0,0,0,'04/02/09','0',2009-04-02 00:10:00.450000000 -2009,4,86,true,1,1,1,10,1.100000023841858,10.1,'04/02/09','1',2009-04-02 00:11:00.450000000 -2009,4,87,false,2,2,2,20,2.200000047683716,20.2,'04/02/09','2',2009-04-02 00:12:00.460000000 -2009,4,88,true,3,3,3,30,3.299999952316284,30.3,'04/02/09','3',2009-04-02 00:13:00.480000000 -2009,4,89,false,4,4,4,40,4.400000095367432,40.4,'04/02/09','4',2009-04-02 00:14:00.510000000 -2009,4,90,true,5,5,5,50,5.5,50.5,'04/02/09','5',2009-04-02 00:15:00.550000000 -2009,4,91,false,6,6,6,60,6.599999904632568,60.6,'04/02/09','6',2009-04-02 00:16:00.600000000 -2009,4,92,true,7,7,7,70,7.699999809265137,70.7,'04/02/09','7',2009-04-02 00:17:00.660000000 -2009,4,93,false,8,8,8,80,8.800000190734863,80.8,'04/02/09','8',2009-04-02 00:18:00.730000000 -2009,4,94,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/02/09','9',2009-04-02 00:19:00.810000000 -2009,4,95,false,0,0,0,0,0,0,'04/03/09','0',2009-04-03 00:20:00.900000000 -2009,4,96,true,1,1,1,10,1.100000023841858,10.1,'04/03/09','1',2009-04-03 00:21:00.900000000 -2009,4,97,false,2,2,2,20,2.200000047683716,20.2,'04/03/09','2',2009-04-03 00:22:00.910000000 -2009,4,98,true,3,3,3,30,3.299999952316284,30.3,'04/03/09','3',2009-04-03 00:23:00.930000000 -2009,4,99,false,4,4,4,40,4.400000095367432,40.4,'04/03/09','4',2009-04-03 00:24:00.960000000 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1 +3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1 +4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1 +5,false,5,5,5,50,5.5,50.5,'01/01/09','5',2009-01-01 00:05:00.100000000,2009,1 +6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000,2009,1 +7,false,7,7,7,70,7.699999809265137,70.7,'01/01/09','7',2009-01-01 00:07:00.210000000,2009,1 +8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000,2009,1 +9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/09','9',2009-01-01 00:09:00.360000000,2009,1 +10,true,0,0,0,0,0,0,'01/02/09','0',2009-01-02 00:10:00.450000000,2009,1 +11,false,1,1,1,10,1.100000023841858,10.1,'01/02/09','1',2009-01-02 00:11:00.450000000,2009,1 +12,true,2,2,2,20,2.200000047683716,20.2,'01/02/09','2',2009-01-02 00:12:00.460000000,2009,1 +13,false,3,3,3,30,3.299999952316284,30.3,'01/02/09','3',2009-01-02 00:13:00.480000000,2009,1 +14,true,4,4,4,40,4.400000095367432,40.4,'01/02/09','4',2009-01-02 00:14:00.510000000,2009,1 +15,false,5,5,5,50,5.5,50.5,'01/02/09','5',2009-01-02 00:15:00.550000000,2009,1 +16,true,6,6,6,60,6.599999904632568,60.6,'01/02/09','6',2009-01-02 00:16:00.600000000,2009,1 +17,false,7,7,7,70,7.699999809265137,70.7,'01/02/09','7',2009-01-02 00:17:00.660000000,2009,1 +18,true,8,8,8,80,8.800000190734863,80.8,'01/02/09','8',2009-01-02 00:18:00.730000000,2009,1 +19,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/02/09','9',2009-01-02 00:19:00.810000000,2009,1 +20,true,0,0,0,0,0,0,'01/03/09','0',2009-01-03 00:20:00.900000000,2009,1 +21,false,1,1,1,10,1.100000023841858,10.1,'01/03/09','1',2009-01-03 00:21:00.900000000,2009,1 +22,true,2,2,2,20,2.200000047683716,20.2,'01/03/09','2',2009-01-03 00:22:00.910000000,2009,1 +23,false,3,3,3,30,3.299999952316284,30.3,'01/03/09','3',2009-01-03 00:23:00.930000000,2009,1 +24,true,4,4,4,40,4.400000095367432,40.4,'01/03/09','4',2009-01-03 00:24:00.960000000,2009,1 +25,false,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +26,true,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +27,false,2,2,2,20,2.200000047683716,20.2,'02/01/09','2',2009-02-01 00:02:00.100000000,2009,2 +28,true,3,3,3,30,3.299999952316284,30.3,'02/01/09','3',2009-02-01 00:03:00.300000000,2009,2 +29,false,4,4,4,40,4.400000095367432,40.4,'02/01/09','4',2009-02-01 00:04:00.600000000,2009,2 +30,true,5,5,5,50,5.5,50.5,'02/01/09','5',2009-02-01 00:05:00.100000000,2009,2 +31,false,6,6,6,60,6.599999904632568,60.6,'02/01/09','6',2009-02-01 00:06:00.150000000,2009,2 +32,true,7,7,7,70,7.699999809265137,70.7,'02/01/09','7',2009-02-01 00:07:00.210000000,2009,2 +33,false,8,8,8,80,8.800000190734863,80.8,'02/01/09','8',2009-02-01 00:08:00.280000000,2009,2 +34,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/01/09','9',2009-02-01 00:09:00.360000000,2009,2 +35,false,0,0,0,0,0,0,'02/02/09','0',2009-02-02 00:10:00.450000000,2009,2 +36,true,1,1,1,10,1.100000023841858,10.1,'02/02/09','1',2009-02-02 00:11:00.450000000,2009,2 +37,false,2,2,2,20,2.200000047683716,20.2,'02/02/09','2',2009-02-02 00:12:00.460000000,2009,2 +38,true,3,3,3,30,3.299999952316284,30.3,'02/02/09','3',2009-02-02 00:13:00.480000000,2009,2 +39,false,4,4,4,40,4.400000095367432,40.4,'02/02/09','4',2009-02-02 00:14:00.510000000,2009,2 +40,true,5,5,5,50,5.5,50.5,'02/02/09','5',2009-02-02 00:15:00.550000000,2009,2 +41,false,6,6,6,60,6.599999904632568,60.6,'02/02/09','6',2009-02-02 00:16:00.600000000,2009,2 +42,true,7,7,7,70,7.699999809265137,70.7,'02/02/09','7',2009-02-02 00:17:00.660000000,2009,2 +43,false,8,8,8,80,8.800000190734863,80.8,'02/02/09','8',2009-02-02 00:18:00.730000000,2009,2 +44,true,9,9,9,90,9.899999618530273,90.90000000000001,'02/02/09','9',2009-02-02 00:19:00.810000000,2009,2 +45,false,0,0,0,0,0,0,'02/03/09','0',2009-02-03 00:20:00.900000000,2009,2 +46,true,1,1,1,10,1.100000023841858,10.1,'02/03/09','1',2009-02-03 00:21:00.900000000,2009,2 +47,false,2,2,2,20,2.200000047683716,20.2,'02/03/09','2',2009-02-03 00:22:00.910000000,2009,2 +48,true,3,3,3,30,3.299999952316284,30.3,'02/03/09','3',2009-02-03 00:23:00.930000000,2009,2 +49,false,4,4,4,40,4.400000095367432,40.4,'02/03/09','4',2009-02-03 00:24:00.960000000,2009,2 +50,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +51,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00,2009,3 +52,true,2,2,2,20,2.200000047683716,20.2,'03/01/09','2',2009-03-01 00:02:00.100000000,2009,3 +53,false,3,3,3,30,3.299999952316284,30.3,'03/01/09','3',2009-03-01 00:03:00.300000000,2009,3 +54,true,4,4,4,40,4.400000095367432,40.4,'03/01/09','4',2009-03-01 00:04:00.600000000,2009,3 +55,false,5,5,5,50,5.5,50.5,'03/01/09','5',2009-03-01 00:05:00.100000000,2009,3 +56,true,6,6,6,60,6.599999904632568,60.6,'03/01/09','6',2009-03-01 00:06:00.150000000,2009,3 +57,false,7,7,7,70,7.699999809265137,70.7,'03/01/09','7',2009-03-01 00:07:00.210000000,2009,3 +58,true,8,8,8,80,8.800000190734863,80.8,'03/01/09','8',2009-03-01 00:08:00.280000000,2009,3 +59,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/01/09','9',2009-03-01 00:09:00.360000000,2009,3 +60,true,0,0,0,0,0,0,'03/02/09','0',2009-03-02 00:10:00.450000000,2009,3 +61,false,1,1,1,10,1.100000023841858,10.1,'03/02/09','1',2009-03-02 00:11:00.450000000,2009,3 +62,true,2,2,2,20,2.200000047683716,20.2,'03/02/09','2',2009-03-02 00:12:00.460000000,2009,3 +63,false,3,3,3,30,3.299999952316284,30.3,'03/02/09','3',2009-03-02 00:13:00.480000000,2009,3 +64,true,4,4,4,40,4.400000095367432,40.4,'03/02/09','4',2009-03-02 00:14:00.510000000,2009,3 +65,false,5,5,5,50,5.5,50.5,'03/02/09','5',2009-03-02 00:15:00.550000000,2009,3 +66,true,6,6,6,60,6.599999904632568,60.6,'03/02/09','6',2009-03-02 00:16:00.600000000,2009,3 +67,false,7,7,7,70,7.699999809265137,70.7,'03/02/09','7',2009-03-02 00:17:00.660000000,2009,3 +68,true,8,8,8,80,8.800000190734863,80.8,'03/02/09','8',2009-03-02 00:18:00.730000000,2009,3 +69,false,9,9,9,90,9.899999618530273,90.90000000000001,'03/02/09','9',2009-03-02 00:19:00.810000000,2009,3 +70,true,0,0,0,0,0,0,'03/03/09','0',2009-03-03 00:20:00.900000000,2009,3 +71,false,1,1,1,10,1.100000023841858,10.1,'03/03/09','1',2009-03-03 00:21:00.900000000,2009,3 +72,true,2,2,2,20,2.200000047683716,20.2,'03/03/09','2',2009-03-03 00:22:00.910000000,2009,3 +73,false,3,3,3,30,3.299999952316284,30.3,'03/03/09','3',2009-03-03 00:23:00.930000000,2009,3 +74,true,4,4,4,40,4.400000095367432,40.4,'03/03/09','4',2009-03-03 00:24:00.960000000,2009,3 +75,false,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4 +76,true,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00,2009,4 +77,false,2,2,2,20,2.200000047683716,20.2,'04/01/09','2',2009-04-01 00:02:00.100000000,2009,4 +78,true,3,3,3,30,3.299999952316284,30.3,'04/01/09','3',2009-04-01 00:03:00.300000000,2009,4 +79,false,4,4,4,40,4.400000095367432,40.4,'04/01/09','4',2009-04-01 00:04:00.600000000,2009,4 +80,true,5,5,5,50,5.5,50.5,'04/01/09','5',2009-04-01 00:05:00.100000000,2009,4 +81,false,6,6,6,60,6.599999904632568,60.6,'04/01/09','6',2009-04-01 00:06:00.150000000,2009,4 +82,true,7,7,7,70,7.699999809265137,70.7,'04/01/09','7',2009-04-01 00:07:00.210000000,2009,4 +83,false,8,8,8,80,8.800000190734863,80.8,'04/01/09','8',2009-04-01 00:08:00.280000000,2009,4 +84,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/01/09','9',2009-04-01 00:09:00.360000000,2009,4 +85,false,0,0,0,0,0,0,'04/02/09','0',2009-04-02 00:10:00.450000000,2009,4 +86,true,1,1,1,10,1.100000023841858,10.1,'04/02/09','1',2009-04-02 00:11:00.450000000,2009,4 +87,false,2,2,2,20,2.200000047683716,20.2,'04/02/09','2',2009-04-02 00:12:00.460000000,2009,4 +88,true,3,3,3,30,3.299999952316284,30.3,'04/02/09','3',2009-04-02 00:13:00.480000000,2009,4 +89,false,4,4,4,40,4.400000095367432,40.4,'04/02/09','4',2009-04-02 00:14:00.510000000,2009,4 +90,true,5,5,5,50,5.5,50.5,'04/02/09','5',2009-04-02 00:15:00.550000000,2009,4 +91,false,6,6,6,60,6.599999904632568,60.6,'04/02/09','6',2009-04-02 00:16:00.600000000,2009,4 +92,true,7,7,7,70,7.699999809265137,70.7,'04/02/09','7',2009-04-02 00:17:00.660000000,2009,4 +93,false,8,8,8,80,8.800000190734863,80.8,'04/02/09','8',2009-04-02 00:18:00.730000000,2009,4 +94,true,9,9,9,90,9.899999618530273,90.90000000000001,'04/02/09','9',2009-04-02 00:19:00.810000000,2009,4 +95,false,0,0,0,0,0,0,'04/03/09','0',2009-04-03 00:20:00.900000000,2009,4 +96,true,1,1,1,10,1.100000023841858,10.1,'04/03/09','1',2009-04-03 00:21:00.900000000,2009,4 +97,false,2,2,2,20,2.200000047683716,20.2,'04/03/09','2',2009-04-03 00:22:00.910000000,2009,4 +98,true,3,3,3,30,3.299999952316284,30.3,'04/03/09','3',2009-04-03 00:23:00.930000000,2009,4 +99,false,4,4,4,40,4.400000095367432,40.4,'04/03/09','4',2009-04-03 00:24:00.960000000,2009,4 ==== ---- QUERY select month, date_string_col, year from alltypessmall diff --git a/testdata/workloads/functional-query/queries/QueryTest/insert.test b/testdata/workloads/functional-query/queries/QueryTest/insert.test index 8061ed5ce..88c88b951 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/insert.test +++ b/testdata/workloads/functional-query/queries/QueryTest/insert.test @@ -411,6 +411,26 @@ bigint 100 ==== ---- QUERY +# test insert into ... select * +insert into alltypesinsert partition(year, month) select * from alltypessmall +---- SETUP +RESET alltypesinsert +RELOAD alltypesinsert +---- RESULTS +year=2009/month=1/: 25 +year=2009/month=2/: 25 +year=2009/month=3/: 25 +year=2009/month=4/: 25 +==== +---- QUERY +# check size of alltypesinsert to ensure previous insert worked +select count(*) from alltypesinsert +---- TYPES +bigint +---- RESULTS +100 +==== +---- QUERY # static partition insert into string-partitioned table with special characters in partition key INSERT INTO TABLE insert_string_partitioned PARTITION(s2="/\%.") SELECT "value" FROM alltypessmall LIMIT 1; ---- SETUP @@ -424,7 +444,7 @@ SELECT * FROM insert_string_partitioned; ---- TYPES string, string ---- RESULTS -'/\%.','value' +'value','/\%.' ==== ---- QUERY # select with unencoded partition key as column predicate @@ -432,5 +452,5 @@ SELECT * FROM insert_string_partitioned WHERE s2 = "/\%."; ---- TYPES string, string ---- RESULTS -'/\%.','value' +'value','/\%.' ==== diff --git a/testdata/workloads/functional-query/queries/QueryTest/limit.test b/testdata/workloads/functional-query/queries/QueryTest/limit.test index aced5d891..d26a75250 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/limit.test +++ b/testdata/workloads/functional-query/queries/QueryTest/limit.test @@ -3,7 +3,7 @@ # limit 0 on hdfs table select * from alltypesagg where day = 1 limit 0 ---- TYPES -int, int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int, int ---- RESULTS ==== ---- QUERY @@ -43,35 +43,35 @@ smallint, int, tinyint, int, int, float, string # We need to specify the day here, otherwise files get opened in random order select * from alltypesagg where day = 1 limit 10 ---- TYPES -int, int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int, int ---- RESULTS -2010,1,1,0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00 -2010,1,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/10','1',2010-01-01 00:01:00 -2010,1,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/10','2',2010-01-01 00:02:00.100000000 -2010,1,1,3,false,3,3,3,30,3.299999952316284,30.3,'01/01/10','3',2010-01-01 00:03:00.300000000 -2010,1,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/10','4',2010-01-01 00:04:00.600000000 -2010,1,1,5,false,5,5,5,50,5.5,50.5,'01/01/10','5',2010-01-01 00:05:00.100000000 -2010,1,1,6,true,6,6,6,60,6.599999904632568,60.6,'01/01/10','6',2010-01-01 00:06:00.150000000 -2010,1,1,7,false,7,7,7,70,7.699999809265137,70.7,'01/01/10','7',2010-01-01 00:07:00.210000000 -2010,1,1,8,true,8,8,8,80,8.800000190734863,80.8,'01/01/10','8',2010-01-01 00:08:00.280000000 -2010,1,1,9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/10','9',2010-01-01 00:09:00.360000000 +0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00,2010,1,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/10','1',2010-01-01 00:01:00,2010,1,1 +2,true,2,2,2,20,2.200000047683716,20.2,'01/01/10','2',2010-01-01 00:02:00.100000000,2010,1,1 +3,false,3,3,3,30,3.299999952316284,30.3,'01/01/10','3',2010-01-01 00:03:00.300000000,2010,1,1 +4,true,4,4,4,40,4.400000095367432,40.4,'01/01/10','4',2010-01-01 00:04:00.600000000,2010,1,1 +5,false,5,5,5,50,5.5,50.5,'01/01/10','5',2010-01-01 00:05:00.100000000,2010,1,1 +6,true,6,6,6,60,6.599999904632568,60.6,'01/01/10','6',2010-01-01 00:06:00.150000000,2010,1,1 +7,false,7,7,7,70,7.699999809265137,70.7,'01/01/10','7',2010-01-01 00:07:00.210000000,2010,1,1 +8,true,8,8,8,80,8.800000190734863,80.8,'01/01/10','8',2010-01-01 00:08:00.280000000,2010,1,1 +9,false,9,9,9,90,9.899999618530273,90.90000000000001,'01/01/10','9',2010-01-01 00:09:00.360000000,2010,1,1 ==== ---- QUERY # limit is applied after where clause select * from alltypesagg where tinyint_col is null and day = 1 limit 10 ---- TYPES -int, int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int, int ---- RESULTS -2010,1,1,0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00 -2010,1,1,10,true,NULL,10,10,100,11,101,'01/01/10','10',2010-01-01 00:10:00.450000000 -2010,1,1,20,true,NULL,20,20,200,22,202,'01/01/10','20',2010-01-01 00:20:01.900000000 -2010,1,1,30,true,NULL,30,30,300,33,303,'01/01/10','30',2010-01-01 00:30:04.350000000 -2010,1,1,40,true,NULL,40,40,400,44,404,'01/01/10','40',2010-01-01 00:40:07.800000000 -2010,1,1,50,true,NULL,50,50,500,55,505,'01/01/10','50',2010-01-01 00:50:12.250000000 -2010,1,1,60,true,NULL,60,60,600,66,606,'01/01/10','60',2010-01-01 01:00:17.700000000 -2010,1,1,70,true,NULL,70,70,700,77,707,'01/01/10','70',2010-01-01 01:10:24.150000000 -2010,1,1,80,true,NULL,80,80,800,88,808,'01/01/10','80',2010-01-01 01:20:31.600000000 -2010,1,1,90,true,NULL,90,90,900,99,909,'01/01/10','90',2010-01-01 01:30:40.500000000 +0,true,NULL,NULL,NULL,NULL,NULL,NULL,'01/01/10','0',2010-01-01 00:00:00,2010,1,1 +10,true,NULL,10,10,100,11,101,'01/01/10','10',2010-01-01 00:10:00.450000000,2010,1,1 +20,true,NULL,20,20,200,22,202,'01/01/10','20',2010-01-01 00:20:01.900000000,2010,1,1 +30,true,NULL,30,30,300,33,303,'01/01/10','30',2010-01-01 00:30:04.350000000,2010,1,1 +40,true,NULL,40,40,400,44,404,'01/01/10','40',2010-01-01 00:40:07.800000000,2010,1,1 +50,true,NULL,50,50,500,55,505,'01/01/10','50',2010-01-01 00:50:12.250000000,2010,1,1 +60,true,NULL,60,60,600,66,606,'01/01/10','60',2010-01-01 01:00:17.700000000,2010,1,1 +70,true,NULL,70,70,700,77,707,'01/01/10','70',2010-01-01 01:10:24.150000000,2010,1,1 +80,true,NULL,80,80,800,88,808,'01/01/10','80',2010-01-01 01:20:31.600000000,2010,1,1 +90,true,NULL,90,90,900,99,909,'01/01/10','90',2010-01-01 01:30:40.500000000,2010,1,1 ==== ---- QUERY select tinyint_col, count(*) from alltypesagg group by 1 diff --git a/testdata/workloads/functional-query/queries/QueryTest/misc.test b/testdata/workloads/functional-query/queries/QueryTest/misc.test index ed2b57269..6e5ce339d 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/misc.test +++ b/testdata/workloads/functional-query/queries/QueryTest/misc.test @@ -109,18 +109,18 @@ int # Select from table with escape char that is same as delim char SELECT * FROM escapechartesttable ---- TYPES -int, boolean +boolean, int ---- RESULTS -0,true -1,false -2,true -3,false -4,true -5,false -6,true -7,false -8,true -9,false +true,0 +false,1 +true,2 +false,3 +true,4 +false,5 +true,6 +false,7 +true,8 +false,9 ==== ---- QUERY # Test string-literal escape sequences diff --git a/testdata/workloads/functional-query/queries/QueryTest/subquery-limit.test b/testdata/workloads/functional-query/queries/QueryTest/subquery-limit.test index 5cd945cd7..23a12c563 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/subquery-limit.test +++ b/testdata/workloads/functional-query/queries/QueryTest/subquery-limit.test @@ -13,13 +13,13 @@ select * from (select * from alltypessmall order by id limit 10) a where bool_col = true ---- TYPES -INT, INT, INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP +INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP, INT, INT ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000 -2009,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000 -2009,1,6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000 -2009,1,8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1 +4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1 +6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000,2009,1 +8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000,2009,1 ==== # order by/limit in subquery, followed by addititional selection predicate; # variant w/ join @@ -31,13 +31,13 @@ from ( ) a where bool_col = true ---- TYPES -INT, INT, INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP +INT, BOOLEAN, TINYINT, SMALLINT, INT, BIGINT, FLOAT, DOUBLE, STRING, STRING, TIMESTAMP, INT, INT ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000 -2009,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000 -2009,1,6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000 -2009,1,8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1 +4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1 +6,true,6,6,6,60,6.599999904632568,60.6,'01/01/09','6',2009-01-01 00:06:00.150000000,2009,1 +8,true,8,8,8,80,8.800000190734863,80.8,'01/01/09','8',2009-01-01 00:08:00.280000000,2009,1 ==== ---- QUERY # join against subquery with limit creates a merge fragment that applies the limit diff --git a/testdata/workloads/functional-query/queries/QueryTest/subquery.test b/testdata/workloads/functional-query/queries/QueryTest/subquery.test index cf6bd75b2..da16544f1 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/subquery.test +++ b/testdata/workloads/functional-query/queries/QueryTest/subquery.test @@ -356,13 +356,13 @@ from ( join alltypes t2 on (t1.int_col = t2.id) where month = 1 ---- TYPES -int, bigint, int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, bigint, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -0,3,2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -1,3,2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2,3,2009,1,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000 -3,3,2009,1,3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000 -4,3,2009,1,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000 +0,3,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,3,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,3,2,true,2,2,2,20,2.200000047683716,20.2,'01/01/09','2',2009-01-01 00:02:00.100000000,2009,1 +3,3,3,false,3,3,3,30,3.299999952316284,30.3,'01/01/09','3',2009-01-01 00:03:00.300000000,2009,1 +4,3,4,true,4,4,4,40,4.400000095367432,40.4,'01/01/09','4',2009-01-01 00:04:00.600000000,2009,1 ==== ---- QUERY select distinct * @@ -516,4 +516,4 @@ inner join (select 1 a, 3 b) z on z.b = y.b string, tinyint, tinyint, tinyint, tinyint ---- RESULTS '01/01/09',1,3,1,3 -==== \ No newline at end of file +==== diff --git a/testdata/workloads/functional-query/queries/QueryTest/union.test b/testdata/workloads/functional-query/queries/QueryTest/union.test index ab9d09e8b..fd24f8d58 100644 --- a/testdata/workloads/functional-query/queries/QueryTest/union.test +++ b/testdata/workloads/functional-query/queries/QueryTest/union.test @@ -3,16 +3,16 @@ # Showing contents of alltypestiny for convenience select * from alltypestiny ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00 -2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00 -2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00,2009,3 +6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4 +7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00,2009,4 ==== ---- QUERY # Only UNION ALL, no nested unions @@ -22,14 +22,14 @@ select * from alltypestiny where year=2009 and month=1 union all select * from alltypestiny where year=2009 and month=2 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Only UNION ALL with limit inside operands. One of the operands also has an order by. @@ -39,11 +39,11 @@ select * from alltypestiny where year=2009 and month=1 order by int_col limit 1 union all select * from alltypestiny where year=2009 and month=2 limit 1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # Only UNION DISTINCT, no nested unions @@ -53,46 +53,46 @@ select * from alltypestiny where year=2009 and month=1 union distinct select * from alltypestiny where year=2009 and month=2 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Only UNION ALL, mixed selects with and without from clauses, no nested unions select * from alltypestiny where year=2009 and month=1 union all -select 2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) +select 0,true,0,0,0,0,0,0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp), 2009,1 union all select * from alltypestiny where year=2009 and month=1 union all -select 2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) +select 1,false,1,1,1,10,1.1,10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp), 2009,1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, double, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, double, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.1,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.1,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Only UNION DISTINCT, mixed selects with and without from clauses, no nested unions select * from alltypestiny where year=2009 and month=1 union distinct -select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) +select 0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1 union distinct select * from alltypestiny where year=2009 and month=1 union distinct -select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) +select 1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Mixed UNION ALL/DISTINCT but effectively only UNION DISTINCT, no nested unions, @@ -104,13 +104,13 @@ union all select * from alltypestiny where year=2009 and month=2 union distinct (select * from alltypestiny where year=2009 and month=2) -order by 3 limit 3 +order by 1 limit 3 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit @@ -121,13 +121,13 @@ union all select * from alltypestiny where year=2009 and month=2 union all (select * from alltypestiny where year=2009 and month=2) -order by 3,4 limit 3 +order by 1,2 limit 3 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # Mixed UNION ALL/DISTINCT, no nested unions, with order by and limit @@ -138,14 +138,14 @@ union distinct select * from alltypestiny where year=2009 and month=2 union all (select * from alltypestiny where year=2009 and month=2) -order by 3,4 limit 4 +order by 1,2 limit 4 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # Union unnesting: Only UNION ALL, first operand is nested @@ -155,14 +155,14 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union all select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: Only UNION ALL, second operand is nested @@ -172,14 +172,14 @@ union all union all select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: Only UNION DISTINCT, first operand is nested @@ -189,12 +189,12 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union distinct select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: Only UNION DISTINCT, second operand is nested @@ -204,12 +204,12 @@ union distinct union distinct select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT, @@ -220,14 +220,14 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union all select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL doesn't absorb nested union with DISTINCT, @@ -238,14 +238,14 @@ union all union distinct select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL absorbs the children but not directly the operands @@ -258,16 +258,16 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union all select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL absorbs the children but not directly the operands @@ -280,16 +280,16 @@ union all union all select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL doesn't absorb the children of a nested union @@ -303,16 +303,16 @@ union all (select * from alltypestiny where year=2009 and month=2) limit 10) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION ALL doesn't absorb nested union with order by and limit, @@ -320,17 +320,17 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s (select * from alltypestiny where year=2009 and month=1 union all (select * from alltypestiny where year=2009 and month=2) - order by 3 limit 3) + order by 1 limit 3) union all select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Union unnesting: UNION ALL doesn't absorb nested union with order by and limit, @@ -340,15 +340,15 @@ union all (select * from alltypestiny where year=2009 and month=1 union all (select * from alltypestiny where year=2009 and month=2) - order by 3 limit 3) + order by 1 limit 3) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # Union unnesting: UNION DISTINCT absorbs nested union with ALL @@ -359,12 +359,12 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union distinct select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION DISTINCT absorbs nested union with ALL, @@ -375,12 +375,12 @@ union distinct union all select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT, @@ -393,12 +393,12 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s union distinct select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION DISTINCT absorbs nested union with mixed ALL/DISTINCT, @@ -411,12 +411,12 @@ union distinct union all select * from alltypestiny where year=2009 and month=2) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 ==== ---- QUERY # Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit, @@ -424,15 +424,15 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s (select * from alltypestiny where year=2009 and month=1 union all (select * from alltypestiny where year=2009 and month=2) - order by 3 limit 3) + order by 1 limit 3) union distinct select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Union unnesting: UNION DISTINCT doesn't absorb nested union with order by and limit, @@ -440,15 +440,15 @@ int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, s (select * from alltypestiny where year=2009 and month=1 union all (select * from alltypestiny where year=2009 and month=2) - order by 3 limit 3) + order by 1 limit 3) union distinct select * from alltypestiny where year=2009 and month=1 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Complex union unnesting: Multiple levels of UNION ALL, fully unnestable @@ -462,18 +462,18 @@ union all union all select * from alltypestiny where year=2009 and month=3))) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00,2009,3 ==== ---- QUERY # Complex union unnesting: Multiple levels of UNION DISTINCT, fully unnestable @@ -487,14 +487,14 @@ union distinct union distinct select * from alltypestiny where year=2009 and month=3))) ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00,2009,3 ==== ---- QUERY # Complex union unnesting: Partially unnestable up to 2nd level @@ -507,19 +507,19 @@ union all (select * from alltypestiny where year=2009 and month=2 union distinct (select * from alltypestiny where year=2009 and month=3) - order by 3 limit 3))) -order by 1, 2, 3 + order by 1 limit 3))) +order by 12, 13, 1 limit 20 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 ==== ---- QUERY # Complex union unnesting: Partially unnestable up to 1st level @@ -532,17 +532,17 @@ union distinct (select * from alltypestiny where year=2009 and month=2 union distinct (select * from alltypestiny where year=2009 and month=3) - order by 3 limit 3))) -order by 1, 2, 3 + order by 1 limit 3))) +order by 12, 13, 1 limit 20 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 ==== ---- QUERY # Complex union unnesting: Multiple nested unions to test all rules in a single query @@ -555,7 +555,7 @@ union distinct (select * from alltypestiny where year=2009 and month=2 union all (select * from alltypestiny where year=2009 and month=3) - order by 3 limit 3) + order by 1 limit 3) union all (select * from alltypestiny where year=2009 and month=3 union all @@ -564,23 +564,23 @@ union all (select * from alltypestiny where year=2009 and month=4 union all (select * from alltypestiny where year=2009 and month=5) - order by 3 limit 3) -order by 1, 2, 3 + order by 1 limit 3) +order by 12, 13, 1 limit 20 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 -2009,2,3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00 -2009,3,5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00 -2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00 -2009,4,6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00 -2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00 -2009,4,7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 +3,false,1,1,1,10,1.100000023841858,10.1,'02/01/09','1',2009-02-01 00:01:00,2009,2 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +4,true,0,0,0,0,0,0,'03/01/09','0',2009-03-01 00:00:00,2009,3 +5,false,1,1,1,10,1.100000023841858,10.1,'03/01/09','1',2009-03-01 00:01:00,2009,3 +6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4 +6,true,0,0,0,0,0,0,'04/01/09','0',2009-04-01 00:00:00,2009,4 +7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00,2009,4 +7,false,1,1,1,10,1.100000023841858,10.1,'04/01/09','1',2009-04-01 00:01:00,2009,4 ==== ---- QUERY # UNION ALL in subquery @@ -590,15 +590,15 @@ select x.* from select * from alltypestiny where year=2009 and month=1) x union all (select * from alltypestiny where year=2009 and month=2) -order by 3 limit 5 +order by 1 limit 5 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # UNION DISTINCT in subquery @@ -608,13 +608,13 @@ select x.* from select * from alltypestiny where year=2009 and month=1) x union distinct (select * from alltypestiny where year=2009 and month=2) -order by 3 limit 3 +order by 1 limit 3 ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,2,2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00 +0,true,0,0,0,0,0,0,'01/01/09','0',2009-01-01 00:00:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +2,true,0,0,0,0,0,0,'02/01/09','0',2009-02-01 00:00:00,2009,2 ==== ---- QUERY # UNION ALL in subquery with a WHERE condition in the outer select. @@ -624,10 +624,10 @@ select x.* from select * from alltypestiny where year=2009 and month=1) x where x.int_col < 5 and x.bool_col = false ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS: VERIFY_IS_EQUAL_SORTED -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # UNION DISTINCT in subquery with a WHERE condition in the outer select. @@ -637,9 +637,9 @@ select x.* from select * from alltypestiny where year=2009 and month=1) x where x.int_col < 5 and x.bool_col = false ---- TYPES -int, int, int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp +int, boolean, tinyint, smallint, int, bigint, float, double, string, string, timestamp, int, int ---- RESULTS -2009,1,1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00 +1,false,1,1,1,10,1.100000023841858,10.1,'01/01/09','1',2009-01-01 00:01:00,2009,1 ==== ---- QUERY # Test UNION ALL with mixed constant and non-constant selects. Also tests implicit casts. @@ -667,13 +667,13 @@ int, double, string select count(*) from ( select * from alltypes union all - select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) + select 0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1 union all select * from alltypes union all - select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) + select 1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1 union all - select 2009,1,2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp) + select 2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp),2009,1 ) x ---- TYPES bigint @@ -685,13 +685,13 @@ bigint select count(*) from ( select * from alltypes union distinct - select 2009,1,0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp) + select 0,true,0,0,0,0,cast(0 as float),0,'01/01/09','0',cast('2009-01-01 00:00:00' as timestamp),2009,1 union distinct select * from alltypes union distinct - select 2009,1,1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp) + select 1,false,1,1,1,10,cast(1.1 as float),10.1,'01/01/09','1',cast('2009-01-01 00:01:00' as timestamp),2009,1 union distinct - select 2009,1,2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp) + select 2,true,2,2,2,20,cast(2.2 as float),20.2,'01/01/09','2',cast('2009-01-01 00:02:00.10' as timestamp),2009,1 ) x ---- TYPES bigint