Skip to content

Commit

Permalink
xx
Browse files Browse the repository at this point in the history
  • Loading branch information
FANNG1 committed Mar 25, 2024
1 parent 2d7c2ca commit efebb64
Showing 1 changed file with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,8 @@
/** Transform hive catalog properties between Spark and Gravitino. */
public class HivePropertiesConverter implements PropertiesConverter {

// Transform Spark format to Gravitino format
static final Map<String, String> hiveTableFormatMap =
// Transform Spark hive file format to Gravitino hive file format
static final Map<String, String> fileFormatMap =
ImmutableMap.of(
"sequencefile", "SEQUENCEFILE",
"rcfile", "RCFILE",
Expand Down Expand Up @@ -49,15 +49,15 @@ public Map<String, String> toGravitinoTableProperties(Map<String, String> proper
PropertiesConverter.transformOptionProperties(properties);
String provider = gravitinoTableProperties.get(TableCatalog.PROP_PROVIDER);
String storeAs = gravitinoTableProperties.get(HivePropertyConstants.SPARK_HIVE_STORED_AS);
String sparkHiveTableFormat = Optional.ofNullable(storeAs).orElse(provider);
if (sparkHiveTableFormat != null) {
String fileFormat = Optional.ofNullable(storeAs).orElse(provider);
if (fileFormat != null) {
String gravitinoFormat =
hiveTableFormatMap.get(sparkHiveTableFormat.toLowerCase(Locale.ROOT));
fileFormatMap.get(fileFormat.toLowerCase(Locale.ROOT));
if (gravitinoFormat != null) {
gravitinoTableProperties.put(HivePropertyConstants.GRAVITINO_HIVE_FORMAT, gravitinoFormat);
} else {
throw new NotSupportedException(
"Doesn't support spark hive table format: " + sparkHiveTableFormat);
"Doesn't support hive file format: " + fileFormat);
}
}

Expand Down

0 comments on commit efebb64

Please sign in to comment.