reformat source code
according to code styles, 'AccessModifierOffset' should be -2.
This commit is contained in:
@ -28,7 +28,7 @@ namespace sql {
|
||||
typedef common::ObDList<ObSqlExpression> ObAggrExprList;
|
||||
|
||||
class ObAggregateDistinctItem {
|
||||
public:
|
||||
public:
|
||||
ObAggregateDistinctItem()
|
||||
: group_id_(0), col_idx_(0), cs_type_(common::CS_TYPE_INVALID), cells_(NULL), cs_type_list_(NULL)
|
||||
{}
|
||||
@ -64,14 +64,14 @@ class ObAggregateDistinctItem {
|
||||
// We only implement distinct logic here, no common interface abstracted here,
|
||||
// use the derived class directly.
|
||||
class ObAggCellCtx {
|
||||
public:
|
||||
public:
|
||||
// %alloc is used to initialize the structures, can not be used to hold the data
|
||||
explicit ObAggCellCtx(common::ObIAllocator& alloc);
|
||||
virtual ~ObAggCellCtx();
|
||||
|
||||
virtual void reuse();
|
||||
|
||||
public:
|
||||
public:
|
||||
// for distinct calculate may be replace by hash based distinct in the future.
|
||||
ObUniqueSort* distinct_set_;
|
||||
common::ObArrayHelper<ObSortColumn> sort_columns_;
|
||||
@ -79,12 +79,12 @@ class ObAggCellCtx {
|
||||
int init_distinct_set(const uint64_t tenant_id, const common::ObIArray<common::ObCollationType>& cs_types,
|
||||
const int64_t sort_col_cnt, const bool need_rewind);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
common::ObIAllocator& alloc_;
|
||||
};
|
||||
|
||||
class ObGroupConcatRowStore {
|
||||
public:
|
||||
public:
|
||||
ObGroupConcatRowStore();
|
||||
~ObGroupConcatRowStore();
|
||||
|
||||
@ -136,7 +136,7 @@ class ObGroupConcatRowStore {
|
||||
return need_sort_;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
bool need_sort_;
|
||||
int64_t rows_;
|
||||
int64_t iter_idx_;
|
||||
@ -147,7 +147,7 @@ class ObGroupConcatRowStore {
|
||||
};
|
||||
|
||||
class ObGroupConcatCtx : public ObAggCellCtx {
|
||||
public:
|
||||
public:
|
||||
ObGroupConcatCtx(common::ObIAllocator& alloc) : ObAggCellCtx(alloc), gc_rs_(NULL)
|
||||
{}
|
||||
|
||||
@ -155,7 +155,7 @@ class ObGroupConcatCtx : public ObAggCellCtx {
|
||||
|
||||
virtual void reuse() override;
|
||||
|
||||
public:
|
||||
public:
|
||||
ObGroupConcatRowStore* gc_rs_;
|
||||
};
|
||||
|
||||
@ -166,7 +166,7 @@ enum {
|
||||
};
|
||||
|
||||
class ObAggregateFunction {
|
||||
public:
|
||||
public:
|
||||
struct GroupRow {
|
||||
GroupRow() : row_(NULL), ctx_(NULL)
|
||||
{}
|
||||
@ -185,7 +185,7 @@ class ObAggregateFunction {
|
||||
TO_STRING_KV(K(expr_), K(ctx_idx_));
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
ObAggregateFunction();
|
||||
~ObAggregateFunction();
|
||||
void set_int_div_as_double(bool did);
|
||||
@ -250,7 +250,7 @@ class ObAggregateFunction {
|
||||
int deep_copy_cur_row(ObNewRow*& prev_row, const ObNewRow cur_row);
|
||||
int compare_calc(ObObj& obj1, ObObj& obj2, const ObOpSchemaObj& extra_info, int32_t& compare_result, bool& is_asc);
|
||||
|
||||
private:
|
||||
private:
|
||||
inline ObAggCellCtx* get_agg_cell_ctx(const int64_t group_id, const int64_t cell_idx)
|
||||
{
|
||||
return cell_idx >= 0 ? row_array_.at(group_id).ctx_[cell_idx] : NULL;
|
||||
@ -306,7 +306,7 @@ class ObAggregateFunction {
|
||||
const static int64_t CONCAT_STR_BUF_LEN = common::OB_MAX_VARCHAR_LENGTH;
|
||||
const static int64_t STORED_ROW_MAGIC_NUM = 0xaaaabbbbccccdddd;
|
||||
|
||||
private:
|
||||
private:
|
||||
// data members
|
||||
bool has_distinct_;
|
||||
bool has_sort_;
|
||||
|
||||
@ -29,10 +29,10 @@ namespace oceanbase {
|
||||
namespace sql {
|
||||
|
||||
struct ObAggrInfo {
|
||||
public:
|
||||
public:
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObAggrInfo()
|
||||
: expr_(NULL),
|
||||
real_aggr_type_(T_INVALID),
|
||||
@ -122,7 +122,7 @@ inline bool ObAggrInfo::is_number() const
|
||||
typedef common::ObFixedArray<ObDatum, common::ObIAllocator> DatumFixedArray;
|
||||
|
||||
class ObAggregateProcessor {
|
||||
public:
|
||||
public:
|
||||
// Context structure for one aggregation function of one group, only some functions need this:
|
||||
// with distinct: need this for distinct calculate
|
||||
// group concat: need context to hold the input cells.
|
||||
@ -139,7 +139,7 @@ class ObAggregateProcessor {
|
||||
// We only implement distinct logic here, no common interface abstracted here,
|
||||
// use the derived class directly.
|
||||
class ExtraResult {
|
||||
public:
|
||||
public:
|
||||
// %alloc is used to initialize the structures, can not be used to hold the data
|
||||
explicit ExtraResult(common::ObIAllocator& alloc) : alloc_(alloc), unique_sort_op_(NULL)
|
||||
{}
|
||||
@ -149,16 +149,16 @@ class ObAggregateProcessor {
|
||||
const uint64_t tenant_id, const ObAggrInfo& aggr_info, ObEvalCtx& eval_ctx, const bool need_rewind);
|
||||
DECLARE_VIRTUAL_TO_STRING;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
common::ObIAllocator& alloc_;
|
||||
|
||||
public:
|
||||
public:
|
||||
// for distinct calculate may be replace by hash based distinct in the future.
|
||||
ObUniqueSortImpl* unique_sort_op_;
|
||||
};
|
||||
|
||||
class GroupConcatExtraResult : public ExtraResult {
|
||||
public:
|
||||
public:
|
||||
explicit GroupConcatExtraResult(common::ObIAllocator& alloc)
|
||||
: ExtraResult(alloc), row_count_(0), iter_idx_(0), sort_op_(NULL)
|
||||
{}
|
||||
@ -210,7 +210,7 @@ class ObAggregateProcessor {
|
||||
}
|
||||
DECLARE_VIRTUAL_TO_STRING;
|
||||
|
||||
private:
|
||||
private:
|
||||
int64_t row_count_;
|
||||
int64_t iter_idx_;
|
||||
|
||||
@ -221,7 +221,7 @@ class ObAggregateProcessor {
|
||||
};
|
||||
|
||||
class AggrCell {
|
||||
public:
|
||||
public:
|
||||
AggrCell()
|
||||
: curr_row_results_(),
|
||||
row_count_(0),
|
||||
@ -319,10 +319,10 @@ class ObAggregateProcessor {
|
||||
;
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
ObChunkDatumStore::ShadowStoredRow<> curr_row_results_;
|
||||
|
||||
private:
|
||||
private:
|
||||
// for avg/count
|
||||
int64_t row_count_;
|
||||
|
||||
@ -370,7 +370,7 @@ class ObAggregateProcessor {
|
||||
ObChunkDatumStore::StoredRow* groupby_store_row_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
ObAggregateProcessor(ObEvalCtx& eval_ctx, ObIArray<ObAggrInfo>& aggr_infos);
|
||||
~ObAggregateProcessor()
|
||||
{
|
||||
@ -428,7 +428,7 @@ class ObAggregateProcessor {
|
||||
int clone_cell(ObDatum& target_cell, const ObDatum& src_cell, const bool is_number = false);
|
||||
static int get_llc_size();
|
||||
|
||||
private:
|
||||
private:
|
||||
int extend_concat_str_buf(const ObString& pad_str, const int64_t pos, const int64_t group_concat_cur_row_num,
|
||||
int64_t& append_len, bool& buf_is_full);
|
||||
OB_INLINE bool need_extra_info(const ObExprOperatorType expr_type);
|
||||
@ -483,7 +483,7 @@ class ObAggregateProcessor {
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObAggregateProcessor);
|
||||
|
||||
private:
|
||||
private:
|
||||
static const int64_t GROUP_ROW_SIZE = sizeof(GroupRow);
|
||||
static const int64_t GROUP_CELL_SIZE = sizeof(AggrCell);
|
||||
// data members
|
||||
@ -508,7 +508,7 @@ class ObAggregateProcessor {
|
||||
|
||||
// Used for calc hash for columns
|
||||
class ObGroupRowItem {
|
||||
public:
|
||||
public:
|
||||
ObGroupRowItem() : group_id_(0), group_row_ptr_(NULL), groupby_datums_hash_(0), next_(NULL)
|
||||
{}
|
||||
|
||||
@ -525,7 +525,7 @@ class ObGroupRowItem {
|
||||
|
||||
TO_STRING_KV(K_(group_id), KPC_(group_row), K_(groupby_datums_hash), KP_(group_exprs), KP_(next));
|
||||
|
||||
public:
|
||||
public:
|
||||
int64_t group_id_;
|
||||
union {
|
||||
void* group_row_ptr_;
|
||||
@ -537,7 +537,7 @@ class ObGroupRowItem {
|
||||
};
|
||||
|
||||
class ObGroupRowHashTable : public ObExtendHashTable<ObGroupRowItem> {
|
||||
public:
|
||||
public:
|
||||
ObGroupRowHashTable() : ObExtendHashTable(), eval_ctx_(nullptr), cmp_funcs_(nullptr)
|
||||
{}
|
||||
|
||||
@ -545,10 +545,10 @@ class ObGroupRowHashTable : public ObExtendHashTable<ObGroupRowItem> {
|
||||
int init(ObIAllocator* allocator, lib::ObMemAttr& mem_attr, ObEvalCtx* eval_ctx,
|
||||
const common::ObIArray<ObCmpFunc>* cmp_funcs, int64_t initial_size = INITIAL_SIZE);
|
||||
|
||||
private:
|
||||
private:
|
||||
bool compare(const ObGroupRowItem& left, const ObGroupRowItem& right) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
ObEvalCtx* eval_ctx_;
|
||||
const common::ObIArray<ObCmpFunc>* cmp_funcs_;
|
||||
};
|
||||
|
||||
@ -24,7 +24,7 @@ typedef common::ObColumnInfo ObDistinctColumn;
|
||||
class ObDistinct : public ObSingleChildPhyOperator {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObDistinct(common::ObIAllocator& alloc);
|
||||
// ObDistinct();
|
||||
virtual ~ObDistinct();
|
||||
@ -43,10 +43,10 @@ class ObDistinct : public ObSingleChildPhyOperator {
|
||||
return ObPhyOperator::init_array_size<>(distinct_columns_, distinct_count);
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObDistinct);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int64_t to_string_kv(char* buf, const int64_t buf_len) const;
|
||||
// data members
|
||||
common::ObFixedArray<ObDistinctColumn, common::ObIAllocator> distinct_columns_;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace sql {
|
||||
class ObDistinctSpec : public ObOpSpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObDistinctSpec(common::ObIAllocator& alloc, const ObPhyOperatorType type);
|
||||
|
||||
INHERIT_TO_STRING_KV("op_spec", ObOpSpec, K_(distinct_exprs), K_(is_block_mode), K_(cmp_funcs));
|
||||
|
||||
@ -32,7 +32,7 @@ namespace sql {
|
||||
// Auto extended hash table, extend to double buckets size if hash table is quarter filled.
|
||||
template <typename Item>
|
||||
class ObExtendHashTable {
|
||||
public:
|
||||
public:
|
||||
const static int64_t INITIAL_SIZE = 128;
|
||||
const static int64_t SIZE_BUCKET_SCALE = 4;
|
||||
ObExtendHashTable() : initial_bucket_num_(0), size_(0), buckets_(NULL), allocator_(NULL)
|
||||
@ -113,11 +113,11 @@ class ObExtendHashTable {
|
||||
return ret;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObExtendHashTable);
|
||||
int extend();
|
||||
|
||||
protected:
|
||||
protected:
|
||||
lib::ObMemAttr mem_attr_;
|
||||
int64_t initial_bucket_num_;
|
||||
int64_t size_;
|
||||
@ -269,7 +269,7 @@ int ObExtendHashTable<Item>::extend()
|
||||
|
||||
// Used for calc hash for columns
|
||||
class ObHashCols {
|
||||
public:
|
||||
public:
|
||||
ObHashCols() : row_(NULL), stored_row_(NULL), hash_col_idx_(NULL), next_(NULL), hash_val_(0)
|
||||
{}
|
||||
ObHashCols(const common::ObNewRow* row, const common::ObIArray<common::ObColumnInfo>* hash_col_idx)
|
||||
@ -310,7 +310,7 @@ class ObHashCols {
|
||||
|
||||
TO_STRING_KV(K_(row), K_(stored_row), K_(hash_col_idx), K_(next), K_(hash_val));
|
||||
|
||||
public:
|
||||
public:
|
||||
const common::ObNewRow* row_;
|
||||
const common::ObRowStore::StoredRow* stored_row_;
|
||||
const common::ObIArray<common::ObColumnInfo>* hash_col_idx_;
|
||||
@ -319,14 +319,14 @@ class ObHashCols {
|
||||
};
|
||||
|
||||
class ObGbyHashCols : public ObHashCols {
|
||||
public:
|
||||
public:
|
||||
using ObHashCols::ObHashCols;
|
||||
ObGbyHashCols*& next()
|
||||
{
|
||||
return *reinterpret_cast<ObGbyHashCols**>(&next_);
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
int64_t group_id_ = 0;
|
||||
};
|
||||
|
||||
@ -334,7 +334,7 @@ class ObGbyHashCols : public ObHashCols {
|
||||
// Used for build hash group row.
|
||||
template <typename Item>
|
||||
class ObHashCtx {
|
||||
public:
|
||||
public:
|
||||
explicit ObHashCtx() : group_rows_(), started_(false), bkt_created_(false)
|
||||
{}
|
||||
virtual ~ObHashCtx()
|
||||
@ -350,10 +350,10 @@ class ObHashCtx {
|
||||
return group_rows_.mem_used();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashCtx);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObExtendHashTable<Item> group_rows_;
|
||||
bool started_;
|
||||
bool bkt_created_;
|
||||
@ -371,7 +371,7 @@ class ObHashCtx {
|
||||
// are the same in one partition.
|
||||
//
|
||||
class ObGbyBloomFilter {
|
||||
public:
|
||||
public:
|
||||
explicit ObGbyBloomFilter(const ModulePageAllocator& alloc) : bits_(alloc), cnt_(0), h2_shift_(0)
|
||||
{}
|
||||
|
||||
@ -404,7 +404,7 @@ class ObGbyBloomFilter {
|
||||
h2_shift_ = 0;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
inline uint64_t h1(const uint64_t hash_val)
|
||||
{
|
||||
return hash_val;
|
||||
@ -422,7 +422,7 @@ class ObGbyBloomFilter {
|
||||
return v >> h2_shift_;
|
||||
}
|
||||
|
||||
public:
|
||||
public:
|
||||
int set(const uint64_t hash_val)
|
||||
{
|
||||
int ret = common::OB_SUCCESS;
|
||||
@ -441,7 +441,7 @@ class ObGbyBloomFilter {
|
||||
return bits_.has_member(h1(hash_val) & (cnt_ - 1)) && bits_.has_member(h2(hash_val) & (cnt_ - 1));
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
ObSegmentBitSet<> bits_;
|
||||
int64_t cnt_; // power of 2
|
||||
int64_t h2_shift_;
|
||||
|
||||
@ -32,14 +32,14 @@ typedef common::ObColumnInfo ObGroupColumn;
|
||||
//};
|
||||
|
||||
class ObGroupBy : public ObSingleChildPhyOperator {
|
||||
public:
|
||||
public:
|
||||
static const int64_t MIN_BUCKET_COUNT = 100;
|
||||
static const int64_t MAX_BUCKET_COUNT = 100000;
|
||||
static const int64_t LOCAL_COLUMN_COUNT = 16;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
class ObGroupByCtx : public ObPhyOperatorCtx {
|
||||
public:
|
||||
public:
|
||||
explicit ObGroupByCtx(ObExecContext& exec_ctx) : ObPhyOperatorCtx(exec_ctx), aggr_func_(), child_column_count_(0)
|
||||
{}
|
||||
virtual ~ObGroupByCtx()
|
||||
@ -62,13 +62,13 @@ class ObGroupBy : public ObSingleChildPhyOperator {
|
||||
child_column_count_ = child_column_count;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObAggregateFunction aggr_func_;
|
||||
int64_t child_column_count_;
|
||||
};
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObGroupBy(common::ObIAllocator& alloc);
|
||||
virtual ~ObGroupBy();
|
||||
virtual void reset();
|
||||
@ -127,7 +127,7 @@ class ObGroupBy : public ObSingleChildPhyOperator {
|
||||
est_group_cnt_ = cnt;
|
||||
}
|
||||
|
||||
protected:
|
||||
protected:
|
||||
int is_same_group(const common::ObRowStore::StoredRow& row1, const common::ObNewRow& row2, bool& result,
|
||||
int64_t& first_diff_pos) const;
|
||||
virtual int inner_get_next_row(ObExecContext& ctx, const common::ObNewRow*& row) const = 0;
|
||||
@ -155,11 +155,11 @@ class ObGroupBy : public ObSingleChildPhyOperator {
|
||||
*/
|
||||
virtual int inner_create_operator_ctx(ObExecContext& ctx, ObPhyOperatorCtx*& op_ctx) const = 0;
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObGroupBy);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObAggrExprList aggr_columns_;
|
||||
int64_t mem_size_limit_; // discarded, never assigned
|
||||
int32_t prepare_row_num_;
|
||||
|
||||
@ -21,28 +21,28 @@ namespace sql {
|
||||
|
||||
// constant
|
||||
class ObGroupBySpec : public ObOpSpec {
|
||||
public:
|
||||
public:
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObGroupBySpec(common::ObIAllocator& alloc, const ObPhyOperatorType type) : ObOpSpec(alloc, type), aggr_infos_(alloc)
|
||||
{}
|
||||
DECLARE_VIRTUAL_TO_STRING;
|
||||
|
||||
// int add_udf_meta(ObAggUDFDatumMeta &meta) { return agg_udf_meta_.push_back(meta); }
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObGroupBySpec);
|
||||
|
||||
public:
|
||||
public:
|
||||
AggrInfoFixedArray aggr_infos_; // aggr column + non-aggr column
|
||||
// common::ObSEArray<ObAggUdfMeta, 16> agg_udf_meta_;
|
||||
};
|
||||
|
||||
// modifiable
|
||||
class ObGroupByOp : public ObOperator {
|
||||
public:
|
||||
public:
|
||||
ObGroupByOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input)
|
||||
: ObOperator(exec_ctx, spec, input),
|
||||
aggr_processor_(eval_ctx_, (static_cast<ObGroupBySpec&>(const_cast<ObOpSpec&>(spec))).aggr_infos_)
|
||||
@ -59,12 +59,12 @@ class ObGroupByOp : public ObOperator {
|
||||
virtual int inner_close() override;
|
||||
virtual void destroy() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void reset_default();
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObGroupByOp);
|
||||
|
||||
protected:
|
||||
protected:
|
||||
ObAggregateProcessor aggr_processor_;
|
||||
};
|
||||
|
||||
|
||||
@ -28,15 +28,15 @@ namespace sql {
|
||||
class ObHashDistinct : public ObDistinct {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
class ObHashDistinctCtx : public ObPhyOperatorCtx {
|
||||
public:
|
||||
public:
|
||||
static const int64_t MIN_PART_COUNT = 8;
|
||||
static const int64_t MAX_PART_COUNT = 256;
|
||||
enum HDState { SCAN_CHILD = 1, OUTPUT_HA = 2, PROCESS_IN_MEM = 3, GET_PARTITION = 4, SCAN_PARTITION = 5 };
|
||||
friend class ObHashDistinct;
|
||||
class PartitionLinkNode : public common::ObDLinkBase<PartitionLinkNode> {
|
||||
public:
|
||||
public:
|
||||
PartitionLinkNode(ObHashDistinctCtx* data, ObHashDistinctCtx* parent)
|
||||
: ObDLinkBase<PartitionLinkNode>(), data_(data), parent_(parent)
|
||||
{}
|
||||
@ -150,7 +150,7 @@ class ObHashDistinct : public ObDistinct {
|
||||
int assign_sub_ctx(ObHashDistinctCtx* parent, ObChunkRowStore* parent_row_stores, ObHashDistinctCtx* top_ctx);
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashDistinctCtx);
|
||||
|
||||
private:
|
||||
private:
|
||||
int64_t mem_limit_;
|
||||
// n_bucket must be pow2, so the last N bits of hash_value can used as bucket_idx directly
|
||||
// N = bucket_bits_ = log2(n_buckets_)
|
||||
@ -198,7 +198,7 @@ class ObHashDistinct : public ObDistinct {
|
||||
friend class ObHashDistinct;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
static const int64_t MIN_BUCKET_COUNT = 1L << 14; // 16384;
|
||||
static const int64_t MAX_BUCKET_COUNT = 1L << 19; // 524288;
|
||||
static const int64_t HASH_DISTINCT_BUCKET_RATIO = 2;
|
||||
@ -213,7 +213,7 @@ class ObHashDistinct : public ObDistinct {
|
||||
virtual void reuse();
|
||||
virtual int rescan(ObExecContext& ctx) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
int estimate_memory_usage(
|
||||
ObHashDistinctCtx* hash_ctx, int64_t memory_limit, int64_t& ha_mem, int64_t& mem_need) const;
|
||||
int get_hash_value(const common::ObNewRow* row, uint64_t& hash_value) const;
|
||||
|
||||
@ -25,7 +25,7 @@ namespace sql {
|
||||
class ObHashDistinctSpec : public ObDistinctSpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObHashDistinctSpec(common::ObIAllocator& alloc, const ObPhyOperatorType type);
|
||||
|
||||
ObSortCollations sort_collations_;
|
||||
@ -33,7 +33,7 @@ class ObHashDistinctSpec : public ObDistinctSpec {
|
||||
};
|
||||
|
||||
class ObHashDistinctOp : public ObOperator {
|
||||
public:
|
||||
public:
|
||||
ObHashDistinctOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input);
|
||||
~ObHashDistinctOp()
|
||||
{}
|
||||
@ -44,14 +44,14 @@ class ObHashDistinctOp : public ObOperator {
|
||||
virtual int inner_get_next_row() override;
|
||||
virtual void destroy() override;
|
||||
|
||||
private:
|
||||
private:
|
||||
void reset();
|
||||
int do_unblock_distinct();
|
||||
int do_block_distinct();
|
||||
int init_hash_partition_infras();
|
||||
int build_distinct_data(bool is_block);
|
||||
|
||||
private:
|
||||
private:
|
||||
typedef int (ObHashDistinctOp::*GetNextRowFunc)();
|
||||
static const int64_t MIN_BUCKET_COUNT = 1L << 14; // 16384;
|
||||
static const int64_t MAX_BUCKET_COUNT = 1L << 19; // 524288;
|
||||
|
||||
@ -33,7 +33,7 @@ using namespace common::hash;
|
||||
namespace sql {
|
||||
|
||||
struct ObGbyPartition : public common::ObDLinkBase<ObGbyPartition> {
|
||||
public:
|
||||
public:
|
||||
ObGbyPartition(common::ObIAllocator* alloc = nullptr) : row_store_(alloc), level_(0)
|
||||
{}
|
||||
ObChunkRowStore row_store_;
|
||||
@ -41,7 +41,7 @@ struct ObGbyPartition : public common::ObDLinkBase<ObGbyPartition> {
|
||||
};
|
||||
|
||||
class ObHashGroupBy::ObHashGroupByCtx : public ObGroupByCtx, public ObHashCtx<ObGbyHashCols> {
|
||||
public:
|
||||
public:
|
||||
explicit ObHashGroupByCtx(ObExecContext& exec_ctx)
|
||||
: ObGroupByCtx(exec_ctx),
|
||||
ObHashCtx(),
|
||||
@ -138,11 +138,11 @@ class ObHashGroupBy::ObHashGroupByCtx : public ObGroupByCtx, public ObHashCtx<Ob
|
||||
return sql_mem_processor_.get_mem_bound();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashGroupByCtx);
|
||||
friend class ObHashGroupBy;
|
||||
|
||||
private:
|
||||
private:
|
||||
static const int64_t FIX_SIZE_PER_PART = sizeof(ObGbyPartition) + ObChunkRowStore::BLOCK_SIZE;
|
||||
int64_t group_idx_;
|
||||
|
||||
|
||||
@ -21,10 +21,10 @@ class ObGbyBloomFilter;
|
||||
class ObGbyPartition;
|
||||
|
||||
class ObHashGroupBy : public ObGroupBy {
|
||||
private:
|
||||
private:
|
||||
class ObHashGroupByCtx;
|
||||
|
||||
public:
|
||||
public:
|
||||
static const int64_t MIN_PARTITION_CNT = 8;
|
||||
static const int64_t MAX_PARTITION_CNT = 256;
|
||||
|
||||
@ -45,10 +45,10 @@ class ObHashGroupBy : public ObGroupBy {
|
||||
|
||||
int get_hash_groupby_row_count(ObExecContext& exec_ctx, int64_t& hash_groupby_row_count) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashGroupBy);
|
||||
|
||||
private:
|
||||
private:
|
||||
/**
|
||||
* @brief create operator context, only child operator can know it's specific operator type,
|
||||
* so must be overwrited by child operator,
|
||||
|
||||
@ -25,7 +25,7 @@ namespace sql {
|
||||
class ObHashGroupBySpec : public ObGroupBySpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObHashGroupBySpec(common::ObIAllocator& alloc, const ObPhyOperatorType type)
|
||||
: ObGroupBySpec(alloc, type), group_exprs_(alloc), cmp_funcs_(alloc), est_group_cnt_(0)
|
||||
{}
|
||||
@ -41,11 +41,11 @@ class ObHashGroupBySpec : public ObGroupBySpec {
|
||||
est_group_cnt_ = cnt;
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashGroupBySpec);
|
||||
|
||||
public:
|
||||
public:
|
||||
ExprFixedArray group_exprs_; // group by column
|
||||
ObCmpFuncs cmp_funcs_;
|
||||
int64_t est_group_cnt_;
|
||||
@ -53,16 +53,16 @@ class ObHashGroupBySpec : public ObGroupBySpec {
|
||||
|
||||
// input rows is already sorted by groupby columns
|
||||
class ObHashGroupByOp : public ObGroupByOp {
|
||||
public:
|
||||
public:
|
||||
struct DatumStoreLinkPartition : public common::ObDLinkBase<DatumStoreLinkPartition> {
|
||||
public:
|
||||
public:
|
||||
DatumStoreLinkPartition(common::ObIAllocator* alloc = nullptr) : datum_store_(alloc), part_id_(0)
|
||||
{}
|
||||
ObChunkDatumStore datum_store_;
|
||||
int64_t part_id_;
|
||||
};
|
||||
|
||||
public:
|
||||
public:
|
||||
static const int64_t MIN_PARTITION_CNT = 8;
|
||||
static const int64_t MAX_PARTITION_CNT = 256;
|
||||
|
||||
@ -74,7 +74,7 @@ class ObHashGroupByOp : public ObGroupByOp {
|
||||
static constexpr const double EXTRA_MEM_RATIO = 0.25;
|
||||
static const int64_t FIX_SIZE_PER_PART = sizeof(DatumStoreLinkPartition) + ObChunkRowStore::BLOCK_SIZE;
|
||||
|
||||
public:
|
||||
public:
|
||||
ObHashGroupByOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input)
|
||||
: ObGroupByOp(exec_ctx, spec, input),
|
||||
curr_group_id_(common::OB_INVALID_INDEX),
|
||||
@ -170,11 +170,11 @@ class ObHashGroupByOp : public ObGroupByOp {
|
||||
int restore_groupby_datum();
|
||||
int init_mem_context(void);
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObHashGroupByOp);
|
||||
|
||||
private:
|
||||
private:
|
||||
ObGroupRowHashTable local_group_rows_;
|
||||
int64_t curr_group_id_;
|
||||
|
||||
|
||||
@ -22,7 +22,7 @@ using namespace common;
|
||||
|
||||
namespace sql {
|
||||
class ObMergeDistinct::ObMergeDistinctCtx : public ObPhyOperatorCtx {
|
||||
public:
|
||||
public:
|
||||
explicit ObMergeDistinctCtx(ObExecContext& ctx)
|
||||
: ObPhyOperatorCtx(ctx),
|
||||
got_first_row_(false),
|
||||
@ -93,10 +93,10 @@ class ObMergeDistinct::ObMergeDistinctCtx : public ObPhyOperatorCtx {
|
||||
ObPhyOperatorCtx::destroy_base();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
static const int64_t OB_ROW_BUF_SIZE = OB_MAX_ROW_LENGTH;
|
||||
|
||||
private:
|
||||
private:
|
||||
bool got_first_row_;
|
||||
ObNewRow last_row_;
|
||||
void* last_row_buf_;
|
||||
|
||||
@ -23,10 +23,10 @@ namespace sql {
|
||||
class ObMergeDistinct : public ObDistinct {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
private:
|
||||
private:
|
||||
class ObMergeDistinctCtx;
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObMergeDistinct(common::ObIAllocator& alloc);
|
||||
// ObMergeDistinct();
|
||||
virtual ~ObMergeDistinct();
|
||||
@ -34,7 +34,7 @@ class ObMergeDistinct : public ObDistinct {
|
||||
virtual void reuse();
|
||||
virtual int rescan(ObExecContext& ctx) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
// member function
|
||||
int compare_equal(const common::ObNewRow& this_row, const common::ObNewRow& last_row, bool& result) const;
|
||||
/**
|
||||
|
||||
@ -23,12 +23,12 @@ namespace sql {
|
||||
class ObMergeDistinctSpec : public ObDistinctSpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObMergeDistinctSpec(common::ObIAllocator& alloc, const ObPhyOperatorType type);
|
||||
};
|
||||
|
||||
class ObMergeDistinctOp : public ObOperator {
|
||||
public:
|
||||
public:
|
||||
ObMergeDistinctOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input);
|
||||
|
||||
virtual int inner_open() override;
|
||||
@ -38,7 +38,7 @@ class ObMergeDistinctOp : public ObOperator {
|
||||
virtual void destroy() override;
|
||||
|
||||
class Compare {
|
||||
public:
|
||||
public:
|
||||
Compare() : eval_ctx_(nullptr), cmp_funcs_(nullptr), ret_code_(common::OB_SUCCESS)
|
||||
{}
|
||||
|
||||
@ -49,7 +49,7 @@ class ObMergeDistinctOp : public ObOperator {
|
||||
int ret_code_;
|
||||
};
|
||||
|
||||
private:
|
||||
private:
|
||||
typedef ObChunkDatumStore::LastStoredRow<ObChunkDatumStore::StoredRow> LastStoreRow;
|
||||
bool first_got_row_;
|
||||
common::ObArenaAllocator alloc_;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace sql {
|
||||
// REGISTER_PHY_OPERATOR(ObMergeGroupBy, PHY_MERGE_GROUP_BY);
|
||||
|
||||
class ObMergeGroupBy::ObMergeGroupByCtx : public ObGroupByCtx {
|
||||
public:
|
||||
public:
|
||||
explicit ObMergeGroupByCtx(ObExecContext& exec_ctx)
|
||||
: ObGroupByCtx(exec_ctx), last_input_row_(NULL), is_end_(false), cur_output_group_id(-1), first_output_group_id(0)
|
||||
{}
|
||||
@ -31,10 +31,10 @@ class ObMergeGroupBy::ObMergeGroupByCtx : public ObGroupByCtx {
|
||||
ObGroupByCtx::destroy();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
DISALLOW_COPY_AND_ASSIGN(ObMergeGroupByCtx);
|
||||
|
||||
private:
|
||||
private:
|
||||
const ObNewRow* last_input_row_;
|
||||
bool is_end_;
|
||||
// added to support groupby with rollup
|
||||
|
||||
@ -16,15 +16,15 @@
|
||||
namespace oceanbase {
|
||||
namespace sql {
|
||||
class ObMergeGroupBy : public ObGroupBy {
|
||||
protected:
|
||||
protected:
|
||||
class ObMergeGroupByCtx;
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObMergeGroupBy(common::ObIAllocator& alloc);
|
||||
virtual ~ObMergeGroupBy();
|
||||
virtual int rescan(ObExecContext& ctx) const;
|
||||
|
||||
private:
|
||||
private:
|
||||
virtual int inner_get_next_row(ObExecContext& ctx, const common::ObNewRow*& row) const;
|
||||
/**
|
||||
* @brief open operator, not including children operators.
|
||||
|
||||
@ -22,7 +22,7 @@ namespace sql {
|
||||
class ObMergeGroupBySpec : public ObGroupBySpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObMergeGroupBySpec(common::ObIAllocator& alloc, const ObPhyOperatorType type)
|
||||
: ObGroupBySpec(alloc, type),
|
||||
group_exprs_(alloc),
|
||||
@ -51,11 +51,11 @@ class ObMergeGroupBySpec : public ObGroupBySpec {
|
||||
int add_group_expr(ObExpr* expr);
|
||||
int add_rollup_expr(ObExpr* expr);
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObMergeGroupBySpec);
|
||||
|
||||
public:
|
||||
public:
|
||||
ExprFixedArray group_exprs_; // group by column
|
||||
ExprFixedArray rollup_exprs_; // rollup column
|
||||
common::ObFixedArray<bool, common::ObIAllocator> is_distinct_rollup_expr_;
|
||||
@ -64,7 +64,7 @@ class ObMergeGroupBySpec : public ObGroupBySpec {
|
||||
|
||||
// The input data has been sorted according to the groupby column
|
||||
class ObMergeGroupByOp : public ObGroupByOp {
|
||||
public:
|
||||
public:
|
||||
ObMergeGroupByOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input)
|
||||
: ObGroupByOp(exec_ctx, spec, input),
|
||||
is_end_(false),
|
||||
@ -87,11 +87,11 @@ class ObMergeGroupByOp : public ObGroupByOp {
|
||||
int rollup_and_calc_results(const int64_t group_id, const ObExpr* diff_expr = NULL);
|
||||
int rewrite_rollup_column(ObExpr*& diff_expr);
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObMergeGroupByOp);
|
||||
|
||||
private:
|
||||
private:
|
||||
bool is_end_;
|
||||
// added to support groupby with rollup
|
||||
int64_t cur_output_group_id_;
|
||||
|
||||
@ -22,7 +22,7 @@ namespace oceanbase {
|
||||
using namespace common;
|
||||
namespace sql {
|
||||
class ObScalarAggregate::ObScalarAggregateCtx : public ObGroupByCtx {
|
||||
public:
|
||||
public:
|
||||
explicit ObScalarAggregateCtx(ObExecContext& exec_ctx) : ObGroupByCtx(exec_ctx), started_(false)
|
||||
{}
|
||||
virtual void destroy()
|
||||
@ -30,7 +30,7 @@ class ObScalarAggregate::ObScalarAggregateCtx : public ObGroupByCtx {
|
||||
ObGroupByCtx::destroy();
|
||||
}
|
||||
|
||||
private:
|
||||
private:
|
||||
bool started_;
|
||||
|
||||
friend class ObScalarAggregate;
|
||||
|
||||
@ -23,10 +23,10 @@ class ObNewRow;
|
||||
|
||||
namespace sql {
|
||||
class ObScalarAggregate : public ObGroupBy {
|
||||
protected:
|
||||
protected:
|
||||
class ObScalarAggregateCtx;
|
||||
|
||||
public:
|
||||
public:
|
||||
explicit ObScalarAggregate(common::ObIAllocator& alloc);
|
||||
virtual ~ObScalarAggregate();
|
||||
virtual void reset();
|
||||
@ -34,7 +34,7 @@ class ObScalarAggregate : public ObGroupBy {
|
||||
virtual int rescan(ObExecContext& ctx) const;
|
||||
virtual int switch_iterator(ObExecContext& ctx) const override;
|
||||
|
||||
protected:
|
||||
protected:
|
||||
virtual int inner_get_next_row(ObExecContext& ctx, const common::ObNewRow*& row) const;
|
||||
/**
|
||||
* @brief open operator, not including children operators.
|
||||
@ -64,7 +64,7 @@ class ObScalarAggregate : public ObGroupBy {
|
||||
virtual int64_t to_string_kv(char* buf, const int64_t buf_len) const;
|
||||
virtual int add_group_column_idx(int64_t column_idx, common::ObCollationType cs_type);
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObScalarAggregate);
|
||||
};
|
||||
|
||||
@ -21,17 +21,17 @@ namespace sql {
|
||||
class ObScalarAggregateSpec : public ObGroupBySpec {
|
||||
OB_UNIS_VERSION_V(1);
|
||||
|
||||
public:
|
||||
public:
|
||||
ObScalarAggregateSpec(common::ObIAllocator& alloc, const ObPhyOperatorType type) : ObGroupBySpec(alloc, type)
|
||||
{}
|
||||
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObScalarAggregateSpec);
|
||||
};
|
||||
|
||||
class ObScalarAggregateOp : public ObGroupByOp {
|
||||
public:
|
||||
public:
|
||||
friend ObAggregateProcessor;
|
||||
ObScalarAggregateOp(ObExecContext& exec_ctx, const ObOpSpec& spec, ObOpInput* input)
|
||||
: ObGroupByOp(exec_ctx, spec, input), started_(false)
|
||||
@ -44,11 +44,11 @@ class ObScalarAggregateOp : public ObGroupByOp {
|
||||
virtual int inner_get_next_row() override;
|
||||
virtual void destroy() override;
|
||||
// reset default value of %cur_rownum_ && %rownum_limit_
|
||||
private:
|
||||
private:
|
||||
// disallow copy
|
||||
DISALLOW_COPY_AND_ASSIGN(ObScalarAggregateOp);
|
||||
|
||||
private:
|
||||
private:
|
||||
bool started_;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user