附上执行计划:
-- 第一段执行结果正确
explain verbose
select * from
( select '1' as c_flag,'one' as c_result
union all
select '2' as c_flag,'two' as c_result
) t where t.c_flag = '1';
PLAN FRAGMENT 0
OUTPUT EXPRS:
c_flag
c_result
PARTITION: UNPARTITIONED
HAS_COLO_PLAN_NODE: false
VRESULT SINK
MYSQL_PROTOCAL
1:VSELECT
| predicates: (c_flag = '1')
| tuple ids: 0
|
0:VUNION
constant exprs:
'1' | 'one'
'2' | 'two'
tuple ids: 0
Tuples:
TupleDescriptor{id=0, tbl=null}
SlotDescriptor{id=0, col=null, colUniqueId=null, type=varchar(65533), nullable=false, isAutoIncrement=false, subColPath=null}
SlotDescriptor{id=1, col=null, colUniqueId=null, type=varchar(65533), nullable=false, isAutoIncrement=false, subColPath=null}
-- 第二段,执行结果异常
explain verbose
select * from
( select '1' as c_flag,'one' as c_result
union all
select '2' as c_flag,'two' as c_result
) t where t.c_flag = '2'
PLAN FRAGMENT 0
OUTPUT EXPRS:
c_flag
c_result
PARTITION: UNPARTITIONED
HAS_COLO_PLAN_NODE: false
VRESULT SINK
MYSQL_PROTOCAL
4:VEMPTYSET
tuple ids: 0
Tuples:
TupleDescriptor{id=0, tbl=null}
SlotDescriptor{id=0, col=null, colUniqueId=null, type=varchar(65533), nullable=false, isAutoIncrement=false, subColPath=null}
SlotDescriptor{id=1, col=null, colUniqueId=null, type=varchar(65533), nullable=false, isAutoIncrement=false, subColPath=null}