Skip to content

Commit

Permalink
HPCC-31615 Coverity scan for parquetembed.hpp
Browse files Browse the repository at this point in the history
  • Loading branch information
jackdelv committed Apr 23, 2024
1 parent c9d459a commit 0e52e6e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
4 changes: 2 additions & 2 deletions plugins/parquet/parquetembed.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -814,7 +814,7 @@ void ParquetWriter::beginSet(const char *fieldName)
}
arrow::ArrayBuilder *childBuilder;
arrow::FieldPath match = getNestedFieldBuilder(fieldName, childBuilder);
fieldBuilderStack.push_back(std::make_shared<ArrayBuilderTracker>(fieldName, childBuilder, CPNTSet, match));
fieldBuilderStack.push_back(std::make_shared<ArrayBuilderTracker>(fieldName, childBuilder, CPNTSet, std::move(match)));

arrow::ListBuilder *listBuilder = static_cast<arrow::ListBuilder *>(childBuilder);
reportIfFailure(listBuilder->Append());
Expand All @@ -833,7 +833,7 @@ void ParquetWriter::beginRow(const char *fieldName)
{
arrow::ArrayBuilder *childBuilder;
arrow::FieldPath match = getNestedFieldBuilder(fieldName, childBuilder);
fieldBuilderStack.push_back(std::make_shared<ArrayBuilderTracker>(fieldName, childBuilder, CPNTDataset, match));
fieldBuilderStack.push_back(std::make_shared<ArrayBuilderTracker>(fieldName, childBuilder, CPNTDataset, std::move(match)));

arrow::StructBuilder *structBuilder = static_cast<arrow::StructBuilder *>(childBuilder);
reportIfFailure(structBuilder->Append());
Expand Down
8 changes: 6 additions & 2 deletions plugins/parquet/parquetembed.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,12 @@ struct ArrayBuilderTracker
unsigned int childCount = 0;
unsigned int childrenProcessed = 0;

ArrayBuilderTracker(const char *_nodeName, arrow::ArrayBuilder *_struct, PathNodeType _nodeType, arrow::FieldPath _nodePath)
: nodeName(_nodeName), nodeType(_nodeType), structPtr(_struct), nodePath(_nodePath) { if (nodeType == CPNTDataset) childCount == structPtr->num_children(); }
ArrayBuilderTracker(const char *_nodeName, arrow::ArrayBuilder *_struct, PathNodeType _nodeType, arrow::FieldPath && _nodePath)
: nodeName(_nodeName), nodeType(_nodeType), structPtr(_struct), nodePath(std::move(_nodePath))
{
if (nodeType == CPNTDataset)
childCount = structPtr->num_children();
}

bool finishedChildren() { return childrenProcessed < childCount; }
};
Expand Down

0 comments on commit 0e52e6e

Please sign in to comment.