Reputation: 463
I need to create a BQ table with binary data. One way is to create it with the BOOL specification. However, I want to be able to directly do arithmetic operations on its columns which is not possible with BOOL.
What is the best way to create this table with the minimum storage requirement?
For example, I create the table below and all columns are implicitly defined as Integers
create or replace table temp1
as
select 1 as a, 0 as b, 1 as c;
Is there a way to reduce table size?
Upvotes: 1
Views: 1045
Reputation: 640
If you are storing images as binary i do recommend GCS. Suppose that you are not storing images, You can store binary data in BigQuery as a string. for your operations you can use some predefined functions as :
select bqutil.fn.from_binary('111000001')
Or you can use other functions like: SAFE_CONVERT_BYTES_TO_STRING()
...etc
Upvotes: 1