項目報錯查詢記錄

來源:互聯網
上載者:User

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次。出現問題。

 

 

 

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.