This is an automated email from the ASF dual-hosted git repository.
pvary pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/hive.git
The following commit(s) were added to refs/heads/master by this push:
new 5b30cd8 HIVE-25480: Fix Time Travel with CBO (#2602) (Peter Vary
reviewed by Adam Szita)
5b30cd8 is described below
commit 5b30cd879b8ef5a4aecbfcaf4366cb8608222909
Author: pvary
AuthorDate: Tue Aug 31 10:42:36 2021 +0200
HIVE-25480: Fix Time Travel with CBO (#2602) (Peter Vary reviewed by Adam
Szita)
---
.../mr/hive/TestHiveIcebergSchemaEvolution.java| 7 +++---
.../org/apache/iceberg/mr/hive/TestHiveShell.java | 2 +-
.../apache/hadoop/hive/ql/io/HiveInputFormat.java | 16 +---
.../org/apache/hadoop/hive/ql/metadata/Table.java | 22 ++--
.../optimizer/calcite/translator/ASTBuilder.java | 13 ++
.../hadoop/hive/ql/parse/CalcitePlanner.java | 3 ++-
.../hadoop/hive/ql/parse/SemanticAnalyzer.java | 11 ++--
.../apache/hadoop/hive/ql/plan/TableScanDesc.java | 29 +-
8 files changed, 55 insertions(+), 48 deletions(-)
diff --git
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSchemaEvolution.java
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSchemaEvolution.java
index 96d7850..9b3c941 100644
---
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSchemaEvolution.java
+++
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergSchemaEvolution.java
@@ -127,7 +127,7 @@ public class TestHiveIcebergSchemaEvolution extends
HiveIcebergStorageHandlerWit
shell.executeStatement("ALTER TABLE orders CHANGE COLUMN " +
"item fruit string");
List result = shell.executeStatement("SELECT
customer_first_name, customer_last_name, SUM(quantity) " +
-"FROM orders where price >= 3 group by customer_first_name,
customer_last_name");
+"FROM orders where price >= 3 group by customer_first_name,
customer_last_name order by customer_first_name");
assertQueryResult(result, 4,
"Doctor", "Strange", 900L,
@@ -140,7 +140,8 @@ public class TestHiveIcebergSchemaEvolution extends
HiveIcebergStorageHandlerWit
shell.executeStatement("ALTER TABLE orders ADD COLUMNS (nickname string)");
shell.executeStatement("INSERT INTO orders VALUES (7, 'Romanoff',
'Natasha', 3, 250, 'apple', 'Black Widow')");
result = shell.executeStatement("SELECT customer_first_name,
customer_last_name, nickname, SUM(quantity) " +
-" FROM orders where price >= 3 group by customer_first_name,
customer_last_name, nickname");
+" FROM orders where price >= 3 group by customer_first_name,
customer_last_name, nickname " +
+" order by customer_first_name");
assertQueryResult(result, 5,
"Doctor", "Strange", null, 900L,
"Natasha", "Romanoff", "Black Widow", 250L,
@@ -152,7 +153,7 @@ public class TestHiveIcebergSchemaEvolution extends
HiveIcebergStorageHandlerWit
shell.executeStatement("ALTER TABLE orders CHANGE COLUMN fruit fruit
string AFTER nickname");
result = shell.executeStatement("SELECT customer_first_name,
customer_last_name, nickname, fruit, SUM(quantity) " +
" FROM orders where price >= 3 and fruit < 'o' group by
customer_first_name, customer_last_name, nickname, " +
-"fruit");
+"fruit order by customer_first_name");
assertQueryResult(result, 4,
"Doctor", "Strange", null, "apple", 100L,
"Natasha", "Romanoff", "Black Widow", "apple", 250L,
diff --git
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveShell.java
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveShell.java
index b3c9440..3d39889 100644
---
a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveShell.java
+++
b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveShell.java
@@ -185,7 +185,7 @@ public class TestHiveShell {
hiveConf.setIntVar(HiveConf.ConfVars.HIVE_SERVER2_WEBUI_PORT, -1);
// Switch off optimizers in order to contain the map reduction within this
JVM
-hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_CBO_ENABLED, false);
+hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_CBO_ENABLED, true);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVE_INFER_BUCKET_SORT, false);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVEMETADATAONLYQUERIES, false);
hiveConf.setBoolVar(HiveConf.ConfVars.HIVEOPTINDEXFILTER, false);
diff --git a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
index f48f65d..372f9af 100755
--- a/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
+++ b/ql/src/java/org/apache/hadoop/hive/ql/io/HiveInputFormat.java
@@ -28,6 +28,8 @@ import org.apache.hadoop.hive.common