diff --git a/.travis.yml b/.travis.yml
index bd0fe871ad8c8..ae457dd985ebb 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -17,6 +17,7 @@ env:
- TEST_SPECIFIC_MODULES=presto-accumulo
- TEST_SPECIFIC_MODULES=presto-cassandra
- TEST_SPECIFIC_MODULES=presto-hive
+ - TEST_SPECIFIC_MODULES=presto-hive TEST_FLAGS="-P test-hive-materialized"
- TEST_SPECIFIC_MODULES=presto-main
- TEST_SPECIFIC_MODULES=presto-mongodb
- TEST_OTHER_MODULES=!presto-tests,!presto-raptor,!presto-accumulo,!presto-cassandra,!presto-hive,!presto-kudu,!presto-docs,!presto-server,!presto-server-rpm,!presto-main,!presto-mongodb
diff --git a/pom.xml b/pom.xml
index 37e8da0fcc7fb..5ce9cbf550405 100644
--- a/pom.xml
+++ b/pom.xml
@@ -57,6 +57,7 @@
3.8.0
1.2.3
1.10.0
+ 1.6.8
**/TestHiveClientGlueMetastore.java
+ **/TestHiveDistributedAggregationsWithExchangeMaterialization.java
+ **/TestHiveDistributedQueriesWithExchangeMaterialization.java
+
+
+
+
+ test-hive-materialized
+
+
- org.basepom.maven
- duplicate-finder-maven-plugin
+ org.apache.maven.plugins
+ maven-surefire-plugin
-
- parquet.thrift
- about.html
-
+
+ **/TestHiveDistributedAggregationsWithExchangeMaterialization.java
+ **/TestHiveDistributedQueriesWithExchangeMaterialization.java
+
@@ -374,16 +405,6 @@
-
- org.basepom.maven
- duplicate-finder-maven-plugin
-
-
- parquet.thrift
- about.html
-
-
-
diff --git a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java
index ddc71a5a83514..e71702e532e2e 100644
--- a/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java
+++ b/presto-hive/src/main/java/com/facebook/presto/hive/HiveMetadata.java
@@ -135,6 +135,7 @@
import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNKNOWN_ERROR;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_UNSUPPORTED_FORMAT;
import static com.facebook.presto.hive.HiveErrorCode.HIVE_WRITER_CLOSE_ERROR;
+import static com.facebook.presto.hive.HivePartition.UNPARTITIONED_ID;
import static com.facebook.presto.hive.HivePartitionManager.extractPartitionValues;
import static com.facebook.presto.hive.HiveSessionProperties.getHiveStorageFormat;
import static com.facebook.presto.hive.HiveSessionProperties.getTemporaryTableSchema;
@@ -407,7 +408,7 @@ public RecordCursor cursor(ConnectorTransactionHandle transactionHandle, Connect
Iterable> records = () ->
stream(partitionManager.getPartitions(metastore, sourceTableHandle, targetConstraint, session).getPartitions())
.map(hivePartition ->
- (List