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 /include | |
| parent | a1ad592d31a14c674b9e44ab5fe1fe1358d03707 (diff) | |
| download | RNT-85ed897de3676af866cc619dc700025820c02201.tar.gz RNT-85ed897de3676af866cc619dc700025820c02201.zip | |
VM: Projection instruction
Diffstat (limited to 'include')
| -rw-r--r-- | include/VM.h | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/include/VM.h b/include/VM.h index 96cf493..3bfe521 100644 --- a/include/VM.h +++ b/include/VM.h @@ -6,6 +6,7 @@ #include <optional> #include <string> +#include <unordered_set> #include <vector> /** @@ -88,12 +89,11 @@ namespace nt * (O(1) membership probe when all args are bound). * - TAKE : passes at most take_limit tuples through, then returns nullptr. Use * this to bound scans over AlephZero ephemeral relations. - * - * TODO: Add PROJECT operator as the query layer grows. + * - PROJECT: filters each input tuple to the named attributes in project_attrs. */ struct PlanNode { - enum class Op { SCAN, JOIN, TAKE }; + enum class Op { SCAN, JOIN, TAKE, PROJECT }; Op op; PlanNode* left = nullptr; @@ -118,6 +118,10 @@ namespace nt std::size_t take_limit = 0; std::size_t take_count = 0; /**< Runtime counter; mutable during execution. */ + /** PROJECT: unordered set of attribute names to keep. */ + std::unordered_set<std::string> project_attrs; + std::optional<Tuple> project_buffer; + /** * JOIN runtime state. * @@ -156,6 +160,7 @@ namespace nt * probes until a match is found or the inner is exhausted. * - TAKE counts emitted tuples and returns nullptr once the limit * is reached. + * - PROJECT filters an input tuple to the requested attribute names. * * @param node Root of the plan subtree to evaluate. * @return Next matching tuple, or nullptr when the plan is exhausted. |
