Skip to content

Commit

Permalink
add LEGACY_HIVE_JSON_SERDE
Browse files Browse the repository at this point in the history
  • Loading branch information
morningman authored and hubgeter committed Nov 26, 2024
1 parent 72b173b commit 5e9e0ad
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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"),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5e9e0ad

Please sign in to comment.