* garrow_csv_reader_new: * @input: The input to be read. * @options: (nullable): A #GArrowCSVReadOptions. * @error: (nullable): Return location for a #GError or %NULL. * * Returns: (nullable): A newly created #GArrowCSVReader or %NULL on error. * * Since: 0.12.0 */
| 1844 | * Since: 0.12.0 |
| 1845 | */ |
| 1846 | GArrowCSVReader * |
| 1847 | garrow_csv_reader_new(GArrowInputStream *input, |
| 1848 | GArrowCSVReadOptions *options, |
| 1849 | GError **error) |
| 1850 | { |
| 1851 | auto arrow_input = garrow_input_stream_get_raw(input); |
| 1852 | arrow::csv::ReadOptions read_options; |
| 1853 | arrow::csv::ParseOptions parse_options; |
| 1854 | arrow::csv::ConvertOptions convert_options; |
| 1855 | if (options) { |
| 1856 | auto options_priv = GARROW_CSV_READ_OPTIONS_GET_PRIVATE(options); |
| 1857 | read_options = options_priv->read_options; |
| 1858 | parse_options = options_priv->parse_options; |
| 1859 | convert_options = options_priv->convert_options; |
| 1860 | } else { |
| 1861 | read_options = arrow::csv::ReadOptions::Defaults(); |
| 1862 | parse_options = arrow::csv::ParseOptions::Defaults(); |
| 1863 | convert_options = arrow::csv::ConvertOptions::Defaults(); |
| 1864 | } |
| 1865 | |
| 1866 | auto arrow_reader = arrow::csv::TableReader::Make(arrow::io::default_io_context(), |
| 1867 | arrow_input, |
| 1868 | read_options, |
| 1869 | parse_options, |
| 1870 | convert_options); |
| 1871 | if (garrow::check(error, arrow_reader, "[csv-reader][new]")) { |
| 1872 | return garrow_csv_reader_new_raw(&(*arrow_reader), input); |
| 1873 | } else { |
| 1874 | return NULL; |
| 1875 | } |
| 1876 | } |
| 1877 | |
| 1878 | /** |
| 1879 | * garrow_csv_reader_read: |
nothing calls this directly
no test coverage detected