*************** Case 1 *************** drop database if exists cte_db; { "drop_database_arg":"tenant_id", "database_name":"cte_db", "if_exist":true, "to_recyclebin":false } *************** Case 2 *************** create database cte_db; { "create_database_arg":"database_schema", "database_id":-1, "schema_version":1, "database_name":"cte_db", "replica_num":0, "zone_list": [ ], "primary_zone":"", "charset_type":2, "collation_type":"utf8mb4_general_ci", "name_case_mode":-1, "comment":"", "read_only":false, "default_tablegroup_id":-1, "default_tablegroup_name":"", "in_recyclebin":false, "primary_zone_array": [ ] } *************** Case 3 *************** use cte_db; { "stmt_type":97 } *************** Case 4 *************** create table emp(id int, name varchar(20), leaderid int); {"ObTableStmt":{"partition_fun_expr":[], "range_values_exprs":[], "list_values_exprs":[], "index_partition_resolve_results":[], "part_type":8}, "stmt_type":20, "create_table_arg":{"if_not_exist":false, "schema":{"simple_table_schema":{"tenant_id":1, "database_id":18446744073709551615, "tablegroup_id":1099511627777, "table_id":18446744073709551615, "table_name":"emp", "replica_num":0, "previous_locality_str":"", "min_partition_id":0, "index_type":0, "table_type":3, "data_table_id":0, "name_casemode":-1, "schema_version":0, "part_level":0, "part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":0}, "sub_part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":-1}, "locality_str":"", "zone_list":[], "primary_zone":"", "part_num":0, "subpart_num":0, "partition_num":1, "subpartition_num":0, "partition_array":[{"tenant_id":18446744073709551615, "table_id":18446744073709551615, "part_id":0, "name":"p0", "high_bound_val":, "list_row_values":[], "part_idx":0}], "subpartition_array":null, "index_status":1}, "max_used_column_id":18, "max_used_constraint_id":0, "rowkey_column_num":3, "index_column_num":0, "rowkey_split_pos":0, "block_size":16384, "is_use_bloomfilter":false, "progressive_merge_num":0, "tablet_size":134217728, "pctfree":10, "load_type":0, "index_using_type":0, "def_type":1, "charset_type":2, "collation_type":45, "create_mem_version":0, "index_status":1, "partition_status":0, "code_version":1, "last_modified_frozen_version":0, "comment":"", "zone_replica_num_array":[], "region_replica_num_array":[], "tablegroup_name":"", "compress_func_name":"lz4_1.0", "expire_info":"", "view_schema":{"view_definition":"", "check_option":"none", "is_updatable":"false", "is_materialized":"false"}, "autoinc_column_id":0, "auto_increment":1, "read_only":false, "primary_zone_array":[], "index_tid_array":[], "mv_tid_array":[], "base_table_ids":[], "rowkey_info":{"columns":[{"length":0, "column_id":1, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":4, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":5, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}], "capacity":3}, "partition_key_info":{"columns":null, "capacity":0}}, "index_arg_list":[], "constraint_list":[], "db_name":"cte_db"}, "index_arg_list":[]} *************** Case 5 *************** create table t1(c1 int, c2 int, c3 int); {"ObTableStmt":{"partition_fun_expr":[], "range_values_exprs":[], "list_values_exprs":[], "index_partition_resolve_results":[], "part_type":8}, "stmt_type":20, "create_table_arg":{"if_not_exist":false, "schema":{"simple_table_schema":{"tenant_id":1, "database_id":18446744073709551615, "tablegroup_id":1099511627777, "table_id":18446744073709551615, "table_name":"t1", "replica_num":0, "previous_locality_str":"", "min_partition_id":0, "index_type":0, "table_type":3, "data_table_id":0, "name_casemode":-1, "schema_version":0, "part_level":0, "part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":0}, "sub_part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":-1}, "locality_str":"", "zone_list":[], "primary_zone":"", "part_num":0, "subpart_num":0, "partition_num":1, "subpartition_num":0, "partition_array":[{"tenant_id":18446744073709551615, "table_id":18446744073709551615, "part_id":0, "name":"p0", "high_bound_val":, "list_row_values":[], "part_idx":0}], "subpartition_array":null, "index_status":1}, "max_used_column_id":18, "max_used_constraint_id":0, "rowkey_column_num":3, "index_column_num":0, "rowkey_split_pos":0, "block_size":16384, "is_use_bloomfilter":false, "progressive_merge_num":0, "tablet_size":134217728, "pctfree":10, "load_type":0, "index_using_type":0, "def_type":1, "charset_type":2, "collation_type":45, "create_mem_version":0, "index_status":1, "partition_status":0, "code_version":1, "last_modified_frozen_version":0, "comment":"", "zone_replica_num_array":[], "region_replica_num_array":[], "tablegroup_name":"", "compress_func_name":"lz4_1.0", "expire_info":"", "view_schema":{"view_definition":"", "check_option":"none", "is_updatable":"false", "is_materialized":"false"}, "autoinc_column_id":0, "auto_increment":1, "read_only":false, "primary_zone_array":[], "index_tid_array":[], "mv_tid_array":[], "base_table_ids":[], "rowkey_info":{"columns":[{"length":0, "column_id":1, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":4, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":5, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}], "capacity":3}, "partition_key_info":{"columns":null, "capacity":0}}, "index_arg_list":[], "constraint_list":[], "db_name":"cte_db"}, "index_arg_list":[]} *************** Case 6 *************** create table t2(c1 int, c2 int); {"ObTableStmt":{"partition_fun_expr":[], "range_values_exprs":[], "list_values_exprs":[], "index_partition_resolve_results":[], "part_type":8}, "stmt_type":20, "create_table_arg":{"if_not_exist":false, "schema":{"simple_table_schema":{"tenant_id":1, "database_id":18446744073709551615, "tablegroup_id":1099511627777, "table_id":18446744073709551615, "table_name":"t2", "replica_num":0, "previous_locality_str":"", "min_partition_id":0, "index_type":0, "table_type":3, "data_table_id":0, "name_casemode":-1, "schema_version":0, "part_level":0, "part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":0}, "sub_part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":-1}, "locality_str":"", "zone_list":[], "primary_zone":"", "part_num":0, "subpart_num":0, "partition_num":1, "subpartition_num":0, "partition_array":[{"tenant_id":18446744073709551615, "table_id":18446744073709551615, "part_id":0, "name":"p0", "high_bound_val":, "list_row_values":[], "part_idx":0}], "subpartition_array":null, "index_status":1}, "max_used_column_id":17, "max_used_constraint_id":0, "rowkey_column_num":3, "index_column_num":0, "rowkey_split_pos":0, "block_size":16384, "is_use_bloomfilter":false, "progressive_merge_num":0, "tablet_size":134217728, "pctfree":10, "load_type":0, "index_using_type":0, "def_type":1, "charset_type":2, "collation_type":45, "create_mem_version":0, "index_status":1, "partition_status":0, "code_version":1, "last_modified_frozen_version":0, "comment":"", "zone_replica_num_array":[], "region_replica_num_array":[], "tablegroup_name":"", "compress_func_name":"lz4_1.0", "expire_info":"", "view_schema":{"view_definition":"", "check_option":"none", "is_updatable":"false", "is_materialized":"false"}, "autoinc_column_id":0, "auto_increment":1, "read_only":false, "primary_zone_array":[], "index_tid_array":[], "mv_tid_array":[], "base_table_ids":[], "rowkey_info":{"columns":[{"length":0, "column_id":1, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":4, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}, {"length":0, "column_id":5, "type":{"type":"BIGINT UNSIGNED", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}], "capacity":3}, "partition_key_info":{"columns":null, "capacity":0}}, "index_arg_list":[], "constraint_list":[], "db_name":"cte_db"}, "index_arg_list":[]} *************** Case 7 *************** create table t3(c3 int primary key, c4 int); {"ObTableStmt":{"partition_fun_expr":[], "range_values_exprs":[], "list_values_exprs":[], "index_partition_resolve_results":[], "part_type":8}, "stmt_type":20, "create_table_arg":{"if_not_exist":false, "schema":{"simple_table_schema":{"tenant_id":1, "database_id":18446744073709551615, "tablegroup_id":1099511627777, "table_id":18446744073709551615, "table_name":"t3", "replica_num":0, "previous_locality_str":"", "min_partition_id":0, "index_type":0, "table_type":3, "data_table_id":0, "name_casemode":-1, "schema_version":0, "part_level":0, "part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":0}, "sub_part_option":{"part_func_type":0, "part_func_expr":"", "part_num":1, "partition_cnt_within_partition_table":-1, "max_used_part_id":-1}, "locality_str":"", "zone_list":[], "primary_zone":"", "part_num":0, "subpart_num":0, "partition_num":1, "subpartition_num":0, "partition_array":[{"tenant_id":18446744073709551615, "table_id":18446744073709551615, "part_id":0, "name":"p0", "high_bound_val":, "list_row_values":[], "part_idx":0}], "subpartition_array":null, "index_status":1}, "max_used_column_id":17, "max_used_constraint_id":0, "rowkey_column_num":1, "index_column_num":0, "rowkey_split_pos":0, "block_size":16384, "is_use_bloomfilter":false, "progressive_merge_num":0, "tablet_size":134217728, "pctfree":10, "load_type":0, "index_using_type":0, "def_type":1, "charset_type":2, "collation_type":45, "create_mem_version":0, "index_status":1, "partition_status":0, "code_version":1, "last_modified_frozen_version":0, "comment":"", "zone_replica_num_array":[], "region_replica_num_array":[], "tablegroup_name":"", "compress_func_name":"lz4_1.0", "expire_info":"", "view_schema":{"view_definition":"", "check_option":"none", "is_updatable":"false", "is_materialized":"false"}, "autoinc_column_id":0, "auto_increment":1, "read_only":false, "primary_zone_array":[], "index_tid_array":[], "mv_tid_array":[], "base_table_ids":[], "rowkey_info":{"columns":[{"length":0, "column_id":16, "type":{"type":"INT", "collation":"binary", "coercibility":"NUMERIC"}, "order":0, "fulltext_flag":true}], "capacity":1}, "partition_key_info":{"columns":null, "capacity":0}}, "index_arg_list":[], "constraint_list":[], "db_name":"cte_db"}, "index_arg_list":[]} *************** Case 8 *************** with cte(a) as (select count(c1) from t2 group by c2 limit 5) select * from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t2", "alias_name":"t2", "synonym_name":"", "table_type":1, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_COLUMN", "CNT_AGG" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ], "distinct":false, "order_by": [ ], "separator_param_expr":null }, "is_alias":true, "alias_name":"a", "expr_name":"count(c1)", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ], "having": [ ], "aggr_func": [ { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_COLUMN", "CNT_AGG" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ], "distinct":false, "order_by": [ ], "separator_param_expr":null } ], "order_by": [ ], "limit": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":5 } }, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 9 *************** WITH cte1 AS (SELECT c1, c2 FROM t1) select c1 from cte1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 10 *************** WITH cte1 AS (SELECT c1, c2 FROM t1) select c1 from cte1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 11 *************** WITH cte1 (name1, name2) AS (select c1, c2 from t1) select name1 from cte1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"name1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"name1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"name1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name1", "expr_name":"name1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"name1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"name2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 12 *************** WITH cte1 AS (SELECT c1, c2 FROM t1), cte2 AS (SELECT c1, c2 FROM t2) select c1 from cte2; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"t2", "alias_name":"t2", "synonym_name":"", "table_type":1, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 13 *************** WITH cte1 AS (select * from t1) select c1, c2 from cte1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-3, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 14 *************** WITH cte1 (c1)AS(select c1 from t1), cte2 AS (select * from t1) select c1, c2 from cte2; { "stmt_type":1, "table": [ { "table_id":-7, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-7, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-7, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-7, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-5, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 15 *************** WITH cte0 AS ( select * from t1) select * from cte0 for update; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte0", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":true, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-5, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"cte0", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-3, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 16 *************** with cte as (select count(*) from t1) select * from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"count(*)", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"count(*)", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"count(*)", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"count(*)", "expr_name":"count(*)", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null }, "is_alias":false, "alias_name":"count(*)", "expr_name":"count(*)", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null } ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 17 *************** with cte as (select count(*) as k from t1) select * from cte where k = 1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"k", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"k", "expr_name":"k", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null }, "is_alias":true, "alias_name":"k", "expr_name":"count(*)", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null } ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 18 *************** with cte (k1) as (select count(*) as k from t1) select * from cte where k1 = 1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"k1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"k1", "expr_name":"k1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"k1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null }, "is_alias":true, "alias_name":"k1", "expr_name":"count(*)", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ { "item_type":"T_FUN_COUNT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_AGG", "CNT_AGG" ], "rel_id": [ 0 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ ], "distinct":false, "order_by": [ ], "separator_param_expr":null } ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 19 *************** with cte1 (c22, c21) AS (select c1, c2 from t1) select c22 as c21, c21 from cte1 where c21 = 12; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":17, "table_id":-5, "column":"c21", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c21", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"c22", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c22", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c22", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c21", "expr_name":"c22", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c21", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c21", "expr_name":"c21", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c21", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":2, "precision":2, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c22", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c21", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 20 *************** with cte1 AS( select * from t1)select * from cte1 left join t2 on cte1.c1=t2.c1 having not (t2.c1 <=> cte1.c1) order by cte1.c1; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":1099511677879, "table_name":"t2", "alias_name":"", "synonym_name":"", "table_type":0, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ { "table_id":-3, "table_type":3, "join_type":"OUTER JOIN", "left_table": { "table_id":-6, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "right_table": { "table_id":1099511677879, "table_name":"t2", "alias_name":"", "synonym_name":"", "table_type":0, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, "join_condition": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":4, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] } ] } ] } ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":4, "enum_set_values": [ ] } }, { "column_id":16, "table_id":1099511677879, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-6, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":18, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":1099511677879, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":4, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":18, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":true } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ { "item_type":"T_OP_NOT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_NOT", "CNT_COLUMN", "CNT_NOT" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_OP_NSEQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":1099511677879, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":4, "enum_set_values": [ ] } ] } ] } ], "aggr_func": [ ], "order_by": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":4, "enum_set_values": [ ] }, "ascending":"ASC" } ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 21 *************** WITH cte1 (a, b) AS (SELECT c1, c2 FROM t1), cte2 (c, d) AS (SELECT c1, c2 FROM t2) select * from (with cte2 as(select * from t3) select c3 as c11, c4 from cte2) cte1 join cte2 on cte1.c11=cte2.c; { "stmt_type":1, "table": [ { "table_id":-9, "table_name":"cte1", "alias_name":"cte1", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-12, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ { "table_id":-4, "table_type":3, "join_type":"JOIN", "left_table": { "table_id":-9, "table_name":"cte1", "alias_name":"cte1", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "right_table": { "table_id":-12, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "join_condition": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] } ] } ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-9, "column":"c11", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-12, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-9, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-12, "column":"d", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c11", "expr_name":"c11", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"d", "expr_name":"d", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":true } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c11", "expr_name":"c3", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"t3", "alias_name":"t3", "synonym_name":"", "table_type":1, "ref_id":1099511677880, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, { "stmt_type":1, "table": [ { "table_id":-10, "table_name":"t2", "alias_name":"t2", "synonym_name":"", "table_type":1, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-10, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-10, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"d", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-10, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 22 *************** WITH cte1 (a, b) AS (SELECT c1, c2 FROM t1), cte2 (c, d) AS (SELECT c1, c2 FROM t2) select * from cte1 left join cte2 on cte1.a=cte2.c having not (cte1.b <=> cte2.d) order by cte1.a; { "stmt_type":1, "table": [ { "table_id":-7, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-10, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ { "table_id":-4, "table_type":3, "join_type":"OUTER JOIN", "left_table": { "table_id":-7, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "right_table": { "table_id":-10, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "join_condition": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] } ] } ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-7, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-10, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-7, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-10, "column":"d", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"d", "expr_name":"d", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":true } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ { "item_type":"T_OP_NOT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_NOT", "CNT_COLUMN", "CNT_NOT" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_OP_NSEQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-10, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] } ] } ], "aggr_func": [ ], "order_by": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":3, "enum_set_values": [ ] }, "ascending":"ASC" } ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"a", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"b", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"t2", "alias_name":"t2", "synonym_name":"", "table_type":1, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"d", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 23 *************** WITH cte(hello) AS (SELECT c1 FROM t1 UNION ALL select hello from cte) search depth first by hello set abc select hello, abc from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"abc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"abc", "expr_name":"abc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"hello", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"abc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 24 *************** WITH cte(n) AS (SELECT c1 FROM t1 UNION ALL select n+1 from cte where n < 10) search depth first by n set a select n from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":12, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n+1", "expr_name":"n+1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":2, "precision":2, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":12, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"a", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 25 *************** with cte(n) as (select 1 from dual union all select n+1 from cte where n < 2) select n from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM", "IS_DYNAMIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-3, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n+1", "expr_name":"n+1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 26 *************** with cte(n) as (select 1 from dual union all select n+1 from cte where n < 2) search depth first by n set abc select n,abc from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"abc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"abc", "expr_name":"abc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM", "IS_DYNAMIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-3, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n+1", "expr_name":"n+1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"abc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 27 *************** explain with cte (a,b,c) as ( select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a ) search depth first by a set sad select * from cte; { "explain_stmt": { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-8, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-8, "column":"sad", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"sad", "expr_name":"sad", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-6, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-5, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-6, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false }, { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"sad", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } } *************** Case 28 *************** WITH cte(n) AS (SELECT c1 FROM t1 UNION ALL select n from cte) search depth first by n set a_name cycle n set iscyc to 'n' default 'y' select n from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"a_name", "expr_name":"", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_CYCLE_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"iscyc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 29 *************** WITH cte(n) AS (SELECT c1 FROM t1 UNION ALL select n from cte) search depth first by n set a_name select n from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"a_name", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 30 *************** WITH cte(n) AS (SELECT c1 FROM t1 UNION ALL select n from cte) select n from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"c1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 31 *************** WITH fibonacci (n, fib_n, next_fib_n) AS ( SELECT 1, 0, 1 from dual UNION ALL SELECT n + 1, next_fib_n, fib_n + next_fib_n FROM fibonacci WHERE n < 10 ) SELECT * FROM fibonacci; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"fibonacci", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"fib_n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-5, "column":"next_fib_n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"fib_n", "expr_name":"fib_n", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"next_fib_n", "expr_name":"next_fib_n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":3, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 }, { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":2 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM", "IS_DYNAMIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":0 } }, "is_alias":false, "alias_name":"0", "expr_name":"0", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM", "IS_DYNAMIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":2 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":3, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 }, { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":2 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"fibonacci", "alias_name":"fibonacci", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-3, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330002, "table_id":-3, "column":"next_fib_n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330002, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330001, "table_id":-3, "column":"fib_n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330001, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n + 1", "expr_name":"n + 1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330002, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"next_fib_n", "expr_name":"next_fib_n", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330001, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330002, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"fib_n + next_fib_n", "expr_name":"fib_n + next_fib_n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":2, "precision":2, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":3, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 }, { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":2 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":0 } }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330002, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"fib_n", "expr_name":"0", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330001, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330002, "database_name":"cte_db", "table_name":"fibonacci", "synonym_name":"", "column_name":"next_fib_n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"next_fib_n", "expr_name":"1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 32 *************** WITH cte(hello) AS (SELECT c1 FROM t1 UNION ALL select hello from cte) search depth first by hello set abc select hello, abc from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"abc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"abc", "expr_name":"abc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"hello", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"abc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 33 *************** WITH cte(hello) AS (SELECT c1 FROM t1 UNION ALL select hello from cte) search depth first by hello set abc select * from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"abc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"abc", "expr_name":"abc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"hello", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"abc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 34 *************** WITH cte(hello) AS (SELECT c1 FROM t1 UNION ALL select hello+1 from cte where hello < 5) search depth first by hello set abc select hello, abc from cte; { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"abc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello", "expr_name":"hello", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"abc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"abc", "expr_name":"abc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-4, "column":"hello", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":12, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"hello+1", "expr_name":"hello+1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":12, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"hello", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"hello", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"abc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 35 *************** with cte (a,b,c) as (select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a) search breadth first by a set sad select * from cte; { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-8, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-8, "column":"sad", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"sad", "expr_name":"sad", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-6, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-5, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-6, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false }, { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"sad", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 36 *************** with cte (a,b,c) as (select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a) cycle a set iscyc to 'n' default 'y' select * from cte; { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-8, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-8, "column":"iscyc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"iscyc", "expr_name":"iscyc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-6, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-5, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-6, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false }, { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_CYCLE_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"iscyc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 37 *************** explain with cte (a,b,c) as ( select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a ) cycle a set iscyc to 'n' default 'y' select * from cte; { "explain_stmt": { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-8, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-8, "column":"iscyc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"iscyc", "expr_name":"iscyc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-6, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-5, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-6, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false }, { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_CYCLE_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"iscyc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } } *************** Case 38 *************** with cte (a,b,c) as ( select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a ) cycle c set iscyc to 'n' default 'y' select * from cte; { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-8, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-8, "column":"iscyc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"iscyc", "expr_name":"iscyc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-4, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-4, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-6, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-5, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-6, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-5, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false }, { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-6, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_CYCLE_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"iscyc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 39 *************** with cte(n) as (select 1 from dual) search depth first by n set abc select * from cte; { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 40 *************** WITH cte1 AS (SELECT c1, c2 FROM t1) select c1 from cte1; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"t1", "alias_name":"t1", "synonym_name":"", "table_type":1, "ref_id":1099511677878, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c1", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"t1", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c2", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 41 *************** with cte(a) as (select 1 from dual union all select 2 from dual), cte_1(b) as (select 1 from dual union all select * from cte) select * from cte_1; { "stmt_type":1, "table": [ { "table_id":-9, "table_name":"cte_1", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-9, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte_1", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte_1", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-9, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-7, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-7, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-7, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":2 } }, "is_alias":false, "alias_name":"2", "expr_name":"2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":2 } } ] }, "is_alias":true, "alias_name":"a", "expr_name":"1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-7, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 42 *************** WITH cte1 (a, b) AS (SELECT c1, c2 FROM t1), cte2 (c, d) AS (SELECT c1, c2 FROM t2) select * from (with cte2 as(select * from t3) select c3 as c11, c4 from cte2) cte1 join cte2 on cte1.c11=cte2.c; { "stmt_type":1, "table": [ { "table_id":-9, "table_name":"cte1", "alias_name":"cte1", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-12, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ { "table_id":-4, "table_type":3, "join_type":"JOIN", "left_table": { "table_id":-9, "table_name":"cte1", "alias_name":"cte1", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "right_table": { "table_id":-12, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 }, "join_condition": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] } ] } ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-9, "column":"c11", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-12, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-9, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-12, "column":"d", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":16, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c11", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c11", "expr_name":"c11", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-9, "column_id":17, "database_name":"", "table_name":"cte1", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"d", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"d", "expr_name":"d", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":true } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-8, "table_name":"cte2", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-8, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-8, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":16, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c11", "expr_name":"c3", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-8, "column_id":17, "database_name":"", "table_name":"cte2", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-8, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-6, "table_name":"t3", "alias_name":"t3", "synonym_name":"", "table_type":1, "ref_id":1099511677880, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-6, "column":"c3", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-6, "column":"c4", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":16387, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":16, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c3", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c3", "expr_name":"c3", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-6, "column_id":17, "database_name":"cte_db", "table_name":"t3", "synonym_name":"", "column_name":"c4", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c4", "expr_name":"c4", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-6, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, { "stmt_type":1, "table": [ { "table_id":-10, "table_name":"t2", "alias_name":"t2", "synonym_name":"", "table_type":1, "ref_id":1099511677879, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-10, "column":"c1", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-10, "column":"c2", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c1", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c", "expr_name":"c1", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"t2", "synonym_name":"", "column_name":"c2", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"d", "expr_name":"c2", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-10, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 43 *************** with cte(n) as ( select 1 from dual union all select n+1 from cte where n < 10 ) search depth first by a set abc select * from cte; *************** Case 44 *************** with cte(n) as (select 1 from dual) search depth first by n set abc select * from cte; { "stmt_type":1, "table": [ { "table_id":-4, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-4, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-4, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-4, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 45 *************** with cte(a,b,c) as (select * from emp) search depth first by a set abc select * from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-5, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-5, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-3, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-3, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-3, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":0, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 46 *************** with cte(n, x) as (select * from t1) cycle n set iscyc to 'y' default 'n' select * from cte; *************** Case 47 *************** with cte(n) as (select 1 union all select n+1 from cte where n < 23) select n from cte; { "stmt_type":1, "table": [ { "table_id":-5, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-5, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-5, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n", "expr_name":"n", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-5, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ ], "joined_table": [ ], "partition_express": [ ], "column": [ ], "select": [ { "expression": { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM", "IS_DYNAMIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":1 } }, "is_alias":false, "alias_name":"1", "expr_name":"1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-3, "table_name":"cte", "alias_name":"cte", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":22330000, "table_id":-3, "column":"n", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "is_alias":false, "alias_name":"n+1", "expr_name":"n+1", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-3, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_LT", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_RANGE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":2, "precision":2, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":2, "fetch_cur_time":true, "calculable_items": [ { "expression": { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, "idx":1 } ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_FUNC", "IS_CALCULABLE_EXPR", "IS_CONST_EXPR", "CNT_CONST", "CNT_FUNC", "CNT_CALCULABLE_EXPR" ], "rel_id": [ ], "expr_levels": [ ], "func":"cast", "children": [ { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] }, { "item_type":"T_FUN_SYS_CAST", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_FUNC", "CNT_CONST", "CNT_COLUMN", "CNT_FUNC" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "func":"cast", "children": [ { "item_type":"T_OP_ADD", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":2, "scale":0 }, "flag":0, "calc_type": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-3, "column_id":22330000, "database_name":"cte_db", "table_name":"cte", "synonym_name":"", "column_name":"n", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":1 } } ] }, { "item_type":"T_INT", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "CNT_CONST" ], "rel_id": [ ], "value": { "BIGINT":85903474693 } } ], "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"n", "expr_name":"1", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 48 *************** with cte(n) AS ( select 1 from cte) select * from cte; *************** Case 49 *************** with cte(n) AS (select 1 from dual UNION ALL select n+1 from (select * from cte) ct1 where n < 3) select * from cte; *************** Case 50 *************** with cte(n) AS ( select 1 from dual UNION ALL select sum(n+1) from cte) select * from cte; *************** Case 51 *************** with cte(n) as (select 1 from dual union all select c1 from t1 union all (with cte(n) as (select c1 from t1) select * from cte)) select * from cte; *************** Case 52 *************** with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 union all select n+1 from cte where n < 2) select * from cte; *************** Case 53 *************** with cte(n) as (select n from (select 1 from dual union all select n+1 from cte) tmp) select * from cte; *************** Case 54 *************** with cte(n) AS (select 1 from cte UNION all select n+1 from cte where n < 3) select * from cte; *************** Case 55 *************** with cte(n) as (select n+1 from cte where n < 5 union all select c1 from t1) select * from cte; *************** Case 56 *************** with cte(n) as (select 1 from dual union all select * from (select n from cte where n < 5) tmp) select * from cte; *************** Case 57 *************** with cte(n) AS (select 1 from dual UNION ALL select n+1 from cte where n < 3 order by n ) select * from cte; *************** Case 58 *************** with cte_recursive (a,b,c) as ( select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte_recursive where emp.leaderid = cte_recursive.A ) search depth first by a set sad cycle b set iscyc to 'y' default 'n', cte as (select * from cte_recursive) select * from cte; { "stmt_type":1, "table": [ { "table_id":-16, "table_name":"cte", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-16, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-16, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-16, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-16, "column":"sad", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":20, "table_id":-16, "column":"iscyc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":20, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":16, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":17, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":18, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":19, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"sad", "expr_name":"sad", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-16, "column_id":20, "database_name":"", "table_name":"cte", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"iscyc", "expr_name":"iscyc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-16, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "stmt_type":1, "table": [ { "table_id":-14, "table_name":"cte_recursive", "alias_name":"", "synonym_name":"", "table_type":2, "ref_id":-1, "database_name":"", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-14, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":16, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-14, "column":"b", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":17, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-14, "column":"c", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":18, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":19, "table_id":-14, "column":"sad", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":19, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":20, "table_id":-14, "column":"iscyc", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":20, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":16, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"a", "expr_name":"a", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":17, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"b", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"b", "expr_name":"b", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":18, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"c", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"c", "expr_name":"c", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":19, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"sad", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"sad", "expr_name":"sad", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-14, "column_id":20, "database_name":"", "table_name":"cte_recursive", "synonym_name":"", "column_name":"iscyc", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"iscyc", "expr_name":"iscyc", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-14, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ { "set_op":1, "distinct":false, "left_query": { "stmt_type":1, "table": [ { "table_id":-10, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":16, "table_id":-10, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-10, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":18, "table_id":-10, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-10, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_CONST", "CNT_COLUMN", "CNT_STATIC_PARAM", "IS_SIMPLE_COND" ], "rel_id": [ 1 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_QUESTIONMARK", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":1, "precision":1, "scale":0 }, "flag":1, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_CONST", "IS_STATIC_PARAM", "CNT_CONST", "CNT_STATIC_PARAM" ], "rel_id": [ ], "value": { "UNKNOWN":0 } } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "right_query": { "stmt_type":1, "table": [ { "table_id":-11, "table_name":"emp", "alias_name":"emp", "synonym_name":"", "table_type":1, "ref_id":1099511677877, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 }, { "table_id":-12, "table_name":"cte_recursive", "alias_name":"cte_recursive", "synonym_name":"", "table_type":4, "ref_id":49500, "database_name":"cte_db", "for_update":false, "wait":-1, "mock_id":-1 } ], "joined_table": [ ], "partition_express": [ ], "column": [ { "column_id":18, "table_id":-11, "column":"leaderid", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } }, { "column_id":22330000, "table_id":-12, "column":"a", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":22330000, "database_name":"cte_db", "table_name":"cte_recursive", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":16, "table_id":-11, "column":"id", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } }, { "column_id":17, "table_id":-11, "column":"name", "auto_filled_timestamp":false, "default_value": { "NULL":"NULL" }, "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } } ], "select": [ { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"id", "expr_name":"emp.id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"name", "expr_name":"emp.name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, "is_alias":false, "alias_name":"leaderid", "expr_name":"emp.leaderid", "default": { "NULL":"NULL" } } ], "distinct":false, "rollup":false, "nocycle":false, "from": [ { "table_id":-11, "is_join":false }, { "table_id":-12, "is_join":false } ], "start_with": [ ], "connect_by": [ ], "where": [ { "item_type":"T_OP_EQ", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":1, "scale":0 }, "flag":0, "calc_type": { "type":"DECIMAL", "collation":"binary", "coercibility":"NUMERIC" } }, "expr_info": [ "CNT_COLUMN", "IS_JOIN_COND" ], "rel_id": [ 1, 2 ], "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 2 ], "table_id":-12, "column_id":22330000, "database_name":"cte_db", "table_name":"cte_recursive", "synonym_name":"", "column_name":"a", "expr_level":0, "expr_levels": [ 0 ], "column_flags":4, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] } ], "group_by": [ ], "having": [ ], "aggr_func": [ ], "order_by": [ ], "limit":null, "offset":null, "show_stmt_ctx": { "is_from_show_stmt":false, "global_scope":false, "tenant_id":-1, "show_database_id":-1, "show_table_id":-1, "grants_user_id":-1 }, "hint": { "read_static":false, "no_rewrite":false, "frozen_version":-1, "topk_precision":-1, "sharding_minimum_row_count":0, "query_timeout":-1, "hotspot":false, "index": [ ], "read_consistency":-1, "join_ordered":false, "join_order": [ ], "merge_hint_ids": [ ], "hash_hint_ids": [ ], "no_hash_hint_ids": [ ], "nl_hint_ids": [ ], "part_hints": [ ], "use_late_materialization":-1, "log_level":"", "max_concurrent":-1, "only_concurrent_hint":false, "has_hint_exclude_concurrent":false, "parallel":-1 }, "query_context": { "param_num":1, "fetch_cur_time":true, "calculable_items": [ ] }, "extra_output_exprs": [ ], "current_level":0, "equal_sets": [ ], "pseudo_column_exprs": [ ], "child_stmts": [ ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false }, "order_by": [ ], "limit":null, "select": [ { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":16, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"id", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"a", "expr_name":"id", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"utf8mb4_general_ci", "coercibility":"IMPLICIT" }, "accuracy": { "length":20, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":17, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"name", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"b", "expr_name":"name", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_OP_UNION", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_SET_OP", "CNT_SET_OP" ], "rel_id": [ 1 ], "expr_level":0, "expr_levels": [ 0 ], "children": [ { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-10, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":1, "enum_set_values": [ ] }, { "item_type":"T_REF_COLUMN", "result_type": { "meta": { "type":"INT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":11, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_COLUMN", "CNT_COLUMN" ], "rel_id": [ 1 ], "table_id":-11, "column_id":18, "database_name":"cte_db", "table_name":"emp", "synonym_name":"", "column_name":"leaderid", "expr_level":0, "expr_levels": [ 0 ], "column_flags":0, "is_explicited_referece":true, "explicited_ref_count":2, "enum_set_values": [ ] } ] }, "is_alias":true, "alias_name":"c", "expr_name":"leaderid", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_SEARCH_COLUMN", "result_type": { "meta": { "type":"BIGINT", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":0, "precision":20, "scale":0 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"sad", "expr_name":"", "default": { "NULL":"NULL" } }, { "expression": { "item_type":"T_CTE_CYCLE_COLUMN", "result_type": { "meta": { "type":"VARCHAR", "collation":"binary", "coercibility":"NUMERIC" }, "accuracy": { "length":-1, "precision":-1, "scale":-1 }, "flag":0, "calc_type": { "type":"NULL", "collation":"invalid_type", "coercibility":"INVALID" } }, "expr_info": [ "IS_PSEUDO_COLUMN", "CNT_PSEUDO_COLUMN" ], "rel_id": [ ], "expr_level":0, "expr_levels": [ ], "copy_expr":null, "enum_set_values": [ ] }, "is_alias":true, "alias_name":"iscyc", "expr_name":"", "default": { "NULL":"NULL" } } ] } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } ], "has_transformed_for_hierarchical_query":false, "is_hierarchical_query":false } *************** Case 59 *************** select * from (with cte as (select * from t2) select * from cte) t3, cte where t3.c21 = cte.c1; *************** Case 60 *************** with cte(a,b,c) as ( select c1,c2,c3 from not_exist where not_exist.c1 < 20 union all select c1,c2,c3 from not_exist, cte where cte.a = not_exist.c1 and cte.c < 10 ) select * from cte; *************** Case 61 *************** with cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte right join t2 on cte.n < 3 and t2.c1 < 22) select * from cte; *************** Case 62 *************** with cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 left join cte on cte.n < 3 and t2.c1 < 22) select * from cte; *************** Case 63 *************** with cte(n) AS (select c1 from t1 UNION ALL select n+1 from t2 full join cte on cte.n < 3 and t2.c1 < 22) select * from cte; *************** Case 64 *************** with cte(n) AS (select c1 from t1 UNION ALL select n+1 from cte full join t2 on cte.n < 3 and t2.c1 < 22) select * from cte; *************** Case 65 *************** with cte (a,b,c) as (select id, name, leaderid from emp where emp.id = 1 union all select emp.id ,emp.name, emp.leaderid from emp, cte where emp.leaderid = cte.a) search depth first by a set abc cycle a set abc to 'y' default 'n' select * from cte;