The "top_n" is not a SQL function so the second statement is wrong.
The first statment looks good; to investigate the issue, please provide: 1) the cube definition json; 2) the log message in logs/kylin.log when you run this SQL first time (no cache be hit) 2016-05-13 15:06 GMT+08:00 lancelot chen <[email protected]>: > I'm confusing about usage of TOP_N measure. > I have a cube with TOP_N measure built in, measure definition is: > > { > > "name": "PV_1D_001_TOP100", > > "function": { > > "expression": "TOP_N", > > "parameter": { > > "type": "column", > > "value": "PV_1D_001", > > "next_parameter": { > > "type": "column", > > "value": "INDS", > > "next_parameter": null > > } > > }, > > "returntype": "topn(100)" > > }, > > "dependent_measure_ref": null > > } > > But I can't get this measure by using either "SUM | GROUP BY | ORDER BY" > nor "SELECT TOP_N | GROUP BY". Error message is: > > When using SUM | GROUP BY | ORDER BY: > > Error while executing SQL "select sum(pv_1d_001) pv from test > group by INDS order by pv desc LIMIT 50000": Can't find any realization. > Please confirm with providers. SQL digest: fact table > LBS.LBS_AD_PV_1D,group by [LBS.LBS_AD_PV_1D.INDS],filter on [],with > aggregates[FunctionDesc [expression=SUM, parameter=ParameterDesc > [type=column, value=PV_1D_001, nextParam=null], returnType=null]] > > When using SELECT TOP_N | GROUP BY: > > Error while executing SQL "select top_n(pv_1d_001) pv from test > group by INDS LIMIT 50000": From line 2, column 5 to line 2, column 20: No > match found for function signature TOP_N(<NUMERIC>) > -- Best regards, Shaofeng Shi
