Skip to content

Commit

Permalink
fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
ray6080 committed Jul 31, 2023
1 parent b7691b2 commit df1bb2c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
6 changes: 4 additions & 2 deletions src/include/processor/operator/copy/copy_node.h
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,8 @@ class CopyNode : public Sink {
children[0]->clone(), id, paramsString);
}

static void writeAndResetNodeGroup(common::node_group_idx_t nodeGroupIdx, storage::PrimaryKeyIndexBuilder* pkIndex, common::column_id_t pkColumnID,
static void writeAndResetNodeGroup(common::node_group_idx_t nodeGroupIdx,
storage::PrimaryKeyIndexBuilder* pkIndex, common::column_id_t pkColumnID,
storage::NodeTable* table, storage::NodeGroup* nodeGroup);

private:
Expand All @@ -93,7 +94,8 @@ class CopyNode : public Sink {

static void populatePKIndex(storage::PrimaryKeyIndexBuilder* pkIndex,
storage::ColumnChunk* chunk, common::offset_t startNodeOffset, common::offset_t numNodes);
static void checkNonNullConstraint(storage::NullColumnChunk* nullChunk, common::offset_t numNodes);
static void checkNonNullConstraint(
storage::NullColumnChunk* nullChunk, common::offset_t numNodes);
static void appendToPKIndex(storage::PrimaryKeyIndexBuilder* pkIndex,
storage::ColumnChunk* chunk, common::offset_t startOffset, common::offset_t numNodes);

Expand Down
19 changes: 10 additions & 9 deletions src/processor/operator/copy/copy_node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ void CopyNodeSharedState::appendLocalNodeGroup(std::unique_ptr<NodeGroup> localN
sharedNodeGroup->append(localNodeGroup.get(), 0 /* offsetInNodeGroup */);
if (sharedNodeGroup->isFull()) {
auto nodeGroupIdx = getNextNodeGroupIdxWithoutLock();
CopyNode::writeAndResetNodeGroup(nodeGroupIdx, pkIndex.get(), pkColumnID, table, sharedNodeGroup.get());
CopyNode::writeAndResetNodeGroup(
nodeGroupIdx, pkIndex.get(), pkColumnID, table, sharedNodeGroup.get());
}
if (numNodesAppended < localNodeGroup->getNumNodes()) {
sharedNodeGroup->append(localNodeGroup.get(), numNodesAppended);
Expand Down Expand Up @@ -91,8 +92,8 @@ void CopyNode::executeInternal(ExecutionContext* context) {
numAppendedTuples += numAppendedTuplesInNodeGroup;
if (localNodeGroup->isFull()) {
auto nodeGroupIdx = sharedState->getNextNodeGroupIdx();
writeAndResetNodeGroup(nodeGroupIdx, sharedState->pkIndex.get(), sharedState->pkColumnID,
sharedState->table, localNodeGroup.get());
writeAndResetNodeGroup(nodeGroupIdx, sharedState->pkIndex.get(),
sharedState->pkColumnID, sharedState->table, localNodeGroup.get());
}
if (numAppendedTuples < numTuplesToAppend) {
sliceDataChunk(*resultSet->getDataChunk(0), copyNodeInfo.dataColumnPoses,
Expand All @@ -114,14 +115,14 @@ void CopyNode::sliceDataChunk(
}
}

void CopyNode::writeAndResetNodeGroup(node_group_idx_t nodeGroupIdx, PrimaryKeyIndexBuilder* pkIndex, column_id_t pkColumnID,
NodeTable* table, NodeGroup* nodeGroup) {
void CopyNode::writeAndResetNodeGroup(node_group_idx_t nodeGroupIdx,
PrimaryKeyIndexBuilder* pkIndex, column_id_t pkColumnID, NodeTable* table,
NodeGroup* nodeGroup) {
nodeGroup->setNodeGroupIdx(nodeGroupIdx);
auto startOffset = StorageUtils::getStartOffsetForNodeGroup(nodeGroupIdx);
auto numNodes = nodeGroup->getNumNodes();
if (pkIndex) {
populatePKIndex(pkIndex,
nodeGroup->getColumnChunk(pkColumnID), startOffset, numNodes);
populatePKIndex(pkIndex, nodeGroup->getColumnChunk(pkColumnID), startOffset, numNodes);
}
table->append(nodeGroup);
nodeGroup->resetToEmpty();
Expand Down Expand Up @@ -151,8 +152,8 @@ void CopyNode::checkNonNullConstraint(NullColumnChunk* nullChunk, offset_t numNo
void CopyNode::finalize(ExecutionContext* context) {
if (sharedState->sharedNodeGroup) {
auto nodeGroupIdx = sharedState->getNextNodeGroupIdx();
writeAndResetNodeGroup(nodeGroupIdx, sharedState->pkIndex.get(), sharedState->pkColumnID, sharedState->table,
sharedState->sharedNodeGroup.get());
writeAndResetNodeGroup(nodeGroupIdx, sharedState->pkIndex.get(), sharedState->pkColumnID,
sharedState->table, sharedState->sharedNodeGroup.get());
}
if (sharedState->pkIndex) {
sharedState->pkIndex->flush();
Expand Down

0 comments on commit df1bb2c

Please sign in to comment.