diff options
| author | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-03 15:19:20 -0400 |
|---|---|---|
| committer | Douglas Rumbaugh <dbr4@psu.edu> | 2023-07-03 15:19:20 -0400 |
| commit | f39e512ae3848abd1d3c68349c1a8fbe97be91b5 (patch) | |
| tree | aa95fdf6e496556ef7490909de1191a3f81a5584 /include | |
| parent | 8ecf203a77a897b25af084ceefd82023bfcc1c35 (diff) | |
| download | dynamic-extension-f39e512ae3848abd1d3c68349c1a8fbe97be91b5.tar.gz | |
Fixed query errors
Diffstat (limited to 'include')
| -rw-r--r-- | include/framework/DynamicExtension.h | 2 | ||||
| -rw-r--r-- | include/shard/PGM.h | 22 |
2 files changed, 16 insertions, 8 deletions
diff --git a/include/framework/DynamicExtension.h b/include/framework/DynamicExtension.h index 544cd8f..242db8e 100644 --- a/include/framework/DynamicExtension.h +++ b/include/framework/DynamicExtension.h @@ -130,7 +130,7 @@ public: // Execute the query for each shard for (size_t i=0; i<shards.size(); i++) { auto shard_results = Q::query(shards[i].second, states[i], parms); - query_results[i] = filter_deletes(shard_results, shards[i].first, buffer); + query_results[i+1] = filter_deletes(shard_results, shards[i].first, buffer); } // Merge the results together diff --git a/include/shard/PGM.h b/include/shard/PGM.h index 1622d7e..f3f5106 100644 --- a/include/shard/PGM.h +++ b/include/shard/PGM.h @@ -226,7 +226,6 @@ public: return m_pgm.size_in_bytes(); } -private: size_t get_lower_bound(const K& key) const { auto bound = m_pgm.search(key); size_t idx = bound.lo; @@ -257,9 +256,14 @@ private: } + if (m_data[idx].rec.key > key && idx > 0 && m_data[idx-1].rec.key <= key) { + return idx-1; + } + return (m_data[idx].rec.key >= key) ? idx : m_reccnt; } +private: Wrapped<R>* m_data; size_t m_reccnt; size_t m_tombstone_cnt; @@ -307,10 +311,16 @@ public: } auto ptr = ts->get_record_at(s->start_idx); - size_t i = 0; - while (ptr[i].rec.key <= p->upper_bound && i < s->stop_idx - s->start_idx) { - records.emplace_back(ptr[i]); - i++; + + // roll the pointer forward to the first record that is + // greater than or equal to the lower bound. + while(ptr->rec.key < p->lower_bound) { + ptr++; + } + + while (ptr->rec.key <= p->upper_bound && ptr < ptr + s->stop_idx) { + records.emplace_back(*ptr); + ptr++; } return records; @@ -326,10 +336,8 @@ public: if (rec->rec.key >= p->lower_bound && rec->rec.key <= p->upper_bound) { records.emplace_back(*rec); } - } - return records; } |