| 150 | |
| 151 | template <class BuilderType, class TargetType, class BatchType, class SourceType> |
| 152 | Status AppendNumericBatchCast(liborc::ColumnVectorBatch* column_vector_batch, |
| 153 | int64_t offset, int64_t length, ArrayBuilder* abuilder) { |
| 154 | auto builder = checked_cast<BuilderType*>(abuilder); |
| 155 | auto batch = checked_cast<BatchType*>(column_vector_batch); |
| 156 | |
| 157 | if (length == 0) { |
| 158 | return Status::OK(); |
| 159 | } |
| 160 | |
| 161 | const uint8_t* valid_bytes = nullptr; |
| 162 | if (batch->hasNulls) { |
| 163 | valid_bytes = reinterpret_cast<const uint8_t*>(batch->notNull.data()) + offset; |
| 164 | } |
| 165 | const SourceType* source = batch->data.data() + offset; |
| 166 | auto cast_iter = internal::MakeLazyRange( |
| 167 | [&source](int64_t index) { return static_cast<TargetType>(source[index]); }, |
| 168 | length); |
| 169 | |
| 170 | RETURN_NOT_OK(builder->AppendValues(cast_iter.begin(), cast_iter.end(), valid_bytes)); |
| 171 | |
| 172 | return Status::OK(); |
| 173 | } |
| 174 | |
| 175 | Status AppendBoolBatch(liborc::ColumnVectorBatch* column_vector_batch, int64_t offset, |
| 176 | int64_t length, ArrayBuilder* abuilder) { |
nothing calls this directly
no test coverage detected