From 5e9e0ad6494ccf06a4bb615c7d5efb804f54bda6 Mon Sep 17 00:00:00 2001 From: morningman Date: Fri, 22 Nov 2024 11:00:21 +0800 Subject: [PATCH] add LEGACY_HIVE_JSON_SERDE --- .../doris/datasource/hive/HiveMetaStoreClientHelper.java | 3 +++ .../org/apache/doris/datasource/hive/source/HiveScanNode.java | 3 ++- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreClientHelper.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreClientHelper.java index 97032467cec765..0f839d238b2b1e 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreClientHelper.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/HiveMetaStoreClientHelper.java @@ -94,6 +94,9 @@ public class HiveMetaStoreClientHelper { private static final Pattern digitPattern = Pattern.compile("(\\d+)"); + public static final String HIVE_JSON_SERDE = "org.apache.hive.hcatalog.data.JsonSerDe"; + public static final String LEGACY_HIVE_JSON_SERDE = "org.apache.hadoop.hive.serde2.JsonSerDe"; + public enum HiveFileFormat { TEXT_FILE(0, "text"), PARQUET(1, "parquet"), diff --git a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java index 5cb4624ee72add..3a2a4d3eb5c6ae 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/datasource/hive/source/HiveScanNode.java @@ -373,7 +373,8 @@ public TFileFormatType getFileFormatType() throws UserException { type = TFileFormatType.FORMAT_ORC; } else if (hiveFormat.equals(HiveMetaStoreClientHelper.HiveFileFormat.TEXT_FILE.getDesc())) { String serDeLib = table.getSd().getSerdeInfo().getSerializationLib(); - if (serDeLib.equals("org.apache.hive.hcatalog.data.JsonSerDe")) { + if (serDeLib.equals(HiveMetaStoreClientHelper.HIVE_JSON_SERDE) + || serDeLib.equals(HiveMetaStoreClientHelper.LEGACY_HIVE_JSON_SERDE)) { type = TFileFormatType.FORMAT_JSON; } else { type = TFileFormatType.FORMAT_CSV_PLAIN;