MCPcopy Create free account
hub / github.com/apache/arrow / ReadOptional

Function ReadOptional

cpp/src/parquet/stream_reader.h:247–264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

245
246 template <typename ReaderType, typename ReadType = typename ReaderType::T, typename T>
247 void ReadOptional(optional<T>* v) {
248 const auto& node = nodes_[column_index_];
249 auto reader = static_cast<ReaderType*>(column_readers_[column_index_++].get());
250 int16_t def_level;
251 int16_t rep_level;
252 ReadType tmp;
253 int64_t values_read;
254
255 reader->ReadBatch(kBatchSizeOne, &def_level, &rep_level, &tmp, &values_read);
256
257 if (values_read == 1) {
258 *v = T(tmp);
259 } else if ((values_read == 0) && (def_level == 0)) {
260 v->reset();
261 } else {
262 ThrowReadFailedException(node);
263 }
264 }
265
266 void ReadFixedLength(char* ptr, int len);
267

Callers 2

stream_reader.hFile · 0.85
stream_reader.ccFile · 0.85

Calls 3

getMethod · 0.45
ReadBatchMethod · 0.45
resetMethod · 0.45

Tested by

no test coverage detected