* garrow_json_reader_new: * @input: The input to be read. * @options: (nullable): A #GArrowJSONReadOptions. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GArrowJSONReader or %NULL on error. * * Since: 0.14.0 */
| 2252 | * Since: 0.14.0 |
| 2253 | */ |
| 2254 | GArrowJSONReader * |
| 2255 | garrow_json_reader_new(GArrowInputStream *input, |
| 2256 | GArrowJSONReadOptions *options, |
| 2257 | GError **error) |
| 2258 | { |
| 2259 | auto arrow_input = garrow_input_stream_get_raw(input); |
| 2260 | arrow::Status status; |
| 2261 | |
| 2262 | arrow::Result<std::shared_ptr<arrow::json::TableReader>> arrow_reader; |
| 2263 | if (options) { |
| 2264 | auto options_priv = GARROW_JSON_READ_OPTIONS_GET_PRIVATE(options); |
| 2265 | arrow_reader = arrow::json::TableReader::Make(arrow::default_memory_pool(), |
| 2266 | arrow_input, |
| 2267 | options_priv->read_options, |
| 2268 | options_priv->parse_options); |
| 2269 | } else { |
| 2270 | arrow_reader = arrow::json::TableReader::Make(arrow::default_memory_pool(), |
| 2271 | arrow_input, |
| 2272 | arrow::json::ReadOptions::Defaults(), |
| 2273 | arrow::json::ParseOptions::Defaults()); |
| 2274 | } |
| 2275 | |
| 2276 | if (garrow::check(error, arrow_reader, "[json-reader][new]")) { |
| 2277 | return garrow_json_reader_new_raw(&*arrow_reader, input); |
| 2278 | } else { |
| 2279 | return NULL; |
| 2280 | } |
| 2281 | } |
| 2282 | |
| 2283 | /** |
| 2284 | * garrow_json_reader_read: |
nothing calls this directly
no test coverage detected