1// Licensed to the Apache Software Foundation (ASF) under one
2// or more contributor license agreements. See the NOTICE file
3// distributed with this work for additional information
4// regarding copyright ownership. The ASF licenses this file
5// to you under the Apache License, Version 2.0 (the
6// "License"); you may not use this file except in compliance
7// with the License. You may obtain a copy of the License at
8//
9// http://www.apache.org/licenses/LICENSE-2.0
10//
11// Unless required by applicable law or agreed to in writing,
12// software distributed under the License is distributed on an
13// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14// KIND, either express or implied. See the License for the
15// specific language governing permissions and limitations
16// under the License.
17
18#include "arrow/visitor.h"
19
20#include <memory>
21
22#include "arrow/array.h"
23#include "arrow/status.h"
24#include "arrow/type.h"
25
26namespace arrow {
27
28#define ARRAY_VISITOR_DEFAULT(ARRAY_CLASS) \
29 Status ArrayVisitor::Visit(const ARRAY_CLASS& array) { \
30 return Status::NotImplemented(array.type()->ToString()); \
31 }
32
33ARRAY_VISITOR_DEFAULT(NullArray)
34ARRAY_VISITOR_DEFAULT(BooleanArray)
35ARRAY_VISITOR_DEFAULT(Int8Array)
36ARRAY_VISITOR_DEFAULT(Int16Array)
37ARRAY_VISITOR_DEFAULT(Int32Array)
38ARRAY_VISITOR_DEFAULT(Int64Array)
39ARRAY_VISITOR_DEFAULT(UInt8Array)
40ARRAY_VISITOR_DEFAULT(UInt16Array)
41ARRAY_VISITOR_DEFAULT(UInt32Array)
42ARRAY_VISITOR_DEFAULT(UInt64Array)
43ARRAY_VISITOR_DEFAULT(HalfFloatArray)
44ARRAY_VISITOR_DEFAULT(FloatArray)
45ARRAY_VISITOR_DEFAULT(DoubleArray)
46ARRAY_VISITOR_DEFAULT(BinaryArray)
47ARRAY_VISITOR_DEFAULT(StringArray)
48ARRAY_VISITOR_DEFAULT(FixedSizeBinaryArray)
49ARRAY_VISITOR_DEFAULT(Date32Array)
50ARRAY_VISITOR_DEFAULT(Date64Array)
51ARRAY_VISITOR_DEFAULT(Time32Array)
52ARRAY_VISITOR_DEFAULT(Time64Array)
53ARRAY_VISITOR_DEFAULT(TimestampArray)
54ARRAY_VISITOR_DEFAULT(IntervalArray)
55ARRAY_VISITOR_DEFAULT(ListArray)
56ARRAY_VISITOR_DEFAULT(StructArray)
57ARRAY_VISITOR_DEFAULT(UnionArray)
58ARRAY_VISITOR_DEFAULT(DictionaryArray)
59ARRAY_VISITOR_DEFAULT(Decimal128Array)
60
61#undef ARRAY_VISITOR_DEFAULT
62
63// ----------------------------------------------------------------------
64// Default implementations of TypeVisitor methods
65
66#define TYPE_VISITOR_DEFAULT(TYPE_CLASS) \
67 Status TypeVisitor::Visit(const TYPE_CLASS& type) { \
68 return Status::NotImplemented(type.ToString()); \
69 }
70
71TYPE_VISITOR_DEFAULT(NullType)
72TYPE_VISITOR_DEFAULT(BooleanType)
73TYPE_VISITOR_DEFAULT(Int8Type)
74TYPE_VISITOR_DEFAULT(Int16Type)
75TYPE_VISITOR_DEFAULT(Int32Type)
76TYPE_VISITOR_DEFAULT(Int64Type)
77TYPE_VISITOR_DEFAULT(UInt8Type)
78TYPE_VISITOR_DEFAULT(UInt16Type)
79TYPE_VISITOR_DEFAULT(UInt32Type)
80TYPE_VISITOR_DEFAULT(UInt64Type)
81TYPE_VISITOR_DEFAULT(HalfFloatType)
82TYPE_VISITOR_DEFAULT(FloatType)
83TYPE_VISITOR_DEFAULT(DoubleType)
84TYPE_VISITOR_DEFAULT(StringType)
85TYPE_VISITOR_DEFAULT(BinaryType)
86TYPE_VISITOR_DEFAULT(FixedSizeBinaryType)
87TYPE_VISITOR_DEFAULT(Date64Type)
88TYPE_VISITOR_DEFAULT(Date32Type)
89TYPE_VISITOR_DEFAULT(Time32Type)
90TYPE_VISITOR_DEFAULT(Time64Type)
91TYPE_VISITOR_DEFAULT(TimestampType)
92TYPE_VISITOR_DEFAULT(IntervalType)
93TYPE_VISITOR_DEFAULT(Decimal128Type)
94TYPE_VISITOR_DEFAULT(ListType)
95TYPE_VISITOR_DEFAULT(StructType)
96TYPE_VISITOR_DEFAULT(UnionType)
97TYPE_VISITOR_DEFAULT(DictionaryType)
98
99#undef TYPE_VISITOR_DEFAULT
100
101} // namespace arrow
102