c++ - bit vector intersect in handling parquet file format -
i handling parquet file format. example:
a group of data:
1 2 null 3 4 5 6 null 7 8 null null 9 10 11 12 13 14
i got bit vector indicate null element:
1 1 0 1 1 1 1 0 1 1 0 0 1 1 1 1 1 1
and store non-null element:
1 2 3 4 5 6 7 8 9 10 11 12 13 14
i want evaluate predicate: big 5
i compared non-null element 5 , got bit vector:
0 0 0 0 0 1 1 1 1 1 1 1 1 1
i want got bit vector elements:
0 0 0 0 0 0 1 0 1 1 0 0 1 1 1 1 1 1
the 0 in bold null elements, should false.
void intersectbitvec(vector<int64_t>& bit_vec, vector<int64_t>& sub_bit_vec) { int data_idx = 0, int bit_idx = 63; (int = 0; < bit_vec.size(); ++i) { (int j = 63; j >=0; --j) { if (bit_vec[i] & 0x01 << j) { if (!(sub_bit_vec[data_idx] & 0x01 << bit_idx)) { bit_vec[i] &= ~(0x01 << j); } if (--bit_idx < 0) { --data_idx; bit_idx = 63; } } } }}
my code quite ugly, there anyway make fast? great thanks!
Comments
Post a Comment