<commit_before>//
// Created by <NAME> on 16-4-29.
//

#pragma once

#include "backend/planner/abstract_plan.h"
#include "backend/planner/index_scan_plan.h"
#include "backend/storage/data_table.h"
#include "backend/index/index.h"
#include "backend/common/types.h"
#include "backend/expression/abstract_expression.h"

namespace peloton {
namespace planner{

class HybridScanPlan : public AbstractPlan {
public:
  HybridScanPlan(const HybridScanPlan &) = delete;
  HybridScanPlan &operator=(const HybridScanPlan &) = delete;
  HybridScanPlan(HybridScanPlan &&) = delete;
  HybridScanPlan &operator=(HybridScanPlan &&) = delete;


  HybridScanPlan(index::Index *index, storage::DataTable *table)
    : index_(index), table_(table) {}


  HybridScanPlan(storage::DataTable *table, expression::AbstractExpression *predicate,
      const std::vector<oid_t> &column_ids)
      : table_(table), predicate_(predicate), column_ids_(column_ids) {}

  HybridScanPlan(storage::DataTable *table,
                expression::AbstractExpression *predicate,
                const std::vector<oid_t> &column_ids,
                const IndexScanPlan::IndexScanDesc &index_scan_desc)
                : index_(index_scan_desc.index), table_(table), 
                  predicate_(predicate),
                  column_ids_(column_ids),
                  key_column_ids_(std::move(index_scan_desc.key_column_ids)),
                  expr_types_(std::move(index_scan_desc.expr_types)),
                  values_(std::move(index_scan_desc.values)),
                  runtime_keys_(std::move(index_scan_desc.runtime_keys)) {}


  index::Index *GetDataIndex() const {
    return this->index_;
  }

  storage::DataTable *GetDataTable() const {
    return this->table_;
  }

  std::unique_ptr<AbstractPlan> Copy() const {
    return std::unique_ptr<AbstractPlan>(nullptr);
  }

private:
  index::Index *index_ = nullptr;

  storage::DataTable *table_ = nullptr;

  const std::unique_ptr<expression::AbstractExpression> predicate_ = std::unique_ptr<expression::AbstractExpression>(nullptr);

  const std::vector<oid_t> column_ids_;

  const std::vector<oid_t> key_column_ids_;

  const std::vector<ExpressionType> expr_types_;

  const std::vector<Value> values_;

  const std::vector<expression::AbstractExpression *> runtime_keys_;<commit_msg>add GetPlanNodeFunc to hybrid scan<commit_after>//
// Created by <NAME> on 16-4-29.
//

#pragma once

#include "backend/planner/abstract_plan.h"
#include "backend/planner/index_scan_plan.h"
#include "backend/storage/data_table.h"
#include "backend/index/index.h"
#include "backend/common/types.h"
#include "backend/expression/abstract_expression.h"

namespace peloton {
namespace planner{

class HybridScanPlan : public AbstractPlan {
public:
  HybridScanPlan(const HybridScanPlan &) = delete;
  HybridScanPlan &operator=(const HybridScanPlan &) = delete;
  HybridScanPlan(HybridScanPlan &&) = delete;
  HybridScanPlan &operator=(HybridScanPlan &&) = delete;


  HybridScanPlan(index::Index *index, storage::DataTable *table)
    : index_(index), table_(table) {}


  HybridScanPlan(storage::DataTable *table, expression::AbstractExpression *predicate,
      const std::vector<oid_t> &column_ids)
      : table_(table), predicate_(predicate), column_ids_(column_ids) {}

  HybridScanPlan(storage::DataTable *table,
                expression::AbstractExpression *predicate,
                const std::vector<oid_t> &column_ids,
                const IndexScanPlan::IndexScanDesc &index_scan_desc)
                : index_(index_scan_desc.index), table_(table), 
                  predicate_(predicate),
                  column_ids_(column_ids),
                  key_column_ids_(std::move(index_scan_desc.key_column_ids)),
                  expr_types_(std::move(index_scan_desc.expr_types)),
                  values_(std::move(index_scan_desc.values)),
                  runtime_keys_(std::move(index_scan_desc.runtime_keys)) {}


  index::Index *GetDataIndex() const {
    return this->index_;
  }

  storage::DataTable *GetDataTable() const {
    return this->table_;
  }

  std::unique_ptr<AbstractPlan> Copy() const {
    return std::unique_ptr<AbstractPlan>(nullptr);
  }

  PlanNodeType GetPlanNodeType() const {
    return PLAN_NODE_TYPE_SEQSCAN;
  }

private:
  index::Index *index_ = nullptr;

  storage::DataTable *table_ = nullptr;

  const std::unique_ptr<expression::AbstractExpression> predicate_ = std::unique_ptr<expression::AbstractExpression>(nullptr);

  const std::vector<oid_t> column_ids_;

  const std::vector<oid_t> key_column_ids_;

  const std::vector<ExpressionType> expr_types_;

  const std::vector<Value> values_;

  const std::vector<expression::AbstractExpression *> runtime_keys_;
{'fraction_non_alphanumeric': 0.11987315010570825, 'fraction_numerical': 0.0021141649048625794, 'mean_word_length': 4.227624309392265, 'pattern_counts': {'":': 0, '<': 27, '<?xml version=': 0, '>': 31, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7574415', 'n_tokens_mistral': 1468, 'n_tokens_neox': 1400, 'n_words': 240}