blob: 0031a5de7460327ab3ee5967e128a5a000c25b29 [file]
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
#pragma once
#include <memory>
#include "paimon/status.h"
#include "paimon/visibility.h"
namespace arrow {
class Array;
class DataType;
class Field;
class Schema;
} // namespace arrow
namespace paimon {
/// Helpers shared by the schema, read and write paths handling VECTOR values, which are
/// represented as Arrow FixedSizeList.
class PAIMON_EXPORT VectorUtils {
public:
VectorUtils() = delete;
~VectorUtils() = delete;
static bool ContainsVectorType(const std::shared_ptr<arrow::DataType>& type);
static bool ContainsVectorField(const std::shared_ptr<arrow::Field>& field);
static bool ContainsVector(const std::shared_ptr<arrow::Schema>& schema);
/// Rejects VECTOR values whose elements are not fully materialized or contain nulls.
/// `array` must be the List or FixedSizeList array holding the VECTOR values.
static Status ValidateVectorElements(const arrow::Array& array);
};
} // namespace paimon