Skip to content

Commit

Permalink
Rename ParquetFileWriterConfig to ParquetWriterConfig
Browse files Browse the repository at this point in the history
  • Loading branch information
electrum committed Sep 23, 2019
1 parent 1239544 commit d7a0a90
Show file tree
Hide file tree
Showing 16 changed files with 56 additions and 48 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.prestosql.plugin.hive.metastore.SemiTransactionalHiveMetastore;
import io.prestosql.plugin.hive.orc.OrcPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.rcfile.RcFilePageSourceFactory;
import io.prestosql.plugin.hive.s3.PrestoS3ClientFactory;
import io.prestosql.spi.connector.ConnectorNodePartitioningProvider;
Expand Down Expand Up @@ -107,7 +108,7 @@ public void configure(Binder binder)
fileWriterFactoryBinder.addBinding().to(OrcFileWriterFactory.class).in(Scopes.SINGLETON);
fileWriterFactoryBinder.addBinding().to(RcFileFileWriterFactory.class).in(Scopes.SINGLETON);

configBinder(binder).bindConfig(ParquetFileWriterConfig.class);
configBinder(binder).bindConfig(ParquetWriterConfig.class);
}

@ForHive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
import com.google.common.collect.ImmutableList;
import io.airlift.units.DataSize;
import io.prestosql.orc.OrcWriteValidation.OrcWriteValidationMode;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.spi.PrestoException;
import io.prestosql.spi.connector.ConnectorSession;
import io.prestosql.spi.session.PropertyMetadata;
Expand Down Expand Up @@ -100,7 +101,7 @@ public static InsertExistingPartitionsBehavior valueOf(String value, boolean imm
}

