diff --git a/cpp/src/arrow/array/array_base.cc b/cpp/src/arrow/array/array_base.cc index f7b8d7954e1cf..04989f9e6c3be 100644 --- a/cpp/src/arrow/array/array_base.cc +++ b/cpp/src/arrow/array/array_base.cc @@ -157,6 +157,10 @@ struct ScalarFromArraySlotImpl { return Status::OK(); } + Status Visit(const ListViewArray& a) { + return Status::NotImplemented("Creating scalar from list-view array"); + } + Status Visit(const ExtensionArray& a) { ARROW_ASSIGN_OR_RAISE(auto storage, a.storage()->GetScalar(index_)); out_ = std::make_shared(std::move(storage), a.type()); diff --git a/cpp/src/arrow/array/concatenate.cc b/cpp/src/arrow/array/concatenate.cc index 94cc2cf119b3d..df14d61c68f41 100644 --- a/cpp/src/arrow/array/concatenate.cc +++ b/cpp/src/arrow/array/concatenate.cc @@ -458,6 +458,10 @@ class ConcatenateImpl { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("concatenation of ", type); + } + Status Visit(const ExtensionType& e) { ArrayDataVector storage_data(in_.size()); for (size_t i = 0; i < in_.size(); ++i) { diff --git a/cpp/src/arrow/array/diff.cc b/cpp/src/arrow/array/diff.cc index 800f19b752726..d171590c04ac5 100644 --- a/cpp/src/arrow/array/diff.cc +++ b/cpp/src/arrow/array/diff.cc @@ -122,6 +122,8 @@ struct ValueComparatorVisitor { return Status::NotImplemented("run-end encoded type"); } + Status Visit(const ListViewType&) { return Status::NotImplemented("list-view type"); } + ValueComparator Create(const DataType& type) { DCHECK_OK(VisitTypeInline(type, this)); return out; @@ -386,7 +388,8 @@ Result> Diff(const Array& base, const Array& target return Diff(*base_storage, *target_storage, pool); } else if (base.type()->id() == Type::DICTIONARY) { return Status::NotImplemented("diffing arrays of type ", *base.type()); - } else if (base.type()->id() == Type::RUN_END_ENCODED) { + } else if (base.type()->id() == Type::RUN_END_ENCODED || + base.type()->id() == Type::LIST_VIEW) { return Status::NotImplemented("diffing arrays of type ", *base.type()); } else { return QuadraticSpaceMyersDiff(base, target, pool).Diff(); @@ -643,6 +646,10 @@ class MakeFormatterImpl { return Status::NotImplemented("formatting diffs between arrays of type ", t); } + Status Visit(const ListViewType& t) { + return Status::NotImplemented("formatting diffs between arrays of type ", t); + } + template Formatter MakeTimeFormatter(const std::string& fmt_str) { return [fmt_str](const Array& array, int64_t index, std::ostream* os) { diff --git a/cpp/src/arrow/array/util.cc b/cpp/src/arrow/array/util.cc index 07be8176fc08c..dce8b37bc0a79 100644 --- a/cpp/src/arrow/array/util.cc +++ b/cpp/src/arrow/array/util.cc @@ -240,6 +240,9 @@ class ArrayDataEndianSwapper { Status Visit(const RunEndEncodedType& type) { return Status::NotImplemented("swapping endianness of run-end encoded array"); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("swapping endianness of list-view array"); + } Status Visit(const UnionType& type) { out_->buffers[1] = data_->buffers[1]; if (type.mode() == UnionMode::DENSE) { @@ -559,6 +562,10 @@ class NullArrayFactory { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("construction of all-null ", type); + } + Status Visit(const ExtensionType& type) { out_->child_data.resize(type.storage_type()->num_fields()); RETURN_NOT_OK(VisitTypeInline(*type.storage_type(), this)); @@ -789,6 +796,10 @@ class RepeatedArrayFactory { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("construction from scalar of type ", *scalar_.type); + } + Status Visit(const ExtensionType& type) { return Status::NotImplemented("construction from scalar of type ", *scalar_.type); } diff --git a/cpp/src/arrow/array/validate.cc b/cpp/src/arrow/array/validate.cc index 0f2bd4583574e..430e27744382f 100644 --- a/cpp/src/arrow/array/validate.cc +++ b/cpp/src/arrow/array/validate.cc @@ -428,6 +428,10 @@ struct ValidateArrayImpl { } } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("ListViewType validation not implemented"); + } + Status Visit(const ExtensionType& type) { // Visit storage return ValidateWithType(*type.storage_type()); diff --git a/cpp/src/arrow/compare.cc b/cpp/src/arrow/compare.cc index df41cd22c9e06..6bb915af6ee1d 100644 --- a/cpp/src/arrow/compare.cc +++ b/cpp/src/arrow/compare.cc @@ -402,6 +402,10 @@ class RangeDataEqualsImpl { } } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("comparing ListViewType"); + } + Status Visit(const ExtensionType& type) { // Compare storages result_ &= CompareWithType(*type.storage_type()); @@ -746,6 +750,10 @@ class TypeEqualsVisitor { return Status::OK(); } + Status Visit(const ListViewType& left) { + return Status::NotImplemented("list-view type comparison"); + } + Status Visit(const ExtensionType& left) { result_ = left.ExtensionEquals(static_cast(right_)); return Status::OK(); @@ -890,6 +898,10 @@ class ScalarEqualsVisitor { return Status::OK(); } + Status Visit(const ListViewScalar& left) { + return Status::NotImplemented("list-view comparison"); + } + Status Visit(const ExtensionScalar& left) { const auto& right = checked_cast(right_); result_ = ScalarEquals(*left.value, *right.value, options_, floating_approximate_); diff --git a/cpp/src/arrow/engine/substrait/expression_internal.cc b/cpp/src/arrow/engine/substrait/expression_internal.cc index 722dec2a300d8..35ff930e174aa 100644 --- a/cpp/src/arrow/engine/substrait/expression_internal.cc +++ b/cpp/src/arrow/engine/substrait/expression_internal.cc @@ -836,6 +836,10 @@ struct ScalarToProtoImpl { Status Visit(const RunEndEncodedScalar& s) { return (*this)(*s.value); } + Status Visit(const ListViewScalar& s) { + return Status::NotImplemented("list-view to proto"); + } + Status Visit(const ExtensionScalar& s) { if (UnwrapUuid(*s.type)) { return FromBuffer([](Lit* lit, std::string&& s) { lit->set_uuid(std::move(s)); }, diff --git a/cpp/src/arrow/engine/substrait/type_internal.cc b/cpp/src/arrow/engine/substrait/type_internal.cc index 03d1f999a1491..2a39dd6e1a288 100644 --- a/cpp/src/arrow/engine/substrait/type_internal.cc +++ b/cpp/src/arrow/engine/substrait/type_internal.cc @@ -330,6 +330,7 @@ struct DataTypeToProtoImpl { Status Visit(const DenseUnionType& t) { return NotImplemented(t); } Status Visit(const DictionaryType& t) { return NotImplemented(t); } Status Visit(const RunEndEncodedType& t) { return NotImplemented(t); } + Status Visit(const ListViewType& t) { return NotImplemented(t); } Status Visit(const MapType& t) { // FIXME assert default field names; custom ones won't roundtrip diff --git a/cpp/src/arrow/ipc/metadata_internal.cc b/cpp/src/arrow/ipc/metadata_internal.cc index a9f90a0724a9d..1e6a50abc4b24 100644 --- a/cpp/src/arrow/ipc/metadata_internal.cc +++ b/cpp/src/arrow/ipc/metadata_internal.cc @@ -708,6 +708,10 @@ class FieldToFlatbufferVisitor { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("list-view type in IPC"); + } + Status Visit(const ExtensionType& type) { RETURN_NOT_OK(VisitType(*type.storage_type())); extra_type_metadata_[kExtensionTypeKeyName] = type.extension_name(); diff --git a/cpp/src/arrow/ipc/reader.cc b/cpp/src/arrow/ipc/reader.cc index 694cc732253b3..019af979208d7 100644 --- a/cpp/src/arrow/ipc/reader.cc +++ b/cpp/src/arrow/ipc/reader.cc @@ -427,6 +427,10 @@ class ArrayLoader { return LoadChildren(type.fields()); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("list-view array in IPC"); + } + Status Visit(const ExtensionType& type) { return LoadType(*type.storage_type()); } BatchDataReadRequest& read_request() { return read_request_; } diff --git a/cpp/src/arrow/ipc/writer.cc b/cpp/src/arrow/ipc/writer.cc index f0f0e96ee467b..fb05fa14b9fc6 100644 --- a/cpp/src/arrow/ipc/writer.cc +++ b/cpp/src/arrow/ipc/writer.cc @@ -573,6 +573,10 @@ class RecordBatchSerializer { return Status::OK(); } + Status Visit(const ListViewArray& array) { + return Status::NotImplemented("list-view array in IPC"); + } + Status Visit(const ExtensionArray& array) { return VisitType(*array.storage()); } Status VisitType(const Array& values) { return VisitArrayInline(values, this); } diff --git a/cpp/src/arrow/json/test_common.h b/cpp/src/arrow/json/test_common.h index 0f7b3466fdbc9..3bbd23fd08523 100644 --- a/cpp/src/arrow/json/test_common.h +++ b/cpp/src/arrow/json/test_common.h @@ -147,6 +147,8 @@ struct GenerateImpl { Status Visit(const RunEndEncodedType& t) { return NotImplemented(t); } + Status Visit(const ListViewType& t) { return NotImplemented(t); } + Status NotImplemented(const DataType& t) { return Status::NotImplemented("random generation of arrays of type ", t); } diff --git a/cpp/src/arrow/pretty_print.cc b/cpp/src/arrow/pretty_print.cc index 0577f0be4dfd8..3d56b7f8ea89f 100644 --- a/cpp/src/arrow/pretty_print.cc +++ b/cpp/src/arrow/pretty_print.cc @@ -389,6 +389,10 @@ class ArrayPrinter : public PrettyPrinter { return PrettyPrint(*array.values(), ChildOptions(true), sink_); } + Status Visit(const ListViewArray& array) { + return Status::NotImplemented("printing list-view array"); + } + Status Print(const Array& array) { RETURN_NOT_OK(VisitArrayInline(array, this)); Flush(); diff --git a/cpp/src/arrow/scalar.cc b/cpp/src/arrow/scalar.cc index a37a4e4305852..d35fbc1a37507 100644 --- a/cpp/src/arrow/scalar.cc +++ b/cpp/src/arrow/scalar.cc @@ -127,6 +127,10 @@ struct ScalarHashImpl { return Status::OK(); } + Status Visit(const ListViewScalar& s) { + return Status::NotImplemented("list-view scalar hashing"); + } + Status Visit(const ExtensionScalar& s) { AccumulateHashFrom(*s.value); return Status::OK(); @@ -461,6 +465,10 @@ struct ScalarValidateImpl { return ValidateValue(s, *s.value); } + Status Visit(const ListViewScalar& s) { + return Status::NotImplemented("list-view scalar validation"); + } + Status Visit(const ExtensionScalar& s) { if (!s.value) { return Status::Invalid(s.type->ToString(), " scalar doesn't have storage value"); @@ -823,6 +831,10 @@ struct MakeNullImpl { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("making null array of list-view"); + } + Status Visit(const ExtensionType& type) { out_ = std::make_shared(MakeNullScalar(type.storage_type()), type_, /*is_valid=*/false); diff --git a/cpp/src/arrow/testing/json_internal.cc b/cpp/src/arrow/testing/json_internal.cc index babff621b1f92..c07b3db7a554b 100644 --- a/cpp/src/arrow/testing/json_internal.cc +++ b/cpp/src/arrow/testing/json_internal.cc @@ -442,6 +442,8 @@ class SchemaWriter { return Status::OK(); } + Status Visit(const ListViewType& type) { return Status::NotImplemented(type.name()); } + Status Visit(const ExtensionType& type) { return Status::NotImplemented(type.name()); } private: @@ -758,6 +760,10 @@ class ArrayWriter { return WriteChildren(ree_type.fields(), children); } + Status Visit(const ListViewArray& array) { + return Status::NotImplemented("list-view array in JSON"); + } + Status Visit(const ExtensionArray& array) { return VisitArrayValues(*array.storage()); } private: @@ -1596,6 +1602,10 @@ class ArrayReader { return Status::OK(); } + Status Visit(const ListViewType& type) { + return Status::NotImplemented("list-view in JSON"); + } + Status Visit(const ExtensionType& type) { ArrayReader parser(obj_, pool_, field_->WithType(type.storage_type())); ARROW_ASSIGN_OR_RAISE(data_, parser.Parse()); diff --git a/cpp/src/arrow/type.cc b/cpp/src/arrow/type.cc index 37bb532ecbc7e..e90babf42043f 100644 --- a/cpp/src/arrow/type.cc +++ b/cpp/src/arrow/type.cc @@ -137,7 +137,8 @@ std::vector AllTypeIds() { Type::DICTIONARY, Type::EXTENSION, Type::INTERVAL_MONTH_DAY_NANO, - Type::RUN_END_ENCODED}; + Type::RUN_END_ENCODED, + Type::LIST_VIEW}; } namespace internal { @@ -203,6 +204,7 @@ std::string ToString(Type::type id) { TO_STRING_CASE(SPARSE_UNION) TO_STRING_CASE(DICTIONARY) TO_STRING_CASE(RUN_END_ENCODED) + TO_STRING_CASE(LIST_VIEW) TO_STRING_CASE(EXTENSION) #undef TO_STRING_CASE diff --git a/cpp/src/arrow/visitor.cc b/cpp/src/arrow/visitor.cc index ed3d5bc2c68d7..a7b19d2009364 100644 --- a/cpp/src/arrow/visitor.cc +++ b/cpp/src/arrow/visitor.cc @@ -70,6 +70,7 @@ ARRAY_VISITOR_DEFAULT(DictionaryArray) ARRAY_VISITOR_DEFAULT(Decimal128Array) ARRAY_VISITOR_DEFAULT(Decimal256Array) ARRAY_VISITOR_DEFAULT(RunEndEncodedArray) +ARRAY_VISITOR_DEFAULT(ListViewArray) ARRAY_VISITOR_DEFAULT(ExtensionArray) #undef ARRAY_VISITOR_DEFAULT @@ -120,6 +121,7 @@ TYPE_VISITOR_DEFAULT(SparseUnionType) TYPE_VISITOR_DEFAULT(DenseUnionType) TYPE_VISITOR_DEFAULT(DictionaryType) TYPE_VISITOR_DEFAULT(RunEndEncodedType) +TYPE_VISITOR_DEFAULT(ListViewType) TYPE_VISITOR_DEFAULT(ExtensionType) #undef TYPE_VISITOR_DEFAULT @@ -171,6 +173,7 @@ SCALAR_VISITOR_DEFAULT(DictionaryScalar) SCALAR_VISITOR_DEFAULT(SparseUnionScalar) SCALAR_VISITOR_DEFAULT(DenseUnionScalar) SCALAR_VISITOR_DEFAULT(RunEndEncodedScalar) +SCALAR_VISITOR_DEFAULT(ListViewScalar) SCALAR_VISITOR_DEFAULT(ExtensionScalar) #undef SCALAR_VISITOR_DEFAULT diff --git a/cpp/src/arrow/visitor.h b/cpp/src/arrow/visitor.h index b22d4d3c567e1..9a50cf6b31d5b 100644 --- a/cpp/src/arrow/visitor.h +++ b/cpp/src/arrow/visitor.h @@ -69,6 +69,7 @@ class ARROW_EXPORT ArrayVisitor { virtual Status Visit(const DenseUnionArray& array); virtual Status Visit(const DictionaryArray& array); virtual Status Visit(const RunEndEncodedArray& array); + virtual Status Visit(const ListViewArray& array); virtual Status Visit(const ExtensionArray& array); }; @@ -118,6 +119,7 @@ class ARROW_EXPORT TypeVisitor { virtual Status Visit(const DenseUnionType& type); virtual Status Visit(const DictionaryType& type); virtual Status Visit(const RunEndEncodedType& type); + virtual Status Visit(const ListViewType& scalar); virtual Status Visit(const ExtensionType& type); }; @@ -167,6 +169,7 @@ class ARROW_EXPORT ScalarVisitor { virtual Status Visit(const SparseUnionScalar& scalar); virtual Status Visit(const DenseUnionScalar& scalar); virtual Status Visit(const RunEndEncodedScalar& scalar); + virtual Status Visit(const ListViewScalar& scalar); virtual Status Visit(const ExtensionScalar& scalar); }; diff --git a/cpp/src/arrow/visitor_generate.h b/cpp/src/arrow/visitor_generate.h index 8f6b176ba8fea..6cebdf62e7931 100644 --- a/cpp/src/arrow/visitor_generate.h +++ b/cpp/src/arrow/visitor_generate.h @@ -64,6 +64,7 @@ namespace arrow { ACTION(DenseUnion); \ ACTION(Dictionary); \ ACTION(RunEndEncoded); \ + ACTION(ListView); \ ACTION(Extension) } // namespace arrow