diff options
| author | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-10 22:59:48 -0300 |
|---|---|---|
| committer | Marcos Magueta <maguetamarcos@gmail.com> | 2026-05-10 22:59:48 -0300 |
| commit | 7d0fdcf2048bc736c82f84e92dcfc68b3d6ac45c (patch) | |
| tree | a88d6d7cd3886c24bc48a7c4710db1eeffdd0e9a /src/CursorManager.cpp | |
| parent | fcfbc5961017e3679c56d9d285a2a3d4d03f0f93 (diff) | |
| download | RNT-7d0fdcf2048bc736c82f84e92dcfc68b3d6ac45c.tar.gz RNT-7d0fdcf2048bc736c82f84e92dcfc68b3d6ac45c.zip | |
add nested loop join strategy to VM and tests
Diffstat (limited to 'src/CursorManager.cpp')
| -rw-r--r-- | src/CursorManager.cpp | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/CursorManager.cpp b/src/CursorManager.cpp index 6a44767..91a0183 100644 --- a/src/CursorManager.cpp +++ b/src/CursorManager.cpp @@ -1,4 +1,5 @@ #include "CursorManager.h" +#include "ObjectManager.h" #include "TupleCodec.h" namespace nt @@ -29,7 +30,20 @@ namespace nt { if (handle == nullptr || handle->object == nullptr) return nullptr; - if (handle->object->head->type->label != RELATION) + + const auto label = handle->object->head->type->label; + + if (label == EPHEMERAL_RELATION) + { + // Cursor is created exhausted — the JOIN operator writes args and + // resets the state before the first probe. + auto* c = new cursor(); + c->handle = handle; + c->exhausted = true; + return c; + } + + if (label != RELATION) return nullptr; auto* c = new cursor(); @@ -53,9 +67,21 @@ namespace nt if (c->exhausted) return nullptr; + if (c->handle->object->head->type->label == EPHEMERAL_RELATION) + { + auto* etype = static_cast<ObjectManager::ephemeral_object_type*>( + c->handle->object->head->type.get()); + c->page = etype->generator(c->args, c->fetch_offset, PAGE_SIZE); + c->page_position = 0; + c->fetch_offset += c->page.size(); + if (c->page.size() < PAGE_SIZE) + c->exhausted = true; + if (c->page.empty()) return nullptr; + return &c->page[c->page_position++]; + } + LoadPage(c, c->handle->object->head->path); if (c->page.empty()) return nullptr; - return &c->page[c->page_position++]; } |
