Skip to content

Commit

Permalink
Avoid crashes in rowGroupUncompressedSize
Browse files Browse the repository at this point in the history
  • Loading branch information
jaystarshot committed Apr 25, 2024
1 parent 7f5eed8 commit 1b66b82
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion velox/dwio/parquet/reader/ParquetReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,7 +455,7 @@ std::unique_ptr<ParquetTypeWithId> ReaderBase::getParquetColumnInfo(
std::move(children),
curSchemaIdx,
maxSchemaElementIdx,
columnIdx++,
columnIdx - 1, // was already incremented for leafTypePtr
std::move(name),
std::nullopt,
std::nullopt,
Expand Down Expand Up @@ -658,6 +658,9 @@ int64_t ReaderBase::rowGroupUncompressedSize(
int32_t rowGroupIndex,
const dwio::common::TypeWithId& type) const {
if (type.column() != ParquetTypeWithId::kNonLeaf) {
VELOX_CHECK_LT(rowGroupIndex, fileMetaData_->row_groups.size());
VELOX_CHECK_LT(
type.column(), fileMetaData_->row_groups[rowGroupIndex].columns.size());
return fileMetaData_->row_groups[rowGroupIndex]
.columns[type.column()]
.meta_data.total_uncompressed_size;
Expand Down

0 comments on commit 1b66b82

Please sign in to comment.