use of io.trino.orc.FileOrcDataSource in project trino by trinodb.
the class RaptorStorageManager method computeShardStats.
private List<ColumnStats> computeShardStats(File file) {
try (OrcDataSource dataSource = fileOrcDataSource(orcReaderOptions, file)) {
OrcReader reader = OrcReader.createOrcReader(dataSource, orcReaderOptions).orElseThrow(() -> new TrinoException(RAPTOR_ERROR, "Data file is empty: " + file));
ImmutableList.Builder<ColumnStats> list = ImmutableList.builder();
for (ColumnInfo info : getColumnInfo(reader)) {
computeColumnStats(reader, info.getColumnId(), info.getType(), typeManager).ifPresent(list::add);
}
return list.build();
} catch (IOException e) {
throw new TrinoException(RAPTOR_ERROR, "Failed to read file: " + file, e);
}
}
Aggregations