日期:2014-05-16 浏览次数:20424 次
saiku数据查询结果错误,是hive中源数据的3倍。
问题定位:
saiku执行的mdx有问题
SELECT NON EMPTY {[Measures].[Downloads]} ON COLUMNS,
NON EMPTY FILTER(CrossJoin(CrossJoin([appname.default].[appname].Members, CrossJoin([developer.default].[developer].Members,[version.default].[version].Members)),[packagename.default].[packagename].Members),[packagename.default].[packagename].CURRENTMEMBER IS [packagename.default].[packagename].[com.tencent.mm]) ON ROWS
FROM [aso] WHERE ([os.default].[os].[1],[dimStoreName.default].[storeName].[all],[dimdate.default].[day].[2014-02-24])
执行结果有问题,是hive数据的3倍。
所以去modroin_mdx.log和modroin_sql.log找到对应的执行语句,
命令tail -n 200 filename 找到对应的执行语句
(在查询的过程中,执行太多,所以删掉两个文件,重启saiku,可是已经执行过的语句,会被saiku缓存起来。找不到了,后来在hive里面重新找不同的报名,执行新的语句,才找到)
用执行的sql语句执行,看到用sum函数,原因是group by完成了一个分组
select
`dimdate`.`year` as `c0`,
`dimdate`.`month` as `c1`,
`dimdate`.`datevalue` as `c2`,
`dimappstatic`.`packagename` as `c3`,
sum(`factrank`.`primarytaxonomyrank_week`) as `m0`
from `dimdate` as `dimdate`, `factrank` as `factrank`, `dimappstatic` as `dimappstatic`
where
`factrank`.`dt` = `dimdate`.`datevalue`
and `dimdate`.`year` = '2014' and `dimdate`.`month` in ('1', '2')
and `dimdate`.`datevalue` in ('2014-01-06', '2014-01-13', '2014-01-20', '2014-01-27', '2014-02-04', '2014-02-10', '2014-02-17', '2014-02-24')
and `factrank`.`pk_hash` = `dimappstatic`.`pk_hash`
and `dimappstatic`.`packagename` = 'com.tencent.mm'
group by `dimdate`.`year`, `dimdate`.`month`, `dimdate`.`datevalue`, `dimappstatic`.`packagename`
删掉group by语句的一行和sum函数,只保留一行,看到查询结果为重复的3列数据。这说明关联的某个表中,有3列重复数据。
sql查询infiniDB的结果为重复3列,说明:某个被重复入了数据三次,最后定为在appstatic表
原因分析:mysql用kettle导入,insert/update可以去掉重复列。而infiniDB中,使用的是load命令,用shell执行,不会验证重复性。所以执行了3次。出现问题。