lock)
throws TException, InterruptedException {
// Simulate a communication error after a successful commit
doAnswer(i -> {
org.apache.hadoop.hive.metastore.api.Table tbl =
i.getArgument(0, org.apache.hadoop.hive.metastore.api.Table.class);
- realOperations.persistTable(tbl, true);
+ String location = i.getArgument(2, String.class);
+ realOperations.persistTable(tbl, true, location);
// Simulate lock expiration or removal
- realOperations.doUnlock(lockId.get());
+ lock.get().unlock();
table.refresh();
table.updateSchema().addColumn("newCol", Types.IntegerType.get()).commit();
throw new TException("Datacenter on fire");
- }).when(spyOperations).persistTable(any(), anyBoolean());
+ })
+ .when(spyOperations)
+ .persistTable(any(), anyBoolean(), any());
}
private void failCommitAndThrowException(HiveTableOperations spyOperations) throws TException, InterruptedException {
doThrow(new TException("Datacenter on fire"))
.when(spyOperations)
- .persistTable(any(), anyBoolean());
+ .persistTable(any(), anyBoolean(), any());
}
private void breakFallbackCatalogCommitCheck(HiveTableOperations spyOperations) {
diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java
index a23e1f30ac12..8c0ef6b5adbb 100644
--- a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java
+++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestHiveSchemaUtil.java
@@ -26,12 +26,12 @@
import org.apache.hadoop.hive.serde.serdeConstants;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoUtils;
-import org.apache.iceberg.AssertHelpers;
import org.apache.iceberg.Schema;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.relocated.com.google.common.collect.Lists;
import org.apache.iceberg.types.Type;
import org.apache.iceberg.types.Types;
+import org.assertj.core.api.Assertions;
import org.junit.Assert;
import org.junit.Test;
@@ -118,11 +118,10 @@ public void testSchemaConvertToIcebergSchemaForEveryPrimitiveType() {
@Test
public void testNotSupportedTypes() {
for (FieldSchema notSupportedField : getNotSupportedFieldSchemas()) {
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Unsupported Hive type", () -> {
- HiveSchemaUtil.convert(Lists.newArrayList(Arrays.asList(notSupportedField)));
- }
- );
+ Assertions.assertThatThrownBy(
+ () -> HiveSchemaUtil.convert(Lists.newArrayList(Arrays.asList(notSupportedField))))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Unsupported Hive type");
}
}
diff --git a/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestLoadHiveCatalog.java b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestLoadHiveCatalog.java
new file mode 100644
index 000000000000..7311432a54fc
--- /dev/null
+++ b/iceberg/iceberg-catalog/src/test/java/org/apache/iceberg/hive/TestLoadHiveCatalog.java
@@ -0,0 +1,106 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.iceberg.hive;
+
+import java.util.Collections;
+import org.apache.hadoop.conf.Configuration;
+import org.apache.hadoop.hive.conf.HiveConf;
+import org.apache.iceberg.CatalogProperties;
+import org.apache.iceberg.CatalogUtil;
+import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestLoadHiveCatalog {
+
+ private static TestHiveMetastore metastore;
+
+ @BeforeClass
+ public static void startMetastore() throws Exception {
+ HiveConf hiveConf = new HiveConf(TestLoadHiveCatalog.class);
+ metastore = new TestHiveMetastore();
+ metastore.start(hiveConf);
+ }
+
+ @AfterClass
+ public static void stopMetastore() throws Exception {
+ if (metastore != null) {
+ metastore.stop();
+ metastore = null;
+ }
+ }
+
+ @Test
+ public void testCustomCacheKeys() throws Exception {
+ HiveCatalog hiveCatalog1 =
+ (HiveCatalog)
+ CatalogUtil.loadCatalog(
+ HiveCatalog.class.getName(),
+ CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE,
+ Collections.emptyMap(),
+ metastore.hiveConf());
+ HiveCatalog hiveCatalog2 =
+ (HiveCatalog)
+ CatalogUtil.loadCatalog(
+ HiveCatalog.class.getName(),
+ CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE,
+ Collections.emptyMap(),
+ metastore.hiveConf());
+
+ CachedClientPool clientPool1 = (CachedClientPool) hiveCatalog1.clientPool();
+ CachedClientPool clientPool2 = (CachedClientPool) hiveCatalog2.clientPool();
+ Assert.assertSame(clientPool1.clientPool(), clientPool2.clientPool());
+
+ Configuration conf1 = new Configuration(metastore.hiveConf());
+ Configuration conf2 = new Configuration(metastore.hiveConf());
+ conf1.set("any.key", "any.value");
+ conf2.set("any.key", "any.value");
+ hiveCatalog1 =
+ (HiveCatalog)
+ CatalogUtil.loadCatalog(
+ HiveCatalog.class.getName(),
+ CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE,
+ ImmutableMap.of(CatalogProperties.CLIENT_POOL_CACHE_KEYS, "conf:any.key"),
+ conf1);
+ hiveCatalog2 =
+ (HiveCatalog)
+ CatalogUtil.loadCatalog(
+ HiveCatalog.class.getName(),
+ CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE,
+ ImmutableMap.of(CatalogProperties.CLIENT_POOL_CACHE_KEYS, "conf:any.key"),
+ conf2);
+ clientPool1 = (CachedClientPool) hiveCatalog1.clientPool();
+ clientPool2 = (CachedClientPool) hiveCatalog2.clientPool();
+ Assert.assertSame(clientPool1.clientPool(), clientPool2.clientPool());
+
+ conf2.set("any.key", "any.value2");
+ hiveCatalog2 =
+ (HiveCatalog)
+ CatalogUtil.loadCatalog(
+ HiveCatalog.class.getName(),
+ CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE,
+ ImmutableMap.of(CatalogProperties.CLIENT_POOL_CACHE_KEYS, "conf:any.key"),
+ conf2);
+ clientPool2 = (CachedClientPool) hiveCatalog2.clientPool();
+ Assert.assertNotSame(clientPool1.clientPool(), clientPool2.clientPool());
+ }
+}
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java
index d3bc13baedc3..d422885becda 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/Catalogs.java
@@ -40,27 +40,24 @@
/**
* Class for catalog resolution and accessing the common functions for {@link Catalog} API.
- *
- * If the catalog name is provided, get the catalog type from iceberg.catalog.catalogName.type config.
- *
- * In case the catalog name is {@link #ICEBERG_HADOOP_TABLE_NAME location_based_table},
- * type is ignored and tables will be loaded using {@link HadoopTables}.
- *
- * In case the value of catalog type is null, iceberg.catalog.catalogName.catalog-impl config
- * is used to determine the catalog implementation class.
- *
- * If catalog name is null, get the catalog type from {@link InputFormatConfig#CATALOG iceberg.mr.catalog} config:
+ *
+ *
If the catalog name is provided, get the catalog type from iceberg.catalog.catalogName
+ * .type config.
+ *
+ *
In case the catalog name is {@link #ICEBERG_HADOOP_TABLE_NAME location_based_table}, type is
+ * ignored and tables will be loaded using {@link HadoopTables}.
+ *
+ *
In case the value of catalog type is null, iceberg.catalog.catalogName
+ * .catalog-impl config is used to determine the catalog implementation class.
+ *
+ *
If catalog name is null, get the catalog type from {@link CatalogUtil#ICEBERG_CATALOG_TYPE
+ * catalog type} config:
+ *
*
* hive: HiveCatalog
* location: HadoopTables
* hadoop: HadoopCatalog
*
- *
- * In case the value of catalog type is null,
- * {@link InputFormatConfig#CATALOG_LOADER_CLASS iceberg.mr.catalog.loader.class} is used to determine
- * the catalog implementation class.
- *
- * Note: null catalog name mode is only supported for backwards compatibility. Using this mode is NOT RECOMMENDED.
*/
public final class Catalogs {
@@ -254,47 +251,22 @@ static Optional loadCatalog(Configuration conf, String catalogName) {
* @param catalogType type of the catalog
* @return complete map of catalog properties
*/
- private static Map getCatalogProperties(Configuration conf, String catalogName, String catalogType) {
+ private static Map getCatalogProperties(
+ Configuration conf, String catalogName, String catalogType) {
Map catalogProperties = Maps.newHashMap();
+ String keyPrefix = InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName;
conf.forEach(config -> {
if (config.getKey().startsWith(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX)) {
catalogProperties.putIfAbsent(
- config.getKey().substring(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX.length()),
- config.getValue());
- } else if (config.getKey().startsWith(InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName)) {
+ config.getKey().substring(InputFormatConfig.CATALOG_DEFAULT_CONFIG_PREFIX.length()),
+ config.getValue());
+ } else if (config.getKey().startsWith(keyPrefix)) {
catalogProperties.put(
- config.getKey().substring((InputFormatConfig.CATALOG_CONFIG_PREFIX + catalogName).length() + 1),
- config.getValue());
+ config.getKey().substring(keyPrefix.length() + 1),
+ config.getValue());
}
});
- return addCatalogPropertiesIfMissing(conf, catalogType, catalogProperties);
- }
-
- /**
- * This method is used for backward-compatible catalog configuration.
- * Collect all the catalog specific configuration from the global hive configuration.
- * Note: this should be removed when the old catalog configuration is depracated.
- * @param conf global hive configuration
- * @param catalogType type of the catalog
- * @param catalogProperties pre-populated catalog properties
- * @return complete map of catalog properties
- */
- private static Map addCatalogPropertiesIfMissing(Configuration conf, String catalogType,
- Map catalogProperties) {
- if (catalogType != null) {
- catalogProperties.putIfAbsent(CatalogUtil.ICEBERG_CATALOG_TYPE, catalogType);
- }
-
- String legacyCatalogImpl = conf.get(InputFormatConfig.CATALOG_LOADER_CLASS);
- if (legacyCatalogImpl != null) {
- catalogProperties.putIfAbsent(CatalogProperties.CATALOG_IMPL, legacyCatalogImpl);
- }
-
- String legacyWarehouseLocation = conf.get(InputFormatConfig.HADOOP_CATALOG_WAREHOUSE_LOCATION);
- if (legacyWarehouseLocation != null) {
- catalogProperties.putIfAbsent(CatalogProperties.WAREHOUSE_LOCATION, legacyWarehouseLocation);
- }
return catalogProperties;
}
@@ -317,7 +289,7 @@ private static String getCatalogType(Configuration conf, String catalogName) {
return catalogType;
}
} else {
- String catalogType = conf.get(InputFormatConfig.CATALOG);
+ String catalogType = conf.get(CatalogUtil.ICEBERG_CATALOG_TYPE);
if (catalogType != null && catalogType.equals(LOCATION)) {
return NO_CATALOG_TYPE;
} else {
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java
index d1bfde2f7f8b..cf3450840a83 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/InputFormatConfig.java
@@ -53,29 +53,6 @@ private InputFormatConfig() {
public static final String TABLE_CATALOG_PREFIX = "iceberg.mr.table.catalog.";
public static final String LOCALITY = "iceberg.mr.locality";
- /**
- * @deprecated please use {@link #catalogPropertyConfigKey(String, String)}
- * with config key {@link org.apache.iceberg.CatalogUtil#ICEBERG_CATALOG_TYPE} to specify the type of a catalog.
- */
- @Deprecated
- public static final String CATALOG = "iceberg.mr.catalog";
-
- /**
- * @deprecated please use {@link #catalogPropertyConfigKey(String, String)}
- * with config key {@link org.apache.iceberg.CatalogProperties#WAREHOUSE_LOCATION}
- * to specify the warehouse location of a catalog.
- */
- @Deprecated
- public static final String HADOOP_CATALOG_WAREHOUSE_LOCATION = "iceberg.mr.catalog.hadoop.warehouse.location";
-
- /**
- * @deprecated please use {@link #catalogPropertyConfigKey(String, String)}
- * with config key {@link org.apache.iceberg.CatalogProperties#CATALOG_IMPL}
- * to specify the implementation of a catalog.
- */
- @Deprecated
- public static final String CATALOG_LOADER_CLASS = "iceberg.mr.catalog.loader.class";
-
public static final String CTAS_TABLE_NAME = "iceberg.mr.ctas.table.name";
public static final String SELECTED_COLUMNS = "iceberg.mr.selected.columns";
public static final String FETCH_VIRTUAL_COLUMNS = "iceberg.mr.fetch.virtual.columns";
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergInputFormat.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergInputFormat.java
index fa92b638c660..66883b02e5cb 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergInputFormat.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergInputFormat.java
@@ -50,7 +50,7 @@
import org.apache.iceberg.expressions.Expression;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.expressions.ResidualEvaluator;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.mr.InputFormatConfig;
import org.apache.iceberg.mr.mapred.AbstractMapredIcebergRecordReader;
import org.apache.iceberg.mr.mapred.Container;
@@ -74,7 +74,7 @@ public class HiveIcebergInputFormat extends MapredIcebergInputFormat
public static final String ICEBERG_DISABLE_VECTORIZATION_PREFIX = "iceberg.disable.vectorization.";
static {
- if (MetastoreUtil.hive3PresentOnClasspath()) {
+ if (HiveVersion.min(HiveVersion.HIVE_3)) {
HIVE_VECTORIZED_RECORDREADER_CTOR = DynConstructors.builder(AbstractMapredIcebergRecordReader.class)
.impl(HIVE_VECTORIZED_RECORDREADER_CLASS,
IcebergInputFormat.class,
@@ -159,7 +159,7 @@ public RecordReader> getRecordReader(InputSplit split, J
job.getBoolean(ColumnProjectionUtils.FETCH_VIRTUAL_COLUMNS_CONF_STR, false));
if (HiveConf.getBoolVar(job, HiveConf.ConfVars.HIVE_VECTORIZATION_ENABLED) && Utilities.getIsVectorized(job)) {
- Preconditions.checkArgument(MetastoreUtil.hive3PresentOnClasspath(), "Vectorization only supported for Hive 3+");
+ Preconditions.checkArgument(HiveVersion.min(HiveVersion.HIVE_3), "Vectorization only supported for Hive 3+");
job.setEnum(InputFormatConfig.IN_MEMORY_DATA_MODEL, InputFormatConfig.InMemoryDataModel.HIVE);
job.setBoolean(InputFormatConfig.SKIP_RESIDUAL_FILTERING, true);
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
index 694c54cf13a6..d946531d58f4 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergMetaHook.java
@@ -83,9 +83,9 @@
import org.apache.iceberg.exceptions.NotFoundException;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.hive.CachedClientPool;
-import org.apache.iceberg.hive.HiveCommitLock;
import org.apache.iceberg.hive.HiveSchemaUtil;
import org.apache.iceberg.hive.HiveTableOperations;
+import org.apache.iceberg.hive.MetastoreLock;
import org.apache.iceberg.io.FileIO;
import org.apache.iceberg.mapping.MappingUtil;
import org.apache.iceberg.mapping.NameMapping;
@@ -147,7 +147,7 @@ public class HiveIcebergMetaHook implements HiveMetaHook {
private Transaction transaction;
private AlterTableType currentAlterTableOp;
private boolean createHMSTableInHook = false;
- private HiveCommitLock commitLock;
+ private MetastoreLock commitLock;
private enum FileFormat {
ORC("orc"), PARQUET("parquet"), AVRO("avro");
@@ -324,15 +324,15 @@ public void preAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTable, E
context.getProperties().get(OLD_TABLE_NAME)).toString());
}
if (commitLock == null) {
- commitLock = new HiveCommitLock(conf, new CachedClientPool(conf, Maps.fromProperties(catalogProperties)),
+ commitLock = new MetastoreLock(conf, new CachedClientPool(conf, Maps.fromProperties(catalogProperties)),
catalogProperties.getProperty(Catalogs.NAME), hmsTable.getDbName(), hmsTable.getTableName());
}
try {
- commitLock.acquire();
+ commitLock.lock();
doPreAlterTable(hmsTable, context);
} catch (Exception e) {
- commitLock.release();
+ commitLock.unlock();
throw new MetaException(StringUtils.stringifyException(e));
}
}
@@ -526,7 +526,7 @@ public void commitAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTable
if (commitLock == null) {
throw new IllegalStateException("Hive commit lock should already be set");
}
- commitLock.release();
+ commitLock.unlock();
if (isTableMigration) {
catalogProperties = getCatalogProperties(hmsTable);
catalogProperties.put(InputFormatConfig.TABLE_SCHEMA, SchemaParser.toJson(preAlterTableProperties.schema));
@@ -566,7 +566,7 @@ public void rollbackAlterTable(org.apache.hadoop.hive.metastore.api.Table hmsTab
if (commitLock == null) {
throw new IllegalStateException("Hive commit lock should already be set");
}
- commitLock.release();
+ commitLock.unlock();
if (Boolean.parseBoolean(context.getProperties().getOrDefault(MIGRATE_HIVE_TO_ICEBERG, "false"))) {
LOG.debug("Initiating rollback for table {} at location {}",
hmsTable.getTableName(), hmsTable.getSd().getLocation());
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
index 7ec03084b53a..18204a90c48e 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandler.java
@@ -168,7 +168,7 @@ public class HiveIcebergStorageHandler implements HiveStoragePredicateHandler, H
private static final Splitter TABLE_NAME_SPLITTER = Splitter.on("..");
private static final String TABLE_NAME_SEPARATOR = "..";
// Column index for partition metadata table
- private static final int SPEC_IDX = 3;
+ private static final int SPEC_IDX = 1;
private static final int PART_IDX = 0;
public static final String COPY_ON_WRITE = "copy-on-write";
public static final String MERGE_ON_READ = "merge-on-read";
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergObjectInspector.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergObjectInspector.java
index 039950213f92..625f8f65d296 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergObjectInspector.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/serde/objectinspector/IcebergObjectInspector.java
@@ -28,7 +28,7 @@
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.iceberg.Schema;
import org.apache.iceberg.common.DynMethods;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.types.Type;
import org.apache.iceberg.types.TypeUtil;
import org.apache.iceberg.types.Types;
@@ -36,23 +36,27 @@
public final class IcebergObjectInspector extends TypeUtil.SchemaVisitor {
// get the correct inspectors depending on whether we're working with Hive2 or Hive3 dependencies
- // we need to do this because there is a breaking API change in Date/TimestampObjectInspector between Hive2 and Hive3
- private static final String DATE_INSPECTOR_CLASS = MetastoreUtil.hive3PresentOnClasspath() ?
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspectorHive3" :
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspector";
+ // we need to do this because there is a breaking API change in Date/TimestampObjectInspector
+ // between Hive2 and Hive3
+ private static final String DATE_INSPECTOR_CLASS =
+ HiveVersion.min(HiveVersion.HIVE_3) ?
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspectorHive3" :
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspector";
public static final ObjectInspector DATE_INSPECTOR = DynMethods.builder("get")
.impl(DATE_INSPECTOR_CLASS)
.buildStatic()
.invoke();
- private static final String TIMESTAMP_INSPECTOR_CLASS = MetastoreUtil.hive3PresentOnClasspath() ?
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3" :
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspector";
+ private static final String TIMESTAMP_INSPECTOR_CLASS =
+ HiveVersion.min(HiveVersion.HIVE_3) ?
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspectorHive3" :
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampObjectInspector";
- private static final String TIMESTAMPTZ_INSPECTOR_CLASS = MetastoreUtil.hive3PresentOnClasspath() ?
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampWithZoneObjectInspectorHive3" :
- "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampWithZoneObjectInspector";
+ private static final String TIMESTAMPTZ_INSPECTOR_CLASS =
+ HiveVersion.min(HiveVersion.HIVE_3) ?
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampWithZoneObjectInspectorHive3" :
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergTimestampWithZoneObjectInspector";
public static final ObjectInspector TIMESTAMP_INSPECTOR = DynMethods.builder("get")
.impl(TIMESTAMP_INSPECTOR_CLASS)
diff --git a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapreduce/IcebergInputFormat.java b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapreduce/IcebergInputFormat.java
index 46c1c23dc07e..af62c0514e2d 100644
--- a/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapreduce/IcebergInputFormat.java
+++ b/iceberg/iceberg-handler/src/main/java/org/apache/iceberg/mr/mapreduce/IcebergInputFormat.java
@@ -76,7 +76,7 @@
import org.apache.iceberg.expressions.Evaluator;
import org.apache.iceberg.expressions.Expression;
import org.apache.iceberg.expressions.Expressions;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.io.CloseableIterable;
import org.apache.iceberg.io.CloseableIterator;
import org.apache.iceberg.io.InputFile;
@@ -261,7 +261,7 @@ private static final class IcebergRecordReader extends RecordReader
private static final DynMethods.StaticMethod HIVE_VECTORIZED_READER_BUILDER;
static {
- if (MetastoreUtil.hive3PresentOnClasspath()) {
+ if (HiveVersion.min(HiveVersion.HIVE_3)) {
HIVE_VECTORIZED_READER_BUILDER = DynMethods.builder("reader")
.impl(HIVE_VECTORIZED_READER_CLASS,
Table.class,
@@ -363,7 +363,7 @@ private CloseableIterable openVectorized(FileScanTask task, Schema readSchema
Preconditions.checkArgument(!task.file().format().equals(FileFormat.AVRO),
"Vectorized execution is not yet supported for Iceberg avro tables. " +
"Please turn off vectorization and retry the query.");
- Preconditions.checkArgument(MetastoreUtil.hive3PresentOnClasspath(),
+ Preconditions.checkArgument(HiveVersion.min(HiveVersion.HIVE_3),
"Vectorized read is unsupported for Hive 2 integration.");
Path path = new Path(task.file().path().toString());
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestCatalogs.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestCatalogs.java
index e9f0bd24de4f..2bd1f70c9809 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestCatalogs.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestCatalogs.java
@@ -24,7 +24,6 @@
import java.util.Optional;
import java.util.Properties;
import org.apache.hadoop.conf.Configuration;
-import org.apache.iceberg.AssertHelpers;
import org.apache.iceberg.CatalogProperties;
import org.apache.iceberg.CatalogUtil;
import org.apache.iceberg.PartitionSpec;
@@ -65,10 +64,11 @@ public void before() {
@Test
public void testLoadTableFromLocation() throws IOException {
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
- AssertHelpers.assertThrows(
- "Should complain about table location not set", IllegalArgumentException.class,
- "location not set", () -> Catalogs.loadTable(conf));
+ conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
+
+ Assertions.assertThatThrownBy(() -> Catalogs.loadTable(conf))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Table location not set");
HadoopTables tables = new HadoopTables();
Table hadoopTable = tables.create(SCHEMA, temp.newFolder("hadoop_tables").toString());
@@ -84,9 +84,9 @@ public void testLoadTableFromCatalog() throws IOException {
String warehouseLocation = temp.newFolder("hadoop", "warehouse").toString();
setCustomCatalogProperties(defaultCatalogName, warehouseLocation);
- AssertHelpers.assertThrows(
- "Should complain about table identifier not set", IllegalArgumentException.class,
- "identifier not set", () -> Catalogs.loadTable(conf));
+ Assertions.assertThatThrownBy(() -> Catalogs.loadTable(conf))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessage("Table identifier not set");
HadoopCatalog catalog = new CustomHadoopCatalog(conf, warehouseLocation);
Table hadoopCatalogTable = catalog.createTable(TableIdentifier.of("table"), SCHEMA);
@@ -100,16 +100,18 @@ public void testLoadTableFromCatalog() throws IOException {
public void testCreateDropTableToLocation() throws IOException {
Properties missingSchema = new Properties();
missingSchema.put("location", temp.newFolder("hadoop_tables").toString());
- AssertHelpers.assertThrows(
- "Should complain about table schema not set", NullPointerException.class,
- "schema not set", () -> Catalogs.createTable(conf, missingSchema));
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
+ Assertions.assertThatThrownBy(() -> Catalogs.createTable(conf, missingSchema))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table schema not set");
+
+ conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
Properties missingLocation = new Properties();
missingLocation.put(InputFormatConfig.TABLE_SCHEMA, SchemaParser.toJson(SCHEMA));
- AssertHelpers.assertThrows(
- "Should complain about table location not set", NullPointerException.class,
- "location not set", () -> Catalogs.createTable(conf, missingLocation));
+
+ Assertions.assertThatThrownBy(() -> Catalogs.createTable(conf, missingLocation))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table location not set");
Properties properties = new Properties();
properties.put("location", temp.getRoot() + "/hadoop_tables");
@@ -127,17 +129,17 @@ public void testCreateDropTableToLocation() throws IOException {
Assert.assertEquals(PartitionSpecParser.toJson(SPEC), PartitionSpecParser.toJson(table.spec()));
Assert.assertEquals(Collections.singletonMap("dummy", "test"), table.properties());
- AssertHelpers.assertThrows(
- "Should complain about table location not set", NullPointerException.class,
- "location not set", () -> Catalogs.dropTable(conf, new Properties()));
+ Assertions.assertThatThrownBy(() -> Catalogs.dropTable(conf, new Properties()))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table location not set");
Properties dropProperties = new Properties();
dropProperties.put("location", temp.getRoot() + "/hadoop_tables");
Catalogs.dropTable(conf, dropProperties);
- AssertHelpers.assertThrows(
- "Should complain about table not found", NoSuchTableException.class,
- "Table does not exist", () -> Catalogs.loadTable(conf, dropProperties));
+ Assertions.assertThatThrownBy(() -> Catalogs.loadTable(conf, dropProperties))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessage("Table does not exist at location: " + properties.getProperty("location"));
}
@Test
@@ -151,16 +153,17 @@ public void testCreateDropTableToCatalog() throws IOException {
Properties missingSchema = new Properties();
missingSchema.put("name", identifier.toString());
missingSchema.put(InputFormatConfig.CATALOG_NAME, defaultCatalogName);
- AssertHelpers.assertThrows(
- "Should complain about table schema not set", NullPointerException.class,
- "schema not set", () -> Catalogs.createTable(conf, missingSchema));
+
+ Assertions.assertThatThrownBy(() -> Catalogs.createTable(conf, missingSchema))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table schema not set");
Properties missingIdentifier = new Properties();
missingIdentifier.put(InputFormatConfig.TABLE_SCHEMA, SchemaParser.toJson(SCHEMA));
missingIdentifier.put(InputFormatConfig.CATALOG_NAME, defaultCatalogName);
- AssertHelpers.assertThrows(
- "Should complain about table identifier not set", NullPointerException.class,
- "identifier not set", () -> Catalogs.createTable(conf, missingIdentifier));
+ Assertions.assertThatThrownBy(() -> Catalogs.createTable(conf, missingIdentifier))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table identifier not set");
Properties properties = new Properties();
properties.put("name", identifier.toString());
@@ -178,69 +181,18 @@ public void testCreateDropTableToCatalog() throws IOException {
Assert.assertEquals(PartitionSpecParser.toJson(SPEC), PartitionSpecParser.toJson(table.spec()));
Assert.assertEquals(Collections.singletonMap("dummy", "test"), table.properties());
- AssertHelpers.assertThrows(
- "Should complain about table identifier not set", NullPointerException.class,
- "identifier not set", () -> Catalogs.dropTable(conf, new Properties()));
+ Assertions.assertThatThrownBy(() -> Catalogs.dropTable(conf, new Properties()))
+ .isInstanceOf(NullPointerException.class)
+ .hasMessage("Table identifier not set");
Properties dropProperties = new Properties();
dropProperties.put("name", identifier.toString());
dropProperties.put(InputFormatConfig.CATALOG_NAME, defaultCatalogName);
Catalogs.dropTable(conf, dropProperties);
- AssertHelpers.assertThrows(
- "Should complain about table not found", NoSuchTableException.class,
- "Table does not exist", () -> Catalogs.loadTable(conf, dropProperties));
- }
-
- @Test
- public void testLegacyLoadCatalogDefault() {
- Optional defaultCatalog = Catalogs.loadCatalog(conf, null);
- Assert.assertTrue(defaultCatalog.isPresent());
- Assertions.assertThat(defaultCatalog.get()).isInstanceOf(HiveCatalog.class);
- Assert.assertTrue(Catalogs.hiveCatalog(conf, new Properties()));
- }
-
- @Test
- public void testLegacyLoadCatalogHive() {
- conf.set(InputFormatConfig.CATALOG, CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE);
- Optional hiveCatalog = Catalogs.loadCatalog(conf, null);
- Assert.assertTrue(hiveCatalog.isPresent());
- Assertions.assertThat(hiveCatalog.get()).isInstanceOf(HiveCatalog.class);
- Assert.assertTrue(Catalogs.hiveCatalog(conf, new Properties()));
- }
-
- @Test
- public void testLegacyLoadCatalogHadoop() {
- conf.set(InputFormatConfig.CATALOG, CatalogUtil.ICEBERG_CATALOG_TYPE_HADOOP);
- conf.set(InputFormatConfig.HADOOP_CATALOG_WAREHOUSE_LOCATION, "/tmp/mylocation");
- Optional hadoopCatalog = Catalogs.loadCatalog(conf, null);
- Assert.assertTrue(hadoopCatalog.isPresent());
- Assertions.assertThat(hadoopCatalog.get()).isInstanceOf(HadoopCatalog.class);
- Assert.assertFalse(Catalogs.hiveCatalog(conf, new Properties()));
- }
-
- @Test
- public void testLegacyLoadCatalogCustom() {
- conf.set(InputFormatConfig.CATALOG_LOADER_CLASS, CustomHadoopCatalog.class.getName());
- conf.set(InputFormatConfig.HADOOP_CATALOG_WAREHOUSE_LOCATION, "/tmp/mylocation");
- Optional customHadoopCatalog = Catalogs.loadCatalog(conf, null);
- Assert.assertTrue(customHadoopCatalog.isPresent());
- Assertions.assertThat(customHadoopCatalog.get()).isInstanceOf(CustomHadoopCatalog.class);
- Assert.assertFalse(Catalogs.hiveCatalog(conf, new Properties()));
- }
-
- @Test
- public void testLegacyLoadCatalogLocation() {
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
- Assert.assertFalse(Catalogs.loadCatalog(conf, null).isPresent());
- }
-
- @Test
- public void testLegacyLoadCatalogUnknown() {
- conf.set(InputFormatConfig.CATALOG, "fooType");
- AssertHelpers.assertThrows(
- "should complain about catalog not supported", UnsupportedOperationException.class,
- "Unknown catalog type", () -> Catalogs.loadCatalog(conf, null));
+ Assertions.assertThatThrownBy(() -> Catalogs.loadTable(conf, dropProperties))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessage("Table does not exist: test.table");
}
@Test
@@ -267,17 +219,6 @@ public void testLoadCatalogHive() {
Assert.assertTrue(Catalogs.hiveCatalog(conf, properties));
}
- @Test
- public void testLegacyLoadCustomCatalogWithHiveCatalogTypeSet() {
- String catalogName = "barCatalog";
- conf.set(InputFormatConfig.catalogPropertyConfigKey(catalogName, CatalogUtil.ICEBERG_CATALOG_TYPE),
- CatalogUtil.ICEBERG_CATALOG_TYPE_HIVE);
- conf.set(InputFormatConfig.CATALOG_LOADER_CLASS, CustomHadoopCatalog.class.getName());
- conf.set(InputFormatConfig.HADOOP_CATALOG_WAREHOUSE_LOCATION, "/tmp/mylocation");
- AssertHelpers.assertThrows("Should complain about both configs being set", IllegalArgumentException.class,
- "both type and catalog-impl are set", () -> Catalogs.loadCatalog(conf, catalogName));
- }
-
@Test
public void testLoadCatalogHadoop() {
String catalogName = "barCatalog";
@@ -294,21 +235,6 @@ public void testLoadCatalogHadoop() {
Assert.assertFalse(Catalogs.hiveCatalog(conf, properties));
}
- @Test
- public void testLoadCatalogHadoopWithLegacyWarehouseLocation() {
- String catalogName = "barCatalog";
- conf.set(InputFormatConfig.catalogPropertyConfigKey(catalogName, CatalogUtil.ICEBERG_CATALOG_TYPE),
- CatalogUtil.ICEBERG_CATALOG_TYPE_HADOOP);
- conf.set(InputFormatConfig.HADOOP_CATALOG_WAREHOUSE_LOCATION, "/tmp/mylocation");
- Optional hadoopCatalog = Catalogs.loadCatalog(conf, catalogName);
- Assert.assertTrue(hadoopCatalog.isPresent());
- Assertions.assertThat(hadoopCatalog.get()).isInstanceOf(HadoopCatalog.class);
- Assert.assertEquals("HadoopCatalog{name=barCatalog, location=/tmp/mylocation}", hadoopCatalog.get().toString());
- Properties properties = new Properties();
- properties.put(InputFormatConfig.CATALOG_NAME, catalogName);
- Assert.assertFalse(Catalogs.hiveCatalog(conf, properties));
- }
-
@Test
public void testLoadCatalogCustom() {
String catalogName = "barCatalog";
@@ -333,9 +259,10 @@ public void testLoadCatalogLocation() {
public void testLoadCatalogUnknown() {
String catalogName = "barCatalog";
conf.set(InputFormatConfig.catalogPropertyConfigKey(catalogName, CatalogUtil.ICEBERG_CATALOG_TYPE), "fooType");
- AssertHelpers.assertThrows(
- "should complain about catalog not supported", UnsupportedOperationException.class,
- "Unknown catalog type:", () -> Catalogs.loadCatalog(conf, catalogName));
+
+ Assertions.assertThatThrownBy(() -> Catalogs.loadCatalog(conf, catalogName))
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessage("Unknown catalog type: fooType");
}
@Test
@@ -347,16 +274,18 @@ public void testDefaultCatalogProperties() {
HiveCatalog defaultCatalog = (HiveCatalog) Catalogs.loadCatalog(conf, null).get();
Assert.assertEquals("true", defaultCatalog.properties().get(catalogProperty));
Assert.assertEquals("true",
- defaultCatalog.newTableOps(TableIdentifier.of("default", "iceberg")).io().properties().get(catalogProperty));
+ defaultCatalog.newTableOps(TableIdentifier.of("default", "iceberg"))
+ .io().properties().get(catalogProperty));
// set property at catalog level, and that should take precedence over the global property.
conf.setBoolean(
- String.format("%s%s.%s", InputFormatConfig.CATALOG_CONFIG_PREFIX, Catalogs.ICEBERG_DEFAULT_CATALOG_NAME,
- catalogProperty), false);
+ String.format("%s%s.%s", InputFormatConfig.CATALOG_CONFIG_PREFIX, Catalogs.ICEBERG_DEFAULT_CATALOG_NAME,
+ catalogProperty), false);
defaultCatalog = (HiveCatalog) Catalogs.loadCatalog(conf, null).get();
Assert.assertEquals("false", defaultCatalog.properties().get(catalogProperty));
Assert.assertEquals("false",
- defaultCatalog.newTableOps(TableIdentifier.of("default", "iceberg")).io().properties().get(catalogProperty));
+ defaultCatalog.newTableOps(TableIdentifier.of("default", "iceberg"))
+ .io().properties().get(catalogProperty));
}
public static class CustomHadoopCatalog extends HadoopCatalog {
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java
index 0f749f59b249..dfdb27637fca 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestIcebergInputFormats.java
@@ -64,8 +64,11 @@
import org.apache.iceberg.relocated.com.google.common.collect.Sets;
import org.apache.iceberg.types.TypeUtil;
import org.apache.iceberg.types.Types;
+import org.assertj.core.api.Assertions;
import org.junit.Assert;
+import org.junit.Assume;
import org.junit.Before;
+import org.junit.Ignore;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.TemporaryFolder;
@@ -110,7 +113,7 @@ public class TestIcebergInputFormats {
@Before
public void before() throws IOException {
conf = new Configuration();
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
+ conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
HadoopTables tables = new HadoopTables(conf);
File location = temp.newFolder(testInputFormat.name(), fileFormat.name());
@@ -202,6 +205,42 @@ public void testResiduals() throws Exception {
testInputFormat.create(builder.conf()).validate(writeRecords);
}
+ @Test
+ @Ignore
+ // This test is ignored because for ARVO, the vectorized IcebergInputFormat.IcebergRecordReader doesn't support AVRO
+ // and for ORC and PARQUET, IcebergInputFormat class ignores residuals
+ // '... scan.filter(filter).ignoreResiduals()' and it is not compatible with this test
+ public void testFailedResidualFiltering() throws Exception {
+ Assume.assumeTrue("Vectorization is not yet supported for AVRO", this.fileFormat != FileFormat.AVRO);
+
+ helper.createTable();
+
+ List expectedRecords = helper.generateRandomRecords(2, 0L);
+ expectedRecords.get(0).set(2, "2020-03-20");
+ expectedRecords.get(1).set(2, "2020-03-20");
+
+ helper.appendToTable(Row.of("2020-03-20", 0), expectedRecords);
+
+ builder
+ .useHiveRows()
+ .filter(
+ Expressions.and(Expressions.equal("date", "2020-03-20"), Expressions.equal("id", 0)));
+
+ Assertions.assertThatThrownBy(() -> testInputFormat.create(builder.conf()))
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessage(
+ "Filter expression ref(name=\"id\") == 0 is not completely satisfied. Additional rows can be returned " +
+ "not satisfied by the filter expression");
+
+ builder.usePigTuples();
+
+ Assertions.assertThatThrownBy(() -> testInputFormat.create(builder.conf()))
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessage(
+ "Filter expression ref(name=\"id\") == 0 is not completely satisfied. Additional rows can be returned " +
+ "not satisfied by the filter expression");
+ }
+
@Test
public void testProjection() throws Exception {
helper.createTable();
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestInputFormatReaderDeletes.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestInputFormatReaderDeletes.java
index 2ba4e50e8aa1..5edc299320f6 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestInputFormatReaderDeletes.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/TestInputFormatReaderDeletes.java
@@ -25,6 +25,7 @@
import java.util.stream.Collectors;
import org.apache.hadoop.conf.Configuration;
import org.apache.iceberg.BaseTable;
+import org.apache.iceberg.CatalogUtil;
import org.apache.iceberg.FileFormat;
import org.apache.iceberg.PartitionSpec;
import org.apache.iceberg.Schema;
@@ -65,7 +66,7 @@ public static Object[][] parameters() {
@Before
@Override
public void writeTestDataFile() throws IOException {
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
+ conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
super.writeTestDataFile();
}
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerWithEngineBase.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerWithEngineBase.java
index 6de80dfd32e9..8653c0db02fc 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerWithEngineBase.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/HiveIcebergStorageHandlerWithEngineBase.java
@@ -32,7 +32,7 @@
import org.apache.iceberg.SnapshotSummary;
import org.apache.iceberg.Table;
import org.apache.iceberg.data.Record;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.mr.TestHelper;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableMap;
@@ -112,7 +112,7 @@ public static Collection parameters() {
if (javaVersion.equals("1.8")) {
testParams.add(new Object[] {fileFormat, engine, TestTables.TestTableType.HIVE_CATALOG, false});
// test for vectorization=ON in case of ORC and PARQUET format with Tez engine
- if (fileFormat != FileFormat.METADATA && "tez".equals(engine) && MetastoreUtil.hive3PresentOnClasspath()) {
+ if (fileFormat != FileFormat.METADATA && "tez".equals(engine) && HiveVersion.min(HiveVersion.HIVE_3)) {
testParams.add(new Object[] {fileFormat, engine, TestTables.TestTableType.HIVE_CATALOG, true});
}
}
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java
index adad32aa48a0..e976483b81a1 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestDeserializer.java
@@ -31,7 +31,7 @@
import org.apache.iceberg.Schema;
import org.apache.iceberg.data.GenericRecord;
import org.apache.iceberg.data.Record;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.mr.hive.serde.objectinspector.IcebergObjectInspector;
import org.apache.iceberg.types.Types;
import org.junit.Assert;
@@ -161,7 +161,8 @@ public void testListDeserialize() {
@Test
public void testDeserializeEverySupportedType() {
- Assume.assumeFalse("No test yet for Hive3 (Date/Timestamp creation)", MetastoreUtil.hive3PresentOnClasspath());
+ Assume.assumeFalse(
+ "No test yet for Hive3 (Date/Timestamp creation)", HiveVersion.min(HiveVersion.HIVE_3));
Deserializer deserializer = new Deserializer.Builder()
.schema(HiveIcebergTestUtils.FULL_SCHEMA)
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java
index af1a30405b66..1614d937c37f 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergFilterFactory.java
@@ -31,7 +31,6 @@
import org.apache.hadoop.hive.ql.io.sarg.SearchArgument;
import org.apache.hadoop.hive.ql.io.sarg.SearchArgumentFactory;
import org.apache.hadoop.hive.serde2.io.HiveDecimalWritable;
-import org.apache.iceberg.AssertHelpers;
import org.apache.iceberg.expressions.And;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.expressions.Literal;
@@ -40,6 +39,7 @@
import org.apache.iceberg.expressions.UnboundPredicate;
import org.apache.iceberg.types.Types;
import org.apache.iceberg.util.DateTimeUtil;
+import org.assertj.core.api.Assertions;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
@@ -148,12 +148,9 @@ public void testUnsupportedBetweenOperandEmptyLeaves() {
.between("salary", PredicateLeaf.Type.LONG, 9000L, 15000L)
.end()
.build());
-
- AssertHelpers.assertThrows(
- "must throw if leaves are empty in between operator",
- UnsupportedOperationException.class,
- "Missing leaf literals",
- () -> HiveIcebergFilterFactory.generateFilterExpression(arg));
+ Assertions.assertThatThrownBy(() -> HiveIcebergFilterFactory.generateFilterExpression(arg))
+ .isInstanceOf(UnsupportedOperationException.class)
+ .hasMessage("Missing leaf literals: Leaf[empty]");
}
@Test
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
index c60c3183eb07..aedcfdff5ccc 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestHiveIcebergStorageHandlerNoScan.java
@@ -48,7 +48,6 @@
import org.apache.hadoop.hive.ql.security.authorization.plugin.HiveAuthorizer;
import org.apache.hadoop.hive.ql.security.authorization.plugin.HivePrivilegeObject;
import org.apache.hadoop.hive.serde.serdeConstants;
-import org.apache.iceberg.AssertHelpers;
import org.apache.iceberg.BaseMetastoreTableOperations;
import org.apache.iceberg.BaseTable;
import org.apache.iceberg.FileFormat;
@@ -67,7 +66,7 @@
import org.apache.iceberg.exceptions.NoSuchTableException;
import org.apache.iceberg.hadoop.Util;
import org.apache.iceberg.hive.HiveSchemaUtil;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.mr.Catalogs;
import org.apache.iceberg.mr.InputFormatConfig;
import org.apache.iceberg.mr.TestHelper;
@@ -81,6 +80,7 @@
import org.apache.iceberg.types.Types;
import org.apache.parquet.hadoop.ParquetOutputFormat;
import org.apache.thrift.TException;
+import org.assertj.core.api.Assertions;
import org.junit.After;
import org.junit.AfterClass;
import org.junit.Assert;
@@ -451,11 +451,9 @@ public void testCreateDropTable() throws TException, IOException, InterruptedExc
shell.executeStatement("DROP TABLE customers");
// Check if the table was really dropped even from the Catalog
- AssertHelpers.assertThrows("should throw exception", NoSuchTableException.class,
- "Table does not exist", () -> {
- testTables.loadTable(identifier);
- }
- );
+ Assertions.assertThatThrownBy(() -> testTables.loadTable(identifier))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessageStartingWith("Table does not exist");
} else {
Path hmsTableLocation = new Path(hmsTable.getSd().getLocation());
@@ -463,11 +461,9 @@ public void testCreateDropTable() throws TException, IOException, InterruptedExc
shell.executeStatement("DROP TABLE customers");
// Check if we drop an exception when trying to load the table
- AssertHelpers.assertThrows("should throw exception", NoSuchTableException.class,
- "Table does not exist", () -> {
- testTables.loadTable(identifier);
- }
- );
+ Assertions.assertThatThrownBy(() -> testTables.loadTable(identifier))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessage("Table does not exist: default.customers");
// Check if the files are removed
FileSystem fs = Util.getFs(hmsTableLocation, shell.getHiveConf());
@@ -500,11 +496,9 @@ public void testCreateDropTableNonDefaultCatalog() {
shell.executeStatement("DROP TABLE default.customers");
// Check if the table was really dropped even from the Catalog
- AssertHelpers.assertThrows("should throw exception", NoSuchTableException.class,
- "Table does not exist", () -> {
- testTables.loadTable(identifier);
- }
- );
+ Assertions.assertThatThrownBy(() -> testTables.loadTable(identifier))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessageStartingWith("Table does not exist");
}
@Test
@@ -599,11 +593,9 @@ public void testDeleteBackingTable() throws TException, IOException, Interrupted
shell.executeStatement("DROP TABLE customers");
// Check if we drop an exception when trying to drop the table
- AssertHelpers.assertThrows("should throw exception", NoSuchTableException.class,
- "Table does not exist", () -> {
- testTables.loadTable(identifier);
- }
- );
+ Assertions.assertThatThrownBy(() -> testTables.loadTable(identifier))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessage("Table does not exist: default.customers");
// Check if the files are kept
FileSystem fs = Util.getFs(hmsTableLocation, shell.getHiveConf());
@@ -633,11 +625,9 @@ public void testDropTableWithCorruptedMetadata() throws TException, IOException,
// check if HMS table is nonetheless still droppable
shell.executeStatement(String.format("DROP TABLE %s", identifier));
- AssertHelpers.assertThrows("should throw exception", NoSuchTableException.class,
- "Table does not exist", () -> {
- testTables.loadTable(identifier);
- }
- );
+ Assertions.assertThatThrownBy(() -> testTables.loadTable(identifier))
+ .isInstanceOf(NoSuchTableException.class)
+ .hasMessage("Table does not exist: default.customers");
}
@Test
@@ -645,37 +635,55 @@ public void testCreateTableError() {
TableIdentifier identifier = TableIdentifier.of("default", "withShell2");
// Wrong schema
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Unrecognized token 'WrongSchema'", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE withShell2 " +
- "STORED BY ICEBERG " +
- testTables.locationForCreateTableSQL(identifier) +
- "TBLPROPERTIES ('" + InputFormatConfig.TABLE_SCHEMA + "'='WrongSchema'" +
- ",'" + InputFormatConfig.CATALOG_NAME + "'='" + testTables.catalogName() + "')");
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE withShell2 " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ testTables.locationForCreateTableSQL(identifier) +
+ "TBLPROPERTIES ('" +
+ InputFormatConfig.TABLE_SCHEMA +
+ "'='WrongSchema'" +
+ ",'" +
+ InputFormatConfig.CATALOG_NAME +
+ "'='" +
+ testTables.catalogName() +
+ "')"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageContaining("Unrecognized token 'WrongSchema'");
// Missing schema, we try to get the schema from the table and fail
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Please provide ", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE withShell2 " +
- "STORED BY ICEBERG " +
- testTables.locationForCreateTableSQL(identifier) +
- testTables.propertiesForCreateTableSQL(ImmutableMap.of()));
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE withShell2 " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ testTables.locationForCreateTableSQL(identifier) +
+ testTables.propertiesForCreateTableSQL(ImmutableMap.of())))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageContaining("Please provide an existing table or a valid schema");
if (!testTables.locationForCreateTableSQL(identifier).isEmpty()) {
// Only test this if the location is required
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Table location not set", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE withShell2 " +
- "STORED BY ICEBERG " +
- "TBLPROPERTIES ('" + InputFormatConfig.TABLE_SCHEMA + "'='" +
- SchemaParser.toJson(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA) + "','" +
- InputFormatConfig.CATALOG_NAME + "'='" + testTables.catalogName() + "')");
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE withShell2 " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ "TBLPROPERTIES ('" +
+ InputFormatConfig.TABLE_SCHEMA +
+ "'='" +
+ SchemaParser.toJson(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA) +
+ "','" +
+ InputFormatConfig.CATALOG_NAME +
+ "'='" +
+ testTables.catalogName() +
+ "')"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageEndingWith("Table location not set");
}
}
@@ -687,15 +695,23 @@ public void testCreateTableAboveExistingTable() throws IOException {
if (testTableType == TestTables.TestTableType.HIVE_CATALOG) {
// In HiveCatalog we just expect an exception since the table is already exists
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "customers already exists", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE customers " +
- "STORED BY ICEBERG " +
- "TBLPROPERTIES ('" + InputFormatConfig.TABLE_SCHEMA + "'='" +
- SchemaParser.toJson(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA) + "',' " +
- InputFormatConfig.CATALOG_NAME + "'='" + testTables.catalogName() + "')");
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE customers " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ "TBLPROPERTIES ('" +
+ InputFormatConfig.TABLE_SCHEMA +
+ "'='" +
+ SchemaParser.toJson(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA) +
+ "',' " +
+ InputFormatConfig.CATALOG_NAME +
+ "'='" +
+ testTables.catalogName() +
+ "')"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageContaining("customers already exists");
} else {
// With other catalogs, table creation should succeed
shell.executeStatement("CREATE EXTERNAL TABLE customers " +
@@ -727,16 +743,24 @@ public void testCreatePartitionedTableWithPropertiesAndWithColumnSpecification()
PartitionSpec spec =
PartitionSpec.builderFor(HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA).identity("last_name").build();
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Provide only one of the following", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE customers (customer_id BIGINT) " +
- "PARTITIONED BY (first_name STRING) " +
- "STORED BY ICEBERG " +
- testTables.locationForCreateTableSQL(TableIdentifier.of("default", "customers")) +
- testTables.propertiesForCreateTableSQL(
- ImmutableMap.of(InputFormatConfig.PARTITION_SPEC, PartitionSpecParser.toJson(spec))));
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE customers (customer_id BIGINT) " +
+ "PARTITIONED BY (first_name STRING) " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ testTables.locationForCreateTableSQL(
+ TableIdentifier.of("default", "customers")) +
+ " TBLPROPERTIES ('" +
+ InputFormatConfig.PARTITION_SPEC +
+ "'='" +
+ PartitionSpecParser.toJson(spec) +
+ "')"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageEndingWith(
+ "Provide only one of the following: Hive partition transform specification, " +
+ "or the iceberg.mr.table.partition.spec property");
}
@Test
@@ -799,15 +823,19 @@ public void testCreateTableWithNotSupportedTypes() {
"CHAR(1)", Types.StringType.get());
for (String notSupportedType : notSupportedTypes.keySet()) {
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Unsupported Hive type", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE not_supported_types " +
- "(not_supported " + notSupportedType + ") " +
- "STORED BY ICEBERG " +
- testTables.locationForCreateTableSQL(identifier) +
- testTables.propertiesForCreateTableSQL(ImmutableMap.of()));
- }
- );
+ Assertions.assertThatThrownBy(
+ () ->
+ shell.executeStatement(
+ "CREATE EXTERNAL TABLE not_supported_types " +
+ "(not_supported " +
+ notSupportedType +
+ ") " +
+ "STORED BY 'org.apache.iceberg.mr.hive.HiveIcebergStorageHandler' " +
+ testTables.locationForCreateTableSQL(identifier) +
+ testTables.propertiesForCreateTableSQL(ImmutableMap.of())))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageStartingWith("Failed to execute Hive query")
+ .hasMessageContaining("Unsupported Hive type");
}
}
@@ -974,7 +1002,7 @@ public void testIcebergAndHmsTableProperties() throws Exception {
if (Catalogs.hiveCatalog(shell.getHiveConf(), tableProperties)) {
expectedIcebergProperties.put(TableProperties.ENGINE_HIVE_ENABLED, "true");
}
- if (MetastoreUtil.hive3PresentOnClasspath()) {
+ if (HiveVersion.min(HiveVersion.HIVE_3)) {
expectedIcebergProperties.put("bucketing_version", "2");
}
Assert.assertEquals(expectedIcebergProperties, icebergTable.properties());
@@ -1344,15 +1372,17 @@ public void testAlterTableReplaceColumnsFailsWhenNotOnlyDropping() {
};
for (String command : commands) {
- AssertHelpers.assertThrows("", IllegalArgumentException.class,
- "Unsupported operation to use REPLACE COLUMNS", () -> shell.executeStatement(command));
+ Assertions.assertThatThrownBy(() -> shell.executeStatement(command))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Unsupported operation to use REPLACE COLUMNS");
}
// check no-op case too
String command = "ALTER TABLE default.customers REPLACE COLUMNS (customer_id int, first_name string COMMENT 'This" +
" is first name', last_name string COMMENT 'This is last name', address struct)";
- AssertHelpers.assertThrows("", IllegalArgumentException.class,
- "No schema change detected", () -> shell.executeStatement(command));
+ Assertions.assertThatThrownBy(() -> shell.executeStatement(command))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("No schema change detected");
}
@Test
@@ -1445,9 +1475,9 @@ public void testCommandsWithPartitionClauseThrow() {
};
for (String command : commands) {
- AssertHelpers.assertThrows("Should throw unsupported operation exception for queries with partition spec",
- IllegalArgumentException.class, "Using partition spec in query is unsupported",
- () -> shell.executeStatement(command));
+ Assertions.assertThatThrownBy(() -> shell.executeStatement(command))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Using partition spec in query is unsupported");
}
}
@@ -1597,12 +1627,12 @@ public void testAlterTableWithMetadataLocationFromAnotherTable() throws IOExcept
TableIdentifier targetIdentifier = TableIdentifier.of("default", "target");
testTables.createTable(shell, targetIdentifier.name(), HiveIcebergStorageHandlerTestUtils.CUSTOMER_SCHEMA,
PartitionSpec.unpartitioned(), FileFormat.PARQUET, Collections.emptyList(), 1, Collections.emptyMap());
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Cannot change iceberg table",
- () -> {
- shell.executeStatement("ALTER TABLE " + targetIdentifier.name() + " SET TBLPROPERTIES('metadata_location'='" +
+ Assertions.assertThatThrownBy(() -> {
+ shell.executeStatement("ALTER TABLE " + targetIdentifier.name() + " SET TBLPROPERTIES('metadata_location'='" +
metadataLocation + "')");
- });
+ })
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Cannot change iceberg table");
}
@Test
@@ -1612,12 +1642,11 @@ public void testAlterTableToIcebergAndMetadataLocation() throws IOException {
testTables.locationForCreateTableSQL(TableIdentifier.of("default", tableName)) +
testTables.propertiesForCreateTableSQL(ImmutableMap.of());
shell.executeStatement(createQuery);
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Cannot perform table migration to Iceberg and setting the snapshot location in one step.",
- () -> {
- shell.executeStatement("ALTER TABLE " + tableName + " SET TBLPROPERTIES(" +
- "'storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler','metadata_location'='asdf')");
- });
+ Assertions.assertThatThrownBy(() -> shell.executeStatement("ALTER TABLE " + tableName + " SET TBLPROPERTIES(" +
+ "'storage_handler'='org.apache.iceberg.mr.hive.HiveIcebergStorageHandler','metadata_location'='asdf')"))
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Cannot perform table migration to Iceberg " +
+ "and setting the snapshot location in one step.");
}
@Test
@@ -1658,12 +1687,13 @@ public void testCTLTHiveCatalogValidation() throws TException, InterruptedExcept
shell.executeStatement("insert into source values(1)");
// Run a CTLT query.
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- " CTLT target table must be a HiveCatalog table", () -> {
- shell.executeStatement(String.format("CREATE TABLE dest LIKE source STORED BY ICEBERG %s %s",
+ Assertions.assertThatThrownBy(() -> {
+ shell.executeStatement(String.format("CREATE TABLE dest LIKE source STORED BY ICEBERG %s %s",
testTables.locationForCreateTableSQL(TableIdentifier.of("default", "dest")),
testTables.propertiesForCreateTableSQL(ImmutableMap.of())));
- });
+ })
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining(" CTLT target table must be a HiveCatalog table");
}
@Test
@@ -1779,14 +1809,15 @@ public void testCreateTableWithMetadataLocationWithoutSchema() throws IOExceptio
testTables.propertiesForCreateTableSQL(Collections.singletonMap("metadata_location", metadataLocation));
// Try the query with columns also specified, it should throw exception.
- AssertHelpers.assertThrows("should throw exception", IllegalArgumentException.class,
- "Column names can not be provided along with metadata location.", () -> {
- shell.executeStatement("CREATE EXTERNAL TABLE target (id int) STORED BY ICEBERG " +
+ Assertions.assertThatThrownBy(() -> {
+ shell.executeStatement("CREATE EXTERNAL TABLE target (id int) STORED BY ICEBERG " +
testTables.locationForCreateTableSQL(targetIdentifier) + tblProps);
- });
+ })
+ .isInstanceOf(IllegalArgumentException.class)
+ .hasMessageContaining("Column names can not be provided along with metadata location.");
shell.executeStatement(
- "CREATE EXTERNAL TABLE target STORED BY ICEBERG " + testTables.locationForCreateTableSQL(targetIdentifier) +
- tblProps);
+ "CREATE EXTERNAL TABLE target STORED BY ICEBERG " + testTables.locationForCreateTableSQL(targetIdentifier) +
+ tblProps);
// Check the partition and the schema are preserved.
Table targetIcebergTable =
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestTables.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestTables.java
index c988fa88fd26..656f16b4a1cd 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestTables.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/TestTables.java
@@ -49,7 +49,7 @@
import org.apache.iceberg.hadoop.HadoopCatalog;
import org.apache.iceberg.hadoop.HadoopTables;
import org.apache.iceberg.hive.HiveCatalog;
-import org.apache.iceberg.hive.MetastoreUtil;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.mr.Catalogs;
import org.apache.iceberg.mr.InputFormatConfig;
import org.apache.iceberg.mr.TestCatalogs;
@@ -506,7 +506,7 @@ static class CustomCatalogTestTables extends TestTables {
private final String warehouseLocation;
CustomCatalogTestTables(Configuration conf, TemporaryFolder temp, String catalogName) throws IOException {
- this(conf, temp, (MetastoreUtil.hive3PresentOnClasspath() ? "file:" : "") +
+ this(conf, temp, (HiveVersion.min(HiveVersion.HIVE_3) ? "file:" : "") +
temp.newFolder("custom", "warehouse").toString(), catalogName);
}
@@ -537,7 +537,7 @@ static class HadoopCatalogTestTables extends TestTables {
private final String warehouseLocation;
HadoopCatalogTestTables(Configuration conf, TemporaryFolder temp, String catalogName) throws IOException {
- this(conf, temp, (MetastoreUtil.hive3PresentOnClasspath() ? "file:" : "") +
+ this(conf, temp, (HiveVersion.min(HiveVersion.HIVE_3) ? "file:" : "") +
temp.newFolder("hadoop", "warehouse").toString(), catalogName);
}
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java
index eb589b2495e6..b6577a3dd259 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/serde/objectinspector/TestIcebergObjectInspector.java
@@ -27,6 +27,7 @@
import org.apache.hadoop.hive.serde2.typeinfo.PrimitiveTypeInfo;
import org.apache.hadoop.hive.serde2.typeinfo.TypeInfoFactory;
import org.apache.iceberg.Schema;
+import org.apache.iceberg.hive.HiveVersion;
import org.apache.iceberg.relocated.com.google.common.collect.ImmutableList;
import org.apache.iceberg.types.Types;
import org.junit.Assert;
@@ -90,7 +91,15 @@ public void testIcebergObjectInspector() {
Assert.assertEquals(3, dateField.getFieldID());
Assert.assertEquals("date_field", dateField.getFieldName());
Assert.assertEquals("date comment", dateField.getFieldComment());
- Assert.assertEquals(IcebergDateObjectInspectorHive3.get(), dateField.getFieldObjectInspector());
+ if (HiveVersion.min(HiveVersion.HIVE_3)) {
+ Assert.assertEquals(
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspectorHive3",
+ dateField.getFieldObjectInspector().getClass().getName());
+ } else {
+ Assert.assertEquals(
+ "org.apache.iceberg.mr.hive.serde.objectinspector.IcebergDateObjectInspector",
+ dateField.getFieldObjectInspector().getClass().getName());
+ }
// decimal
StructField decimalField = soi.getStructFieldRef("decimal_field");
diff --git a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/vector/TestHiveVectorizedReader.java b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/vector/TestHiveVectorizedReader.java
index 9decd05ad7e8..fae2e207ba2a 100644
--- a/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/vector/TestHiveVectorizedReader.java
+++ b/iceberg/iceberg-handler/src/test/java/org/apache/iceberg/mr/hive/vector/TestHiveVectorizedReader.java
@@ -29,6 +29,7 @@
import org.apache.hadoop.mapreduce.InputSplit;
import org.apache.hadoop.mapreduce.RecordReader;
import org.apache.hadoop.mapreduce.TaskAttemptContext;
+import org.apache.iceberg.CatalogUtil;
import org.apache.iceberg.FileFormat;
import org.apache.iceberg.Schema;
import org.apache.iceberg.data.Record;
@@ -76,7 +77,7 @@ public void before() throws IOException, HiveException {
Assert.assertTrue(location.delete());
Configuration conf = prepareMockJob(SCHEMA, new Path(location.toString()));
- conf.set(InputFormatConfig.CATALOG, Catalogs.LOCATION);
+ conf.set(CatalogUtil.ICEBERG_CATALOG_TYPE, Catalogs.LOCATION);
HadoopTables tables = new HadoopTables(conf);
helper = new TestHelper(conf, tables, location.toString(), SCHEMA, null, fileFormat, temp);
diff --git a/iceberg/iceberg-handler/src/test/queries/positive/show_partitions_test.q b/iceberg/iceberg-handler/src/test/queries/positive/show_partitions_test.q
index 0d1ebef44ba2..b424fac02806 100644
--- a/iceberg/iceberg-handler/src/test/queries/positive/show_partitions_test.q
+++ b/iceberg/iceberg-handler/src/test/queries/positive/show_partitions_test.q
@@ -14,16 +14,19 @@ insert into ice1 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2,
--compare hive table with iceberg table
show partitions hiveT1;
-show partitions ice1 ;
+describe default.ice1.partitions;
select * from default.ice1.partitions order by `partition`;
+show partitions ice1 ;
+
explain show partitions hiveT1;
explain show partitions ice1;
explain select * from default.ice1.partitions;
--- Partition evolution
-create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2') ;
-insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5);
+---- Partition evolution
+create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc
+TBLPROPERTIES("format-version"='2') ;
+insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2,10, 5);
select * from default.ice2.partitions order by `partition`;
show partitions ice2;
@@ -32,7 +35,8 @@ ALTER TABLE ice2 SET PARTITION SPEC (c) ;
select * from default.ice2.partitions order by `partition`;
show partitions ice2;
-insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5, 10, 5);
+insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5,
+10, 5);
select * from default.ice2.partitions order by `partition`;
show partitions ice2;
diff --git a/iceberg/iceberg-handler/src/test/results/positive/describe_iceberg_metadata_tables.q.out b/iceberg/iceberg-handler/src/test/results/positive/describe_iceberg_metadata_tables.q.out
index 8014b443e18f..dccc778cd214 100644
--- a/iceberg/iceberg-handler/src/test/results/positive/describe_iceberg_metadata_tables.q.out
+++ b/iceberg/iceberg-handler/src/test/results/positive/describe_iceberg_metadata_tables.q.out
@@ -67,6 +67,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe default.ice_meta_desc.history
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -113,8 +114,12 @@ PREHOOK: Input: default@ice_meta_desc
POSTHOOK: query: describe default.ice_meta_desc.partitions
POSTHOOK: type: DESCTABLE
POSTHOOK: Input: default@ice_meta_desc
-record_count bigint
-file_count int
+record_count bigint Count of records in data files
+file_count int Count of data files
+position_delete_record_count bigint Count of records in position delete files
+position_delete_file_count int Count of position delete files
+equality_delete_record_count bigint Count of records in equality delete files
+equality_delete_file_count int Count of equality delete files
PREHOOK: query: describe default.ice_meta_desc.all_manifests
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -167,6 +172,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe default.ice_meta_desc.data_files
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -313,6 +319,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe formatted default.ice_meta_desc.history
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -363,8 +370,12 @@ POSTHOOK: query: describe formatted default.ice_meta_desc.partitions
POSTHOOK: type: DESCTABLE
POSTHOOK: Input: default@ice_meta_desc
# col_name data_type comment
-record_count bigint
-file_count int
+record_count bigint Count of records in data files
+file_count int Count of data files
+position_delete_record_count bigint Count of records in position delete files
+position_delete_file_count int Count of position delete files
+equality_delete_record_count bigint Count of records in equality delete files
+equality_delete_file_count int Count of equality delete files
PREHOOK: query: describe formatted default.ice_meta_desc.all_manifests
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -420,6 +431,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe formatted default.ice_meta_desc.data_files
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -570,6 +582,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe extended default.ice_meta_desc.history
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -616,8 +629,12 @@ PREHOOK: Input: default@ice_meta_desc
POSTHOOK: query: describe extended default.ice_meta_desc.partitions
POSTHOOK: type: DESCTABLE
POSTHOOK: Input: default@ice_meta_desc
-record_count bigint
-file_count int
+record_count bigint Count of records in data files
+file_count int Count of data files
+position_delete_record_count bigint Count of records in position delete files
+position_delete_file_count int Count of position delete files
+equality_delete_record_count bigint Count of records in equality delete files
+equality_delete_file_count int Count of equality delete files
PREHOOK: query: describe extended default.ice_meta_desc.all_manifests
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
@@ -670,6 +687,7 @@ snapshot_id bigint
sequence_number bigint
file_sequence_number bigint
data_file struct,value_counts:map,null_value_counts:map,nan_value_counts:map,lower_bounds:map,upper_bounds:map,key_metadata:binary,split_offsets:array,equality_ids:array,sort_order_id:int>
+readable_metrics struct,value:struct> Column metrics in readable form
PREHOOK: query: describe formatted default.ice_meta_desc.data_files
PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice_meta_desc
diff --git a/iceberg/iceberg-handler/src/test/results/positive/dynamic_partition_writes.q.out b/iceberg/iceberg-handler/src/test/results/positive/dynamic_partition_writes.q.out
index b1e7fcfe4532..037d1b439f73 100644
--- a/iceberg/iceberg-handler/src/test/results/positive/dynamic_partition_writes.q.out
+++ b/iceberg/iceberg-handler/src/test/results/positive/dynamic_partition_writes.q.out
@@ -328,19 +328,19 @@ POSTHOOK: query: select * from default.tbl_target_mixed.partitions order by `par
POSTHOOK: type: QUERY
POSTHOOK: Input: default@tbl_target_mixed
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"ccy":"CZK","c_bucket":1} 1 1 0
-{"ccy":"CZK","c_bucket":2} 1 1 0
-{"ccy":"EUR","c_bucket":0} 1 1 0
-{"ccy":"EUR","c_bucket":1} 2 1 0
-{"ccy":"EUR","c_bucket":2} 3 1 0
-{"ccy":"HUF","c_bucket":1} 2 1 0
-{"ccy":"PLN","c_bucket":0} 2 1 0
-{"ccy":"PLN","c_bucket":1} 1 1 0
-{"ccy":"PLN","c_bucket":2} 1 1 0
-{"ccy":"USD","c_bucket":0} 2 1 0
-{"ccy":"USD","c_bucket":1} 3 1 0
-{"ccy":"USD","c_bucket":2} 1 1 0
-{"ccy":null,"c_bucket":null} 2 1 0
+{"ccy":"CZK","c_bucket":1} 0 1 1 0 0 0 0
+{"ccy":"CZK","c_bucket":2} 0 1 1 0 0 0 0
+{"ccy":"EUR","c_bucket":0} 0 1 1 0 0 0 0
+{"ccy":"EUR","c_bucket":1} 0 2 1 0 0 0 0
+{"ccy":"EUR","c_bucket":2} 0 3 1 0 0 0 0
+{"ccy":"HUF","c_bucket":1} 0 2 1 0 0 0 0
+{"ccy":"PLN","c_bucket":0} 0 2 1 0 0 0 0
+{"ccy":"PLN","c_bucket":1} 0 1 1 0 0 0 0
+{"ccy":"PLN","c_bucket":2} 0 1 1 0 0 0 0
+{"ccy":"USD","c_bucket":0} 0 2 1 0 0 0 0
+{"ccy":"USD","c_bucket":1} 0 3 1 0 0 0 0
+{"ccy":"USD","c_bucket":2} 0 1 1 0 0 0 0
+{"ccy":null,"c_bucket":null} 0 2 1 0 0 0 0
PREHOOK: query: select * from default.tbl_target_mixed.files
PREHOOK: type: QUERY
PREHOOK: Input: default@tbl_target_mixed
diff --git a/iceberg/iceberg-handler/src/test/results/positive/query_iceberg_metadata_of_partitioned_table.q.out b/iceberg/iceberg-handler/src/test/results/positive/query_iceberg_metadata_of_partitioned_table.q.out
index c663ca5688e0..efc7a74a9373 100644
--- a/iceberg/iceberg-handler/src/test/results/positive/query_iceberg_metadata_of_partitioned_table.q.out
+++ b/iceberg/iceberg-handler/src/test/results/positive/query_iceberg_metadata_of_partitioned_table.q.out
@@ -296,8 +296,8 @@ POSTHOOK: query: select * from default.ice_meta_2.partitions
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_2
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"four"} 1 1 0
-{"b":"three"} 3 1 0
+{"b":"four"} 0 1 1 0 0 0 0
+{"b":"three"} 0 3 1 0 0 0 0
PREHOOK: query: select * from default.ice_meta_3.partitions
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_3
@@ -306,13 +306,13 @@ POSTHOOK: query: select * from default.ice_meta_3.partitions
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_3
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"four","c":"Saturday"} 3 1 0
-{"b":"four","c":"Sunday"} 1 1 0
-{"b":"four","c":"Thursday"} 1 1 0
-{"b":"one","c":"Monday"} 3 1 0
-{"b":"three","c":"Wednesday"} 3 1 0
-{"b":"two","c":"Friday"} 2 1 0
-{"b":"two","c":"Tuesday"} 2 1 0
+{"b":"four","c":"Saturday"} 0 3 1 0 0 0 0
+{"b":"four","c":"Sunday"} 0 1 1 0 0 0 0
+{"b":"four","c":"Thursday"} 0 1 1 0 0 0 0
+{"b":"one","c":"Monday"} 0 3 1 0 0 0 0
+{"b":"three","c":"Wednesday"} 0 3 1 0 0 0 0
+{"b":"two","c":"Friday"} 0 2 1 0 0 0 0
+{"b":"two","c":"Tuesday"} 0 2 1 0 0 0 0
PREHOOK: query: select `partition` from default.ice_meta_2.partitions where `partition`.b='four'
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_2
@@ -330,7 +330,7 @@ POSTHOOK: query: select * from default.ice_meta_3.partitions where `partition`.b
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_3
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"two","c":"Tuesday"} 2 1 0
+{"b":"two","c":"Tuesday"} 0 2 1 0 0 0 0
PREHOOK: query: select partition_summaries from default.ice_meta_3.manifests where partition_summaries[1].upper_bound='Wednesday'
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_3
@@ -592,8 +592,8 @@ POSTHOOK: query: select * from default.ice_meta_2.partitions
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_2
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"four"} 1 1 0
-{"b":"three"} 3 1 0
+{"b":"four"} 0 1 1 0 0 0 0
+{"b":"three"} 0 3 1 0 0 0 0
PREHOOK: query: select * from default.ice_meta_3.partitions
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_3
@@ -602,13 +602,13 @@ POSTHOOK: query: select * from default.ice_meta_3.partitions
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_3
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"four","c":"Saturday"} 3 1 0
-{"b":"four","c":"Sunday"} 1 1 0
-{"b":"four","c":"Thursday"} 1 1 0
-{"b":"one","c":"Monday"} 3 1 0
-{"b":"three","c":"Wednesday"} 3 1 0
-{"b":"two","c":"Friday"} 2 1 0
-{"b":"two","c":"Tuesday"} 2 1 0
+{"b":"four","c":"Saturday"} 0 3 1 0 0 0 0
+{"b":"four","c":"Sunday"} 0 1 1 0 0 0 0
+{"b":"four","c":"Thursday"} 0 1 1 0 0 0 0
+{"b":"one","c":"Monday"} 0 3 1 0 0 0 0
+{"b":"three","c":"Wednesday"} 0 3 1 0 0 0 0
+{"b":"two","c":"Friday"} 0 2 1 0 0 0 0
+{"b":"two","c":"Tuesday"} 0 2 1 0 0 0 0
PREHOOK: query: select `partition` from default.ice_meta_2.partitions where `partition`.b='four'
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_2
@@ -626,7 +626,7 @@ POSTHOOK: query: select * from default.ice_meta_3.partitions where `partition`.b
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice_meta_3
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"b":"two","c":"Tuesday"} 2 1 0
+{"b":"two","c":"Tuesday"} 0 2 1 0 0 0 0
PREHOOK: query: select partition_summaries from default.ice_meta_3.manifests where partition_summaries[1].upper_bound='Wednesday'
PREHOOK: type: QUERY
PREHOOK: Input: default@ice_meta_3
@@ -833,6 +833,6 @@ POSTHOOK: query: select * from default.partevv.partitions
POSTHOOK: type: QUERY
POSTHOOK: Input: default@partevv
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"id":1,"ts_day":null} 1 1 1
-{"id":2,"ts_day":null} 1 1 1
-{"id":null,"ts_day":"2022-04-29"} 1 1 2
+{"id":1,"ts_day":null} 1 1 1 0 0 0 0
+{"id":2,"ts_day":null} 1 1 1 0 0 0 0
+{"id":null,"ts_day":"2022-04-29"} 2 1 1 0 0 0 0
diff --git a/iceberg/iceberg-handler/src/test/results/positive/show_partitions_test.q.out b/iceberg/iceberg-handler/src/test/results/positive/show_partitions_test.q.out
index 3d6fcd4ba676..ee3eb58f1850 100644
--- a/iceberg/iceberg-handler/src/test/results/positive/show_partitions_test.q.out
+++ b/iceberg/iceberg-handler/src/test/results/positive/show_partitions_test.q.out
@@ -51,15 +51,20 @@ POSTHOOK: Input: default@hivet1
d_part=10/e_part=5
d_part=2/e_part=5
d_part=3/e_part=4
-PREHOOK: query: show partitions ice1
-PREHOOK: type: SHOWPARTITIONS
+PREHOOK: query: describe default.ice1.partitions
+PREHOOK: type: DESCTABLE
PREHOOK: Input: default@ice1
-POSTHOOK: query: show partitions ice1
-POSTHOOK: type: SHOWPARTITIONS
+POSTHOOK: query: describe default.ice1.partitions
+POSTHOOK: type: DESCTABLE
POSTHOOK: Input: default@ice1
-current-spec-id=0/d_part=10/e_part=5
-current-spec-id=0/d_part=2/e_part=5
-current-spec-id=0/d_part=3/e_part=4
+partition struct
+spec_id int
+record_count bigint Count of records in data files
+file_count int Count of data files
+position_delete_record_count bigint Count of records in position delete files
+position_delete_file_count int Count of position delete files
+equality_delete_record_count bigint Count of records in equality delete files
+equality_delete_file_count int Count of equality delete files
PREHOOK: query: select * from default.ice1.partitions order by `partition`
PREHOOK: type: QUERY
PREHOOK: Input: default@ice1
@@ -68,9 +73,18 @@ POSTHOOK: query: select * from default.ice1.partitions order by `partition`
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice1
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"d_part":10,"e_part":5} 2 1 0
-{"d_part":2,"e_part":5} 1 1 0
-{"d_part":3,"e_part":4} 2 1 0
+{"d_part":10,"e_part":5} 0 2 1 0 0 0 0
+{"d_part":2,"e_part":5} 0 1 1 0 0 0 0
+{"d_part":3,"e_part":4} 0 2 1 0 0 0 0
+PREHOOK: query: show partitions ice1
+PREHOOK: type: SHOWPARTITIONS
+PREHOOK: Input: default@ice1
+POSTHOOK: query: show partitions ice1
+POSTHOOK: type: SHOWPARTITIONS
+POSTHOOK: Input: default@ice1
+current-spec-id=0/d_part=10/e_part=5
+current-spec-id=0/d_part=2/e_part=5
+current-spec-id=0/d_part=3/e_part=4
PREHOOK: query: explain show partitions hiveT1
PREHOOK: type: SHOWPARTITIONS
PREHOOK: Input: default@hivet1
@@ -109,23 +123,25 @@ Stage-0
Fetch Operator
limit:-1
Select Operator [SEL_1]
- Output:["_col0","_col1","_col2","_col3"]
+ Output:["_col0","_col1","_col2","_col3","_col4","_col5","_col6","_col7"]
TableScan [TS_0]
- Output:["partition","record_count","file_count","spec_id"]
+ Output:["partition","spec_id","record_count","file_count","position_delete_record_count","position_delete_file_count","equality_delete_record_count","equality_delete_file_count"]
-PREHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2')
+PREHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc
+TBLPROPERTIES("format-version"='2')
PREHOOK: type: CREATETABLE
PREHOOK: Output: database:default
PREHOOK: Output: default@ice2
-POSTHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc TBLPROPERTIES("format-version"='2')
+POSTHOOK: query: create table ice2 (a string, b int, c int) PARTITIONED BY (d_part int, e_part int) stored by iceberg stored as orc
+TBLPROPERTIES("format-version"='2')
POSTHOOK: type: CREATETABLE
POSTHOOK: Output: database:default
POSTHOOK: Output: default@ice2
-PREHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5)
+PREHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2,10, 5)
PREHOOK: type: QUERY
PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@ice2
-POSTHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2, 10, 5)
+POSTHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 2, 2, 5), ('aa', 1, 2, 10, 5), ('aa', 1, 2,10, 5)
POSTHOOK: type: QUERY
POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@ice2
@@ -137,9 +153,9 @@ POSTHOOK: query: select * from default.ice2.partitions order by `partition`
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice2
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"d_part":10,"e_part":5} 2 1 0
-{"d_part":2,"e_part":5} 1 1 0
-{"d_part":3,"e_part":4} 2 1 0
+{"d_part":10,"e_part":5} 0 2 1 0 0 0 0
+{"d_part":2,"e_part":5} 0 1 1 0 0 0 0
+{"d_part":3,"e_part":4} 0 2 1 0 0 0 0
PREHOOK: query: show partitions ice2
PREHOOK: type: SHOWPARTITIONS
PREHOOK: Input: default@ice2
@@ -164,9 +180,9 @@ POSTHOOK: query: select * from default.ice2.partitions order by `partition`
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice2
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"d_part":10,"e_part":5,"c":null} 2 1 0
-{"d_part":2,"e_part":5,"c":null} 1 1 0
-{"d_part":3,"e_part":4,"c":null} 2 1 0
+{"d_part":10,"e_part":5,"c":null} 0 2 1 0 0 0 0
+{"d_part":2,"e_part":5,"c":null} 0 1 1 0 0 0 0
+{"d_part":3,"e_part":4,"c":null} 0 2 1 0 0 0 0
PREHOOK: query: show partitions ice2
PREHOOK: type: SHOWPARTITIONS
PREHOOK: Input: default@ice2
@@ -176,11 +192,13 @@ POSTHOOK: Input: default@ice2
spec-id=0/d_part=10/e_part=5
spec-id=0/d_part=2/e_part=5
spec-id=0/d_part=3/e_part=4
-PREHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5, 10, 5)
+PREHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5,
+10, 5)
PREHOOK: type: QUERY
PREHOOK: Input: _dummy_database@_dummy_table
PREHOOK: Output: default@ice2
-POSTHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5, 10, 5)
+POSTHOOK: query: insert into ice2 values ('aa', 1, 2, 3, 4), ('aa', 1, 2, 3, 4), ('aa', 1, 3, 2, 5), ('aa', 1, 4, 10, 5), ('aa', 1, 5,
+10, 5)
POSTHOOK: type: QUERY
POSTHOOK: Input: _dummy_database@_dummy_table
POSTHOOK: Output: default@ice2
@@ -192,13 +210,13 @@ POSTHOOK: query: select * from default.ice2.partitions order by `partition`
POSTHOOK: type: QUERY
POSTHOOK: Input: default@ice2
POSTHOOK: Output: hdfs://### HDFS PATH ###
-{"d_part":10,"e_part":5,"c":null} 2 1 0
-{"d_part":2,"e_part":5,"c":null} 1 1 0
-{"d_part":3,"e_part":4,"c":null} 2 1 0
-{"d_part":null,"e_part":null,"c":2} 2 1 1
-{"d_part":null,"e_part":null,"c":3} 1 1 1
-{"d_part":null,"e_part":null,"c":4} 1 1 1
-{"d_part":null,"e_part":null,"c":5} 1 1 1
+{"d_part":10,"e_part":5,"c":null} 0 2 1 0 0 0 0
+{"d_part":2,"e_part":5,"c":null} 0 1 1 0 0 0 0
+{"d_part":3,"e_part":4,"c":null} 0 2 1 0 0 0 0
+{"d_part":null,"e_part":null,"c":2} 1 2 1 0 0 0 0
+{"d_part":null,"e_part":null,"c":3} 1 1 1 0 0 0 0
+{"d_part":null,"e_part":null,"c":4} 1 1 1 0 0 0 0
+{"d_part":null,"e_part":null,"c":5} 1 1 1 0 0 0 0
PREHOOK: query: show partitions ice2
PREHOOK: type: SHOWPARTITIONS
PREHOOK: Input: default@ice2
diff --git a/iceberg/pom.xml b/iceberg/pom.xml
index e59b01379c08..3a4658b9d349 100644
--- a/iceberg/pom.xml
+++ b/iceberg/pom.xml
@@ -25,8 +25,8 @@
..
.
- 1.2.1
- 4.0.2
+ 1.3.0
+ 4.0.3
3.4.4
1.11.1
5.2.0
@@ -36,6 +36,7 @@
2.5.1
3.19.0
5.7.2
+ 2.9.2
false
@@ -208,6 +209,11 @@
mockito-inline
${iceberg.mockito-core.version}