Skip to content

Remove unused LogicalScanNodeTable's properties #5055

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ted-wq-x
Copy link
Contributor

@ted-wq-x ted-wq-x commented Mar 15, 2025

Description

  • Remove unused scanNodeTable properties,while a filter is pushed into scanNodeTable
  • Remove unnecessary projection upon scanNodeTable

Contributor agreement

@@ -20,6 +20,7 @@
#include "planner/operator/persistent/logical_insert.h"
#include "planner/operator/persistent/logical_merge.h"
#include "planner/operator/persistent/logical_set.h"
#include <planner/operator/scan/logical_scan_node_table.h>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

change <> to "" for consistency

std::make_shared<LogicalProjection>(std::move(expressions), op->getChild(childIdx));
auto child = op->getChild(childIdx);
// reset scan node table properties
if (child->getOperatorType() == LogicalOperatorType::SCAN_NODE_TABLE) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would add a new optimizer that remove any unnecessary projection instead of coupling the logic inside projection push down optimizer.

if (scanNodeTable.getProperties().empty()) {
return false;
}
bool hasPropertiesInUse = false;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

First I wanna understand on which query this optimization will take effect so that we can add test & benchmark.

Second, I think we can do better than clearProperty. Scan operator can scan a subset of its current properties.

@@ -36,8 +37,18 @@ void PrimaryKeyScanNodeTable::initLocalStateInternal(ResultSet* resultSet,
for (auto& pos : info.outVectorsPos) {
outVectors.push_back(resultSet->getValueVector(pos).get());
}
scanState = std::make_unique<NodeTableScanState>(
resultSet->getValueVector(info.nodeIDPos).get(), outVectors, outVectors[0]->state);
if (outVectors.empty()) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@ray6080 should review this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants