[CP] column id of cte table start from 16
This commit is contained in:
1
deps/oblib/src/lib/ob_define.h
vendored
1
deps/oblib/src/lib/ob_define.h
vendored
@ -903,7 +903,6 @@ const uint64_t OB_MAX_LS_INNER_TABLE_ID = 49500;
|
||||
// (49500, 49999) for cte, cte table opens up a separate id space, which does not conflict with other id
|
||||
const uint64_t OB_MIN_CTE_TABLE_ID = 49500;
|
||||
const uint64_t OB_MAX_CTE_TABLE_ID = 49999;
|
||||
const uint64_t OB_MIN_CTE_COLUMN_ID = 0;
|
||||
// (50000, 60000) for inner lob meta table
|
||||
// (60000, 70000) for inner lob piece table
|
||||
const uint64_t OB_MIN_SYS_LOB_META_TABLE_ID = 50000;
|
||||
|
||||
@ -200,7 +200,7 @@ public:
|
||||
inline uint64_t get_sequence_id() const { return sequence_id_; }
|
||||
inline int64_t get_encoding_type() const { return encoding_type_; }
|
||||
|
||||
inline int64_t get_cte_generate_column_projector_offset() const { return get_column_id();}
|
||||
inline int64_t get_cte_generate_column_projector_offset() const { return get_column_id() - common::OB_APP_MIN_COLUMN_ID;}
|
||||
// true: primary key/hidden primary key(pk_increment/cluster_id/parition_id)/partitioned key of no-pk tables
|
||||
inline bool is_rowkey_column() const { return rowkey_position_ > 0; }
|
||||
// true: primary key/hidden primary key(pk_increment/cluster_id/parition_id)
|
||||
|
||||
@ -1530,7 +1530,7 @@ int ObStaticEngineCG::generate_recursive_union_all_spec(ObLogSet &op, ObRecursiv
|
||||
{
|
||||
const ObRawExpr* raw_expr = cycle_items.at(i).expr_;
|
||||
if (raw_expr->is_column_ref_expr()) {
|
||||
uint64_t index = cycle_items.at(i).column_id_;
|
||||
uint64_t index = cycle_items.at(i).column_id_ - OB_APP_MIN_COLUMN_ID;
|
||||
if (OB_FAIL(spec.cycle_by_col_lists_.push_back(index))) {
|
||||
LOG_WARN("Failed to add cycle by order", K(ret));
|
||||
}
|
||||
|
||||
@ -2380,7 +2380,7 @@ public:
|
||||
inline void set_database_name(const common::ObString &db_name) { database_name_ = db_name; }
|
||||
inline const common::ObString &get_database_name() const { return database_name_; }
|
||||
inline common::ObString &get_database_name() { return database_name_; }
|
||||
inline int64_t get_cte_generate_column_projector_offset() const { return get_column_id(); }
|
||||
inline int64_t get_cte_generate_column_projector_offset() const { return get_column_id() - common::OB_APP_MIN_COLUMN_ID; }
|
||||
virtual void reset();
|
||||
virtual bool inner_same_as(const ObRawExpr &expr,
|
||||
ObExprEqualCheckContext *check_context = NULL) const override;
|
||||
|
||||
@ -103,7 +103,7 @@ public:
|
||||
return ret_cid;
|
||||
}
|
||||
inline uint64_t generate_cte_table_id() { return params_.new_cte_tid_++;}
|
||||
inline uint64_t generate_cte_column_base_id() { return common::OB_MIN_CTE_COLUMN_ID;}
|
||||
inline uint64_t generate_cte_column_base_id() { return common::OB_APP_MIN_COLUMN_ID;}
|
||||
template<class T>
|
||||
T *create_stmt()
|
||||
{
|
||||
|
||||
@ -2585,4 +2585,26 @@ with cte as (select * from t1) select 1 from dual;
|
||||
| 1 |
|
||||
+---+
|
||||
|
||||
with recursive cte1 as
|
||||
(
|
||||
select 1 as c1, 2 as c2, 3 as c3, 4 as c4, 5 as c5, 6 as c6, 7 as c7, 8 as c8, 9 as c9, 10 as c10, 11 as c11, 12 as c12
|
||||
union all
|
||||
select c1+1,c2+1,c3+1,c4+1,c5+1,c6+1,c7+1,c8+1,c9+1,c10+1, c11+1, c12+1 from cte1 where c1 < 10
|
||||
)
|
||||
select * from cte1;
|
||||
+------+------+------+------+------+------+------+------+------+------+------+------+
|
||||
| c1 | c2 | c3 | c4 | c5 | c6 | c7 | c8 | c9 | c10 | c11 | c12 |
|
||||
+------+------+------+------+------+------+------+------+------+------+------+------+
|
||||
| 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 |
|
||||
| 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 |
|
||||
| 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 |
|
||||
| 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 |
|
||||
| 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 |
|
||||
| 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 |
|
||||
| 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 |
|
||||
| 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 |
|
||||
| 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 |
|
||||
| 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 |
|
||||
+------+------+------+------+------+------+------+------+------+------+------+------+
|
||||
|
||||
drop database cte_st;
|
||||
|
||||
@ -755,5 +755,12 @@ delete from t1 where c1 = ( with cte (a) as (select max( c1 ) from t1 ) select *
|
||||
--echo ##############################
|
||||
with cte as (select * from t1) select 1 from dual;
|
||||
|
||||
with recursive cte1 as
|
||||
(
|
||||
select 1 as c1, 2 as c2, 3 as c3, 4 as c4, 5 as c5, 6 as c6, 7 as c7, 8 as c8, 9 as c9, 10 as c10, 11 as c11, 12 as c12
|
||||
union all
|
||||
select c1+1,c2+1,c3+1,c4+1,c5+1,c6+1,c7+1,c8+1,c9+1,c10+1, c11+1, c12+1 from cte1 where c1 < 10
|
||||
)
|
||||
select * from cte1;
|
||||
|
||||
drop database cte_st;
|
||||
Reference in New Issue
Block a user