diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-19 00:52:15 -0300 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2026-05-19 00:52:15 -0300 |
| commit | 85ed897de3676af866cc619dc700025820c02201 (patch) | |
| tree | c820e27cca41270c8503847978b537635db9820d /src | |
| parent | a1ad592d31a14c674b9e44ab5fe1fe1358d03707 (diff) | |
| download | RNT-85ed897de3676af866cc619dc700025820c02201.tar.gz RNT-85ed897de3676af866cc619dc700025820c02201.zip | |
VM: Projection instruction
Diffstat (limited to 'src')
| -rw-r--r-- | src/VM.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
@@ -1,4 +1,5 @@ #include "VM.h" +#include "Types.h" namespace nt { @@ -50,6 +51,22 @@ namespace nt case PlanNode::Op::SCAN: return cursors_.Next(node->scan_cursor); + case PlanNode::Op::PROJECT: + { + Tuple* next = Next(node->left); + if (next == nullptr) return nullptr; + + std::vector<Attribute> projected; + for (const auto& attr : next->attrs()) + { + if (node->project_attrs.find(attr.name) != node->project_attrs.end()) + projected.push_back(attr); + } + + node->project_buffer.emplace(std::move(projected)); + return &*node->project_buffer; + } + case PlanNode::Op::JOIN: { while (true) |
