Apache Arrow (C++)
A columnar in-memory analytics layer designed to accelerate big data.
cast.h
Go to the documentation of this file.
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 #ifndef ARROW_COMPUTE_KERNELS_CAST_H
19 #define ARROW_COMPUTE_KERNELS_CAST_H
20 
21 #include <memory>
22 
23 #include "arrow/status.h"
24 #include "arrow/util/visibility.h"
25 
26 #include "arrow/compute/kernel.h"
27 
28 namespace arrow {
29 
30 class Array;
31 class ChunkedArray;
32 class Column;
33 class DataType;
34 
35 namespace compute {
36 
37 struct ARROW_EXPORT CastOptions {
38  CastOptions() : allow_int_overflow(false), allow_time_truncate(false) {}
39 
42 };
43 
46 ARROW_EXPORT
47 Status GetCastFunction(const DataType& in_type, const std::shared_ptr<DataType>& to_type,
48  const CastOptions& options, std::unique_ptr<UnaryKernel>* kernel);
49 
59 ARROW_EXPORT
60 Status Cast(FunctionContext* context, const Array& value,
61  const std::shared_ptr<DataType>& to_type, const CastOptions& options,
62  std::shared_ptr<Array>* out);
63 
73 ARROW_EXPORT
74 Status Cast(FunctionContext* context, const Datum& value,
75  const std::shared_ptr<DataType>& to_type, const CastOptions& options,
76  Datum* out);
77 
78 } // namespace compute
79 } // namespace arrow
80 
81 #endif // ARROW_COMPUTE_KERNELS_CAST_H
bool allow_int_overflow
Definition: cast.h:40
Container for variables and options used by function evaluation.
Definition: context.h:39
Definition: status.h:94
Status Cast(FunctionContext *context, const Array &value, const std::shared_ptr< DataType > &to_type, const CastOptions &options, std::shared_ptr< Array > *out)
Cast from one array type to another.
bool allow_time_truncate
Definition: cast.h:41
Variant type for various Arrow C++ data structures.
Definition: kernel.h:52
Status GetCastFunction(const DataType &in_type, const std::shared_ptr< DataType > &to_type, const CastOptions &options, std::unique_ptr< UnaryKernel > *kernel)
Top-level namespace for Apache Arrow C++ API.
Definition: adapter.h:32
Array base type Immutable data array with some logical type and some length.
Definition: array.h:200
Definition: cast.h:37
CastOptions()
Definition: cast.h:38
Definition: type.h:137