use of io.trino.plugin.hive.HivePageSourceFactory in project trino by trinodb.
the class TestTimestampMicros method createPageSource.
private ConnectorPageSource createPageSource(ConnectorSession session, File parquetFile, String columnName, HiveType columnHiveType, Type columnType) {
// TODO after https://github.com/trinodb/trino/pull/5283, replace the method with
// return FileFormat.PRESTO_PARQUET.createFileFormatReader(session, HDFS_ENVIRONMENT, parquetFile, columnNames, columnTypes);
HivePageSourceFactory pageSourceFactory = StandardFileFormats.TRINO_PARQUET.getHivePageSourceFactory(HDFS_ENVIRONMENT).orElseThrow();
Properties schema = new Properties();
schema.setProperty(SERIALIZATION_LIB, HiveStorageFormat.PARQUET.getSerde());
ReaderPageSource pageSourceWithProjections = pageSourceFactory.createPageSource(new Configuration(false), session, new Path(parquetFile.toURI()), 0, parquetFile.length(), parquetFile.length(), schema, List.of(createBaseColumn(columnName, 0, columnHiveType, columnType, REGULAR, Optional.empty())), TupleDomain.all(), Optional.empty(), OptionalInt.empty(), false, AcidTransaction.NO_ACID_TRANSACTION).orElseThrow();
pageSourceWithProjections.getReaderColumns().ifPresent(projections -> {
throw new IllegalStateException("Unexpected projections: " + projections);
});
return pageSourceWithProjections.get();
}
Aggregations