Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip first pass read of parquet data #1480

Merged
merged 1 commit into from
Apr 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions src/storage/copier/node_copier.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -215,8 +215,6 @@ void ParquetNodeCopier<T>::executeInternal(std::unique_ptr<NodeCopyMorsel> morse
TableCopyExecutor::throwCopyExceptionIfNotOK(
reader->RowGroup(morsel->blockIdx)->ReadTable(&table));
arrow::TableBatchReader batchReader(*table);
// TODO(GUODONG): We assume here each time the table only contains one record batch. Needs to
// verify if this always holds true.
std::shared_ptr<arrow::RecordBatch> recordBatch;
TableCopyExecutor::throwCopyExceptionIfNotOK(batchReader.ReadNext(&recordBatch));
std::vector<std::unique_ptr<InMemColumnChunk>> columnChunks(this->columns.size());
Expand Down
11 changes: 5 additions & 6 deletions src/storage/copier/table_copy_executor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,17 +82,16 @@ void TableCopyExecutor::countNumLinesParquet(const std::vector<std::string>& fil
numRows = 0;
for (auto& filePath : filePaths) {
std::unique_ptr<parquet::arrow::FileReader> reader = createParquetReader(filePath);
uint64_t numBlocks = reader->num_row_groups();
std::vector<uint64_t> numLinesPerBlock;
std::shared_ptr<arrow::Table> table;
auto metadata = reader->parquet_reader()->metadata();
uint64_t numBlocks = metadata->num_row_groups();
std::vector<uint64_t> numLinesPerBlock(numBlocks);
auto startNodeOffset = numRows;
for (auto blockIdx = 0; blockIdx < numBlocks; ++blockIdx) {
throwCopyExceptionIfNotOK(reader->RowGroup(blockIdx)->ReadTable(&table));
numLinesPerBlock.push_back(table->num_rows());
numRows += table->num_rows();
numLinesPerBlock[blockIdx] = metadata->RowGroup(blockIdx)->num_rows();
}
fileBlockInfos.emplace(
filePath, FileBlockInfo{startNodeOffset, numBlocks, numLinesPerBlock});
numRows += metadata->num_rows();
}
}

Expand Down