You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by lz...@apache.org on 2025/10/11 07:42:12 UTC

(paimon) branch master updated: [hive] Hive metastore support create table with blob (#6383)

This is an automated email from the ASF dual-hosted git repository.

lzljs3620320 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 04c7b1e4d9 [hive] Hive metastore support create table with blob (#6383)
04c7b1e4d9 is described below

commit 04c7b1e4d9a692abd9cdc1589acbb4166b485dbf
Author: YeJunHao <41...@users.noreply.github.com>
AuthorDate: Sat Oct 11 15:42:07 2025 +0800

    [hive] Hive metastore support create table with blob (#6383)
---
 .../org/apache/paimon/hive/HiveCatalogTest.java     | 21 +++++++++++++++++++++
 .../java/org/apache/paimon/hive/HiveTypeUtils.java  |  6 ++++++
 2 files changed, 27 insertions(+)

diff --git a/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/hive/HiveCatalogTest.java b/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/hive/HiveCatalogTest.java
index 3043a57464..5e19606716 100644
--- a/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/hive/HiveCatalogTest.java
+++ b/paimon-hive/paimon-hive-catalog/src/test/java/org/apache/paimon/hive/HiveCatalogTest.java
@@ -482,6 +482,27 @@ public class HiveCatalogTest extends CatalogTestBase {
                         Collections.singletonMap("dt", "20250101"));
     }
 
+    @Test
+    public void testCreateTableWithBlob() throws Exception {
+        String databaseName = "testCreateTableWithBlob";
+        catalog.dropDatabase(databaseName, true, true);
+        catalog.createDatabase(databaseName, true);
+        Identifier identifier = Identifier.create(databaseName, "table");
+        catalog.createTable(
+                identifier,
+                Schema.newBuilder()
+                        .option(METASTORE_TAG_TO_PARTITION.key(), "dt")
+                        .column("col", DataTypes.INT())
+                        .column("dt", DataTypes.STRING())
+                        .column("picture", DataTypes.BLOB())
+                        .option(CoreOptions.ROW_TRACKING_ENABLED.key(), "true")
+                        .option(CoreOptions.DATA_EVOLUTION_ENABLED.key(), "true")
+                        .build(),
+                true);
+
+        assertThat(catalog.listTables(databaseName)).contains("table");
+    }
+
     @Test
     public void testAlterPartitions() throws Exception {
         if (!supportPartitions()) {
diff --git a/paimon-hive/paimon-hive-common/src/main/java/org/apache/paimon/hive/HiveTypeUtils.java b/paimon-hive/paimon-hive-common/src/main/java/org/apache/paimon/hive/HiveTypeUtils.java
index 844128539d..e4799341d1 100644
--- a/paimon-hive/paimon-hive-common/src/main/java/org/apache/paimon/hive/HiveTypeUtils.java
+++ b/paimon-hive/paimon-hive-common/src/main/java/org/apache/paimon/hive/HiveTypeUtils.java
@@ -22,6 +22,7 @@ import org.apache.paimon.data.variant.Variant;
 import org.apache.paimon.types.ArrayType;
 import org.apache.paimon.types.BigIntType;
 import org.apache.paimon.types.BinaryType;
+import org.apache.paimon.types.BlobType;
 import org.apache.paimon.types.BooleanType;
 import org.apache.paimon.types.CharType;
 import org.apache.paimon.types.DataField;
@@ -229,6 +230,11 @@ public class HiveTypeUtils {
             return TypeInfoFactory.getStructTypeInfo(fieldNames, typeInfos);
         }
 
+        @Override
+        public TypeInfo visit(BlobType blobType) {
+            return TypeInfoFactory.binaryTypeInfo;
+        }
+
         @Override
         protected TypeInfo defaultMethod(org.apache.paimon.types.DataType dataType) {
             throw new UnsupportedOperationException("Unsupported type: " + dataType);