Back to home page

EIC code displayed by LXR

 
 

    


File indexing completed on 2025-08-28 08:27:00

0001 // Licensed to the Apache Software Foundation (ASF) under one
0002 // or more contributor license agreements.  See the NOTICE file
0003 // distributed with this work for additional information
0004 // regarding copyright ownership.  The ASF licenses this file
0005 // to you under the Apache License, Version 2.0 (the
0006 // "License"); you may not use this file except in compliance
0007 // with the License.  You may obtain a copy of the License at
0008 //
0009 //   http://www.apache.org/licenses/LICENSE-2.0
0010 //
0011 // Unless required by applicable law or agreed to in writing,
0012 // software distributed under the License is distributed on an
0013 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
0014 // KIND, either express or implied.  See the License for the
0015 // specific language governing permissions and limitations
0016 // under the License.
0017 
0018 #pragma once
0019 
0020 #include <cstdint>
0021 #include <memory>
0022 
0023 #include "arrow/json/type_fwd.h"
0024 #include "arrow/util/visibility.h"
0025 
0026 namespace arrow {
0027 
0028 class DataType;
0029 class Schema;
0030 
0031 namespace json {
0032 
0033 enum class UnexpectedFieldBehavior : char {
0034   /// Unexpected JSON fields are ignored
0035   Ignore,
0036   /// Unexpected JSON fields error out
0037   Error,
0038   /// Unexpected JSON fields are type-inferred and included in the output
0039   InferType
0040 };
0041 
0042 struct ARROW_EXPORT ParseOptions {
0043   // Parsing options
0044 
0045   /// Optional explicit schema (disables type inference on those fields)
0046   std::shared_ptr<Schema> explicit_schema;
0047 
0048   /// Whether objects may be printed across multiple lines (for example pretty-printed)
0049   ///
0050   /// If true, parsing may be slower.
0051   bool newlines_in_values = false;
0052 
0053   /// How JSON fields outside of explicit_schema (if given) are treated
0054   UnexpectedFieldBehavior unexpected_field_behavior = UnexpectedFieldBehavior::InferType;
0055 
0056   /// Create parsing options with default values
0057   static ParseOptions Defaults();
0058 };
0059 
0060 struct ARROW_EXPORT ReadOptions {
0061   // Reader options
0062 
0063   /// Whether to use the global CPU thread pool
0064   bool use_threads = true;
0065   /// Block size we request from the IO layer; also determines the size of
0066   /// chunks when use_threads is true
0067   int32_t block_size = 1 << 20;  // 1 MB
0068 
0069   /// Create read options with default values
0070   static ReadOptions Defaults();
0071 };
0072 
0073 }  // namespace json
0074 }  // namespace arrow