cube-js/cube

`UInt64` value returned from ClickHouse is truncated on Cube side

Open

#6182 aperta il 21 feb 2023

Vedi su GitHub
 (2 commenti) (0 reazioni) (0 assegnatari)Rust (1965 fork)batch import
driver:clickhousehelp wanted

Metriche repository

Star
 (19.563 star)
Metriche merge PR
 (Merge medio 5g 16h) (138 PR mergiate in 30 g)

Descrizione

Describe the bug We have such dimension in Sales cube. Clickhouse is an underlying database

"saleKey":{
   "sql":"`farmHash64(doesnt matter what is inside)`",
   "type":"`number`",
   "primaryKey":true,
   "shown":true
},

farmHash64 returns UInt64 — [0 : 18446744073709551615]

Lets run script

select saleKey
from public.Sales limit 4

We are getting response

saleKey
8307928136669839400
12604678624050645000
15207895910732839000
16946569575044143000

But corresponding sql query returns other values. Attaching response from redis cache as an evidence


{
    "time": 1676967618149,
    "result": [
        {
            "sales__sale_key": "8307928136669839578"
        },
        {
            "sales__sale_key": "12604678624050644212"
        },
        {
            "sales__sale_key": "15207895910732839290"
        },
        {
            "sales__sale_key": "16946569575044142817"
        }
    ],
    "renewalKey": "SQL_QUERY_RESULT_STANDALONE_d1eff3196b1ea88672b632c472d243bc"
}

It easy to see that last 4 digits are not the same, why?

Expected behavior Values returned via script and sql-api are the same

Version: cubejs/cube:v0.30.62

Additional request Pls point to the source code line where truncation happens, if possible)

Guida contributor