@Inject
public HiveSessionProperties(HiveConfig hiveConfig, OrcFileWriterConfig orcFileWriterConfig, ParquetFileWriterConfig parquetFileWriterConfig)
public HiveSessionProperties(HiveConfig hiveConfig, OrcFileWriterConfig orcFileWriterConfig, ParquetWriterConfig parquetWriterConfig)
{
sessionProperties = ImmutableList.of(
booleanProperty(
Expand Down Expand Up @@ -242,12 +243,12 @@ public HiveSessionProperties(HiveConfig hiveConfig, OrcFileWriterConfig orcFileW
dataSizeProperty(
PARQUET_WRITER_BLOCK_SIZE,
"Parquet: Writer block size",
parquetFileWriterConfig.getBlockSize(),
parquetWriterConfig.getBlockSize(),
false),
dataSizeProperty(
PARQUET_WRITER_PAGE_SIZE,
"Parquet: Writer page size",
parquetFileWriterConfig.getPageSize(),
parquetWriterConfig.getPageSize(),
false),
dataSizeProperty(
MAX_SPLIT_SIZE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,15 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.prestosql.plugin.hive;
package io.prestosql.plugin.hive.parquet;

import io.airlift.configuration.Config;
import io.airlift.units.DataSize;
import org.apache.parquet.hadoop.ParquetWriter;

import static io.airlift.units.DataSize.Unit.BYTE;

public class ParquetFileWriterConfig
public class ParquetWriterConfig
{
private DataSize blockSize = new DataSize(ParquetWriter.DEFAULT_BLOCK_SIZE, BYTE);
private DataSize pageSize = new DataSize(ParquetWriter.DEFAULT_PAGE_SIZE, BYTE);
Expand All @@ -30,7 +30,7 @@ public DataSize getBlockSize()
}

@Config("hive.parquet.writer.block-size")
public ParquetFileWriterConfig setBlockSize(DataSize blockSize)
public ParquetWriterConfig setBlockSize(DataSize blockSize)
{
this.blockSize = blockSize;
return this;
Expand All @@ -42,7 +42,7 @@ public DataSize getPageSize()
}

@Config("hive.parquet.writer.page-size")
public ParquetFileWriterConfig setPageSize(DataSize pageSize)
public ParquetWriterConfig setPageSize(DataSize pageSize)
{
this.pageSize = pageSize;
return this;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import io.prestosql.plugin.hive.metastore.thrift.ThriftHiveMetastoreConfig;
import io.prestosql.plugin.hive.orc.OrcPageSource;
import io.prestosql.plugin.hive.parquet.ParquetPageSource;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.rcfile.RcFilePageSource;
import io.prestosql.plugin.hive.security.SqlStandardAccessControlMetadata;
import io.prestosql.spi.Page;
Expand Down Expand Up @@ -768,7 +769,7 @@ protected final void setup(String databaseName, HiveConfig hiveConfig, HiveMetas
partitionUpdateCodec,
new TestingNodeManager("fake-environment"),
new HiveEventClient(),
new HiveSessionProperties(hiveConfig, new OrcFileWriterConfig(), new ParquetFileWriterConfig()),
new HiveSessionProperties(hiveConfig, new OrcFileWriterConfig(), new ParquetWriterConfig()),
new HiveWriterStats(),
getDefaultOrcFileWriterFactory(hiveConfig));
pageSourceProvider = new HivePageSourceProvider(hiveConfig, hdfsEnvironment, getDefaultHiveRecordCursorProvider(hiveConfig), getDefaultHiveDataStreamFactories(hiveConfig), TYPE_MANAGER);
Expand All @@ -791,7 +792,7 @@ protected ConnectorSession newSession()

protected ConnectorSession newSession(Map<String, Object> propertyValues)
{
HiveSessionProperties properties = new HiveSessionProperties(getHiveConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig());
HiveSessionProperties properties = new HiveSessionProperties(getHiveConfig(), new OrcFileWriterConfig(), new ParquetWriterConfig());
return new TestingConnectorSession(properties.getSessionProperties(), propertyValues);
}

Expand Down Expand Up @@ -2903,7 +2904,7 @@ private ConnectorSession sampleSize(int sampleSize)
{
HiveSessionProperties properties = new HiveSessionProperties(
getHiveConfig().setPartitionStatisticsSampleSize(sampleSize),
new OrcFileWriterConfig(), new ParquetFileWriterConfig());
new OrcFileWriterConfig(), new ParquetWriterConfig());
return new TestingConnectorSession(properties.getSessionProperties());
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
import io.prestosql.plugin.hive.metastore.thrift.TestingMetastoreLocator;
import io.prestosql.plugin.hive.metastore.thrift.ThriftHiveMetastore;
import io.prestosql.plugin.hive.metastore.thrift.ThriftHiveMetastoreConfig;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.security.SqlStandardAccessControlMetadata;
import io.prestosql.spi.connector.ColumnHandle;
import io.prestosql.spi.connector.ColumnMetadata;
Expand Down Expand Up @@ -213,15 +214,15 @@ protected void setup(String host, int port, String databaseName, Function<HiveCo
partitionUpdateCodec,
new TestingNodeManager("fake-environment"),
new HiveEventClient(),
new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()),
new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetWriterConfig()),
new HiveWriterStats(),
getDefaultOrcFileWriterFactory(config));
pageSourceProvider = new HivePageSourceProvider(config, hdfsEnvironment, getDefaultHiveRecordCursorProvider(config), getDefaultHiveDataStreamFactories(config), TYPE_MANAGER);
}

protected ConnectorSession newSession()
{
return new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
return new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());
}

protected Transaction newTransaction()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.prestosql.plugin.hive.gcs.HiveGcsConfig;
import io.prestosql.plugin.hive.orc.OrcPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.rcfile.RcFilePageSourceFactory;
import io.prestosql.plugin.hive.s3.HiveS3Config;
import io.prestosql.plugin.hive.s3.PrestoS3ConfigurationInitializer;
Expand Down Expand Up @@ -58,7 +59,7 @@ public final class HiveTestUtils
private HiveTestUtils() {}

public static final ConnectorSession SESSION = new TestingConnectorSession(
new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

private static final Metadata METADATA = createTestMetadataManager();
public static final TypeManager TYPE_MANAGER = new InternalTypeManager(METADATA);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import io.prestosql.plugin.hive.metastore.Column;
import io.prestosql.plugin.hive.metastore.StorageFormat;
import io.prestosql.plugin.hive.metastore.Table;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.util.HiveBucketing.HiveBucketFilter;
import io.prestosql.spi.connector.ConnectorSession;
import io.prestosql.spi.connector.SchemaTableName;
Expand Down Expand Up @@ -314,7 +315,7 @@ private static BackgroundHiveSplitLoader backgroundHiveSplitLoader(
ImmutableMap.of()));

ConnectorSession connectorSession = new TestingConnectorSession(
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

return new BackgroundHiveSplitLoader(
table,
Expand All @@ -339,7 +340,7 @@ private static BackgroundHiveSplitLoader backgroundHiveSplitLoader(List<LocatedF
ImmutableMap.of()));

ConnectorSession connectorSession = new TestingConnectorSession(
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

return new BackgroundHiveSplitLoader(
SIMPLE_TABLE,
Expand All @@ -358,7 +359,7 @@ private static BackgroundHiveSplitLoader backgroundHiveSplitLoader(List<LocatedF
private static BackgroundHiveSplitLoader backgroundHiveSplitLoaderOfflinePartitions()
{
ConnectorSession connectorSession = new TestingConnectorSession(
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
new HiveSessionProperties(new HiveConfig().setMaxSplitSize(new DataSize(1.0, GIGABYTE)), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

return new BackgroundHiveSplitLoader(
SIMPLE_TABLE,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
import io.prestosql.orc.OrcWriterOptions;
import io.prestosql.plugin.hive.orc.OrcPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.plugin.hive.rcfile.RcFilePageSourceFactory;
import io.prestosql.spi.PrestoException;
import io.prestosql.spi.connector.ConnectorPageSource;
Expand Down Expand Up @@ -88,8 +89,8 @@ public class TestHiveFileFormats
extends AbstractTestHiveFileFormats
{
private static final FileFormatDataSourceStats STATS = new FileFormatDataSourceStats();
private static TestingConnectorSession parquetPageSourceSession = new TestingConnectorSession(new HiveSessionProperties(createParquetHiveConfig(false), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
private static TestingConnectorSession parquetPageSourceSessionUseName = new TestingConnectorSession(new HiveSessionProperties(createParquetHiveConfig(true), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
private static TestingConnectorSession parquetPageSourceSession = new TestingConnectorSession(new HiveSessionProperties(createParquetHiveConfig(false), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());
private static TestingConnectorSession parquetPageSourceSessionUseName = new TestingConnectorSession(new HiveSessionProperties(createParquetHiveConfig(true), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

private static final DateTimeZone HIVE_STORAGE_TIME_ZONE = DateTimeZone.forID("America/Bahia_Banderas");

Expand Down Expand Up @@ -309,7 +310,7 @@ public void testOrcOptimizedWriter(int rowCount)
new HiveConfig()
.setOrcWriterValidationPercentage(100.0),
new OrcFileWriterConfig(),
new ParquetFileWriterConfig()).getSessionProperties());
new ParquetWriterConfig()).getSessionProperties());

// A Presto page can not contain a map with null keys, so a page based writer can not write null keys
List<TestColumn> testColumns = TEST_COLUMNS.stream()
Expand All @@ -329,7 +330,7 @@ public void testOrcOptimizedWriter(int rowCount)
public void testOrcUseColumnNames(int rowCount)
throws Exception
{
TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

assertThatFileFormat(ORC)
.withWriteColumns(TEST_COLUMNS)
Expand All @@ -343,7 +344,7 @@ public void testOrcUseColumnNames(int rowCount)
public void testOrcUseColumnNameLowerCaseConversion(int rowCount)
throws Exception
{
TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
TestingConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(new HiveConfig(), new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());

List<TestColumn> testColumnsUpperCase = TEST_COLUMNS.stream()
.map(testColumn -> new TestColumn(testColumn.getName().toUpperCase(Locale.ENGLISH), testColumn.getObjectInspector(), testColumn.getWriteValue(), testColumn.getExpectedValue(), testColumn.isPartitionKey()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
import io.prestosql.plugin.hive.authentication.HiveIdentity;
import io.prestosql.plugin.hive.metastore.HiveMetastore;
import io.prestosql.plugin.hive.metastore.HivePageSinkMetadata;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.spi.Page;
import io.prestosql.spi.PageBuilder;
import io.prestosql.spi.block.BlockBuilder;
Expand Down Expand Up @@ -270,15 +271,15 @@ private static ConnectorPageSink createPageSink(HiveTransactionHandle transactio
partitionUpdateCodec,
new TestingNodeManager("fake-environment"),
new HiveEventClient(),
new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()),
new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetWriterConfig()),
stats,
getDefaultOrcFileWriterFactory(config));
return provider.createPageSink(transaction, getSession(config), handle);
}

private static TestingConnectorSession getSession(HiveConfig config)
{
return new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
return new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());
}

private static List<HiveColumnHandle> getColumnHandles()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
import io.prestosql.operator.project.CursorProcessor;
import io.prestosql.operator.project.PageProcessor;
import io.prestosql.plugin.hive.orc.OrcPageSourceFactory;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.spi.Page;
import io.prestosql.spi.block.Block;
import io.prestosql.spi.classloader.ThreadContextClassLoader;
Expand Down Expand Up @@ -253,7 +254,7 @@ public void testMaxReadBytes(int rowCount)
int maxReadBytes = 1_000;
HiveConfig config = new HiveConfig();
config.setOrcMaxReadBlockSize(new DataSize(maxReadBytes, BYTE));
ConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetFileWriterConfig()).getSessionProperties());
ConnectorSession session = new TestingConnectorSession(new HiveSessionProperties(config, new OrcFileWriterConfig(), new ParquetWriterConfig()).getSessionProperties());
FileFormatDataSourceStats stats = new FileFormatDataSourceStats();

// Build a table where every row gets larger, so we can test that the "batchSize" reduces
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
import io.prestosql.plugin.hive.HiveConfig;
import io.prestosql.plugin.hive.HiveSessionProperties;
import io.prestosql.plugin.hive.OrcFileWriterConfig;
import io.prestosql.plugin.hive.ParquetFileWriterConfig;
import io.prestosql.plugin.hive.parquet.ParquetWriterConfig;
import io.prestosql.spi.Page;
import io.prestosql.spi.PageBuilder;
import io.prestosql.spi.block.BlockBuilder;
Expand Down Expand Up @@ -95,7 +95,7 @@ public class BenchmarkHiveFileFormat

private static final HiveConfig CONFIG = new HiveConfig();

private static final ConnectorSession SESSION = new TestingConnectorSession(new HiveSessionProperties(CONFIG, new OrcFileWriterConfig(), new ParquetFileWriterConfig())
private static final ConnectorSession SESSION = new TestingConnectorSession(new HiveSessionProperties(CONFIG, new OrcFileWriterConfig(), new ParquetWriterConfig())
.getSessionProperties());

private static final HdfsEnvironment HDFS_ENVIRONMENT = createTestHdfsEnvironment(CONFIG);
Expand Down
Loading

0 comments on commit d7a0a90

Please sign in to comment.