Skip to content

Commit

Permalink
WIP
Browse files Browse the repository at this point in the history
  • Loading branch information
KiterLuc committed Nov 13, 2023
1 parent 52c4525 commit f78bfc7
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tiledb/sm/query/query.cc
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
#include "tiledb/sm/query/dimension_label/array_dimension_label_queries.h"
#include "tiledb/sm/query/legacy/reader.h"
#include "tiledb/sm/query/query_condition.h"
#include "tiledb/sm/query/readers/aggregators/sum_aggregator.h"
#include "tiledb/sm/query/readers/dense_reader.h"
#include "tiledb/sm/query/readers/ordered_dim_label_reader.h"
#include "tiledb/sm/query/readers/sparse_global_order_reader.h"
Expand Down Expand Up @@ -132,6 +133,13 @@ Query::Query(
subarray_.set_config(config_);

rest_scratch_ = make_shared<Buffer>(HERE());

bool found = false;
const Status& st =
config_.get<uint64_t>("sm.hardcoded_agg", &hardcoded_agg_, &found);
if (!st.ok() || !found) {
hardcoded_agg_ = 0;
}
}

Query::~Query() {
Expand Down Expand Up @@ -1576,6 +1584,17 @@ void Query::set_subarray_unsafe(const void* subarray) {
}

Status Query::submit() {
uint64_t sum = 0;
uint64_t sum_size = 8;
if (hardcoded_agg_ == 1 && default_channel_aggregates_.size() == 0) {
buffers_.clear();
default_channel_aggregates_.emplace(
"a",
std::make_shared<SumAggregator<int64_t>>(
tiledb::sm::FieldInfo("a", false, false, 1, Datatype::UINT64)));
throw_if_not_ok(set_data_buffer("a", &sum, &sum_size, false, false));
}

// Do not resubmit completed reads.
if (type_ == QueryType::READ && status_ == QueryStatus::COMPLETED) {
return Status::Ok();
Expand Down
2 changes: 2 additions & 0 deletions tiledb/sm/query/query.h
Original file line number Diff line number Diff line change
Expand Up @@ -952,6 +952,8 @@ class Query {
std::unordered_map<std::string, shared_ptr<IAggregator>>
default_channel_aggregates_;

uint64_t hardcoded_agg_;

/* ********************************* */
/* PRIVATE METHODS */
/* ********************************* */
Expand Down

0 comments on commit f78bfc7

Please sign in to comment.