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

Method SparseUnionScalar

cpp/src/arrow/scalar.cc:838–851  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

836}
837
838SparseUnionScalar::SparseUnionScalar(ValueType value, int8_t type_code,
839 std::shared_ptr<DataType> type)
840 : UnionScalar(std::move(type), type_code, /*is_valid=*/true),
841 ArraySpanFillFromScalarScratchSpace(type_code),
842 value(std::move(value)) {
843 const auto child_ids = checked_cast<const SparseUnionType&>(*this->type).child_ids();
844 if (type_code >= 0 && static_cast<size_t>(type_code) < child_ids.size() &&
845 child_ids[type_code] != UnionType::kInvalidChildId) {
846 this->child_id = child_ids[type_code];
847
848 // Fix nullness based on whether the selected child is null
849 this->is_valid = this->value[this->child_id]->is_valid;
850 }
851}
852
853std::shared_ptr<Scalar> SparseUnionScalar::FromValue(std::shared_ptr<Scalar> value,
854 int field_index,

Callers

nothing calls this directly

Calls 1

sizeMethod · 0.45

Tested by

no test coverage detected