Skip to content

Commit

Permalink
Use enumProperty helper in HiveSessionProperties
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Sep 23, 2019
1 parent d7f717f commit 9b3c162
Showing 1 changed file with 9 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import static io.prestosql.spi.StandardErrorCode.INVALID_SESSION_PROPERTY;
import static io.prestosql.spi.session.PropertyMetadata.booleanProperty;
import static io.prestosql.spi.session.PropertyMetadata.dataSizeProperty;
import static io.prestosql.spi.session.PropertyMetadata.enumProperty;
import static io.prestosql.spi.session.PropertyMetadata.integerProperty;
import static io.prestosql.spi.session.PropertyMetadata.stringProperty;
import static io.prestosql.spi.type.DoubleType.DOUBLE;
Expand Down Expand Up @@ -190,10 +191,11 @@ public HiveSessionProperties(
return doubleValue;
},
value -> value),
stringProperty(
enumProperty(
ORC_OPTIMIZED_WRITER_VALIDATE_MODE,
"Experimental: ORC: Level of detail in ORC validation",
hiveConfig.getOrcWriterValidationMode().toString(),
OrcWriteValidationMode.class,
hiveConfig.getOrcWriterValidationMode(),
false),
dataSizeProperty(
ORC_OPTIMIZED_WRITER_MIN_STRIPE_SIZE,
Expand All @@ -215,10 +217,11 @@ public HiveSessionProperties(
"Experimental: ORC: Max dictionary memory",
orcFileWriterConfig.getDictionaryMaxMemory(),
false),
stringProperty(
enumProperty(
HIVE_STORAGE_FORMAT,
"Default storage format for new tables or partitions",
hiveConfig.getHiveStorageFormat().toString(),
HiveStorageFormat.class,
hiveConfig.getHiveStorageFormat(),
false),
booleanProperty(
RESPECT_TABLE_FORMAT,
Expand Down Expand Up @@ -396,7 +399,7 @@ public static boolean isOrcOptimizedWriterValidate(ConnectorSession session)

public static OrcWriteValidationMode getOrcOptimizedWriterValidateMode(ConnectorSession session)
{
return OrcWriteValidationMode.valueOf(session.getProperty(ORC_OPTIMIZED_WRITER_VALIDATE_MODE, String.class).toUpperCase(ENGLISH));
return session.getProperty(ORC_OPTIMIZED_WRITER_VALIDATE_MODE, OrcWriteValidationMode.class);
}

public static DataSize getOrcOptimizedWriterMinStripeSize(ConnectorSession session)
Expand All @@ -421,7 +424,7 @@ public static DataSize getOrcOptimizedWriterMaxDictionaryMemory(ConnectorSession

public static HiveStorageFormat getHiveStorageFormat(ConnectorSession session)
{
return HiveStorageFormat.valueOf(session.getProperty(HIVE_STORAGE_FORMAT, String.class).toUpperCase(ENGLISH));
return session.getProperty(HIVE_STORAGE_FORMAT, HiveStorageFormat.class);
}

public static boolean isRespectTableFormat(ConnectorSession session)
Expand Down

0 comments on commit 9b3c162

Please sign in to comment.