Commit 4834e6b4 authored by Paul Asmuth's avatar Paul Asmuth
Browse files

gcc doesn't like std::unique_ptr<void>

parent 9791258c
Loading
Loading
Loading
Loading
+10 −12
Original line number Diff line number Diff line
@@ -35,14 +35,19 @@ GroupOverTimewindow::GroupOverTimewindow(
    group_expr_(group_expr),
    scratchpad_size_(scratchpad_size),
    child_(child) {
  scratchpad_.reset(malloc(scratchpad_size_));
  if (scratchpad_.get() == nullptr) {
  scratchpad_ = malloc(scratchpad_size_);

  if (scratchpad_ == nullptr) {
    RAISE(kMallocError, "malloc() failed");
  }

  child->setTarget(this);
}

GroupOverTimewindow::~GroupOverTimewindow() {
  free(scratchpad_);
}

void GroupOverTimewindow::execute() {
  child_->execute();

@@ -127,13 +132,6 @@ void GroupOverTimewindow::emitGroup(Group* group) {
            rows[window_end_idx].first < window_end_time;
        ++window_end_idx);

    printf("window %i, %i (%lu-%lu=%lu)\n",
        window_start_idx,
        window_end_idx,
        window_start_time,
        window_end_time,
        window_end_time - window_start_time);

    emitWindow(
        window_end_time,
        rows.begin() + window_start_idx,
@@ -159,7 +157,7 @@ void GroupOverTimewindow::emitWindow(
  SValue out[128]; // FIXPAUL
  int out_len;

  memset(scratchpad_.get(), 0, scratchpad_size_);
  memset(scratchpad_, 0, scratchpad_size_);

  if (window_begin == window_end) {
    std::vector<SValue> row(input_row_size_, SValue());
@@ -167,7 +165,7 @@ void GroupOverTimewindow::emitWindow(

    executeExpression(
        select_expr_,
        scratchpad_.get(),
        scratchpad_,
        row.size(),
        row.data(),
        &out_len,
@@ -179,7 +177,7 @@ void GroupOverTimewindow::emitWindow(

      executeExpression(
          select_expr_,
          scratchpad_.get(),
          scratchpad_,
          row.size(),
          row.data(),
          &out_len,
+5 −1
Original line number Diff line number Diff line
@@ -9,6 +9,8 @@
 */
#ifndef _FNORDMETRIC_SQL_GROUPOVERTIMEWINDOW_H
#define _FNORDMETRIC_SQL_GROUPOVERTIMEWINDOW_H
#include <algorithm>
#include <memory>
#include <stdlib.h>
#include <string>
#include <string.h>
@@ -38,6 +40,8 @@ public:
      size_t scratchpad_size,
      QueryPlanNode* child);

  ~GroupOverTimewindow();

  void execute() override;
  bool nextRow(SValue* row, int row_len) override;

@@ -69,7 +73,7 @@ protected:
  CompiledExpression* group_expr_;
  size_t scratchpad_size_;
  QueryPlanNode* child_;
  std::unique_ptr<void> scratchpad_;
  void* scratchpad_;
  std::unordered_map<std::string, Group> groups_;
};