Convert unsigned int to signed int via google BigQuery

I tried to run the query in google BigQuery api and got an exception like this:

"The argument type mismatch in the IF function: 'distinctPlayers' is the type 'TYPE_UINT64', '0' is the type 'TYPE_INT32'."

The request is too large, so I wrote only part of it where it does not work.

QUERY: sum (if (action_type == 3, distinctPlayers, 0)) as Game_Viral_Acceptor_Count

I understood:

if condition is true 
then set distinctPlayers of type unsigned int64 
otherwise set 0 which is of type int32

Can someone talk about how to convert unsigned int64to signed intthrough BigQuery.

Thanks in advance, Omkar

+2
source share
1 answer

, , int, INTEGER. ,

... SUM(IF(action_type == 3, INTEGER(distinctPlayers), 0)) AS ...

, , BigQuery - .

+1

Source: https://habr.com/ru/post/1628378/


All Articles