kylin-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "奥威软件" <3513797...@qq.com>
Subject cast 异常问题:使用cast后报错,不使用cast却正常执行,
Date Wed, 03 Apr 2019 02:19:59 GMT
Hi,
1.正常查询的语句:
SELECT
DEPARTMENT.DEPARTMENTNAME AS "门店",
SUM(ICSTOCKBILL_1W.TOTALMONEY) AS "成本",
SUM(ICSTOCKBILL_1W.TOTALDECIMAL) AS "收入" 
FROM ICSTOCKBILL_1W 
INNER JOIN DEPARTMENT 
ON ICSTOCKBILL_1W.DEPARTMENTID = DEPARTMENT.DEPARTMENTID
INNER JOIN  (
select * from T_RIGHT_POWERBI_ROLE as R1
where R1.FTABLEID = 'suppmarket2005_cw_test.department' 
AND R1.FROLEID = 'role62e707b95f1511e89246cb029cf035cd' 
AND R1.FDSVID = 'view-b528c240-8155-11e7-9647-1b109f7783f6'
) as f2
ON  DEPARTMENT.DEPARTMENTNAME = f2.FDIMID 
GROUP BY DEPARTMENT.DEPARTMENTNAME 
ORDER BY DEPARTMENT.DEPARTMENTNAME;

有查询结果,如下图:

2.添加cast 后就报错了
SELECT
DEPARTMENT.DEPARTMENTNAME AS "门店",
SUM(ICSTOCKBILL_1W.TOTALMONEY) AS "成本",
SUM(ICSTOCKBILL_1W.TOTALDECIMAL) AS "收入" 
FROM ICSTOCKBILL_1W 
INNER JOIN DEPARTMENT 
ON ICSTOCKBILL_1W.DEPARTMENTID = DEPARTMENT.DEPARTMENTID
INNER JOIN  (
select * from T_RIGHT_POWERBI_ROLE as R1
where R1.FTABLEID = 'suppmarket2005_cw_test.department' 
AND R1.FROLEID = 'role62e707b95f1511e89246cb029cf035cd' 
AND R1.FDSVID = 'view-b528c240-8155-11e7-9647-1b109f7783f6'
) as f2

ON CAST(DEPARTMENT.DEPARTMENTNAME AS VARCHAR(300)) = f2.FDIMID 
GROUP BY DEPARTMENT.DEPARTMENTNAME 
ORDER BY DEPARTMENT.DEPARTMENTNAME;


Best regards


错误信息:
2019-04-03 09:29:02,954 ERROR [http-nio-7070-exec-7] controller.BasicController:63 : 
org.apache.kylin.rest.exception.InternalErrorException: No model found for OLAPContext, CUBE_NOT_READY,
CUBE_NOT_CONTAIN_ALL_COLUMN[1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_SUM_ICSTOCKBILL_1W_QUANTITY_,
1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_SUM_ICSTOCKBILL_1W_TOTALMONEY_, 1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_SUM_ICSTOCKBILL_1W_SALEPRICE_,
1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_SUM_ICSTOCKBILL_1W_PRICE_, 1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_SUM_ICSTOCKBILL_1W_TOTALDECIMAL_,
1_738a657b:DEFAULT.ICSTOCKBILL_1W._KY_COUNT__], rel#19685:OLAPTableScan.OLAP.[](table=[DEFAULT,
ICSTOCKBILL_1W],ctx=,fields=[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17]),
JoinDesc [type=INNER, primary_key=[DEPARTMENTID], foreign_key=[DEPARTMENTID]]
while executing SQL: "...



请问添加cast后为什么会报错?


但更换另外一种写法:cast 却是正常执行的,如下sql语句:
SELECT * FROM T_RIGHT_POWERBI_ROLE 
LEFT JOIN (
SELECT
DEPARTMENT.DEPARTMENTNAME AS "门店",
SUM(ICSTOCKBILL_1W.TOTALMONEY) AS "成本",
SUM(ICSTOCKBILL_1W.TOTALDECIMAL) AS "收入" 
FROM ICSTOCKBILL_1W 
INNER JOIN DEPARTMENT 
ON ICSTOCKBILL_1W.DEPARTMENTID = DEPARTMENT.DEPARTMENTID
GROUP BY DEPARTMENT.DEPARTMENTNAME 
ORDER BY DEPARTMENT.DEPARTMENTNAME
) as f2
ON T_RIGHT_POWERBI_ROLE.FDIMID = CAST("门店" AS VARCHAR(300))
where T_RIGHT_POWERBI_ROLE.FTABLEID = 'suppmarket2005_cw_test.department' 
AND T_RIGHT_POWERBI_ROLE.FROLEID = 'role62e707b95f1511e89246cb029cf035cd' 
AND T_RIGHT_POWERBI_ROLE.FDSVID = 'view-b528c240-8155-11e7-9647-1b109f7783f6'

有查询结果,如下图:
Mime
  • Unnamed multipart/related (inline, 8-Bit, 0 bytes)
View raw message