Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Duplicate
-
v3.1.0
-
None
Description
如果聚合函数中是常量(字符串或数字)时,报cube未命中的错误。
通过在DefaultQueryTransformer中正则匹配转换可以解决部分问题,如max('aaa')=>'aaa',sum(10)=>10*count(1).
但是怎么样从后端解决呢?因为从前端通过正则替换的方式解决会面临一些问题,如SUM(cast(1.22 as bigint))) 会替换为1.22*count(1),没有达到数据转换cast的效果,当然也可以匹配出bigint从前端做转换,但总觉得在后端做会更好更彻底。在某些查询场景下,这类SQL无法避免。
test cube "KYLINS_SALES_CUBE"
test sql:
select ops_region,
max('AAA'),
min('AAA'),
sum(10)
from kylin_sales
group by ops_region
error log:
No realization found for OLAPContext, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_UNMATCHED_AGGREGATION[FunctionDesc [expression=MIN, parameter=UNKNOWN_MODEL:DEFAULT._KYLIN_TABLE.AAA, returnType=null], FunctionDesc [expression=MAX, parameter=UNKNOWN_MODEL:DEFAULT._KYLIN_TABLE.AAA, returnType=null]], CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, CUBE_NOT_READY, rel#482:OLAPTableScan.OLAP.[](table=[DEFAULT, KYLIN_SALES],ctx=,fields=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12]) while executing SQL: "select ops_region, max('AAA'), min('AAA'), 10*count(1) from kylin_sales group by ops_region"
Attachments
Attachments
Issue Links
- is duplicated by
-
KYLIN-4832 No realization found error when max/min param is expression
- Open