MCPcopy Create free account
hub / github.com/apache/orc / generateDataForBits

Function generateDataForBits

c++/test/TestRleVectorDecoder.cc:77–101  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

75 }
76
77 void generateDataForBits(uint64_t numValues, int64_t start, int64_t delta, bool random,
78 int64_t* data, uint8_t bitWidth, uint64_t numNulls = 0,
79 char* notNull = nullptr) {
80 int64_t max = pow(2, bitWidth);
81 if (numNulls != 0 && notNull != nullptr) {
82 memset(notNull, 1, numValues);
83 while (numNulls > 0) {
84 uint64_t pos = static_cast<uint64_t>(std::rand()) % numValues;
85 if (notNull[pos]) {
86 notNull[pos] = static_cast<char>(0);
87 --numNulls;
88 }
89 }
90 }
91
92 for (uint64_t i = 0; i < numValues; ++i) {
93 if (notNull == nullptr || notNull[i]) {
94 if (!random) {
95 data[i] = start + delta * static_cast<int64_t>(i);
96 } else {
97 data[i] = std::rand() % max;
98 }
99 }
100 }
101 }
102
103 void printBar(const char* testName, int64_t offset, int64_t total) {
104 int64_t n = offset * 100 / total;

Callers 1

runTestMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected