bool SetCsvConvertOptions()

in dataset/src/main/cpp/jni_wrapper.cc [381:415]


bool SetCsvConvertOptions(arrow::csv::ConvertOptions& options, const std::string& key,
                          const std::string& value) {
  if (key == "column_types") {
    int64_t schema_address = std::stol(value);
    ArrowSchema* c_schema = reinterpret_cast<ArrowSchema*>(schema_address);
    auto schema = JniGetOrThrow(arrow::ImportSchema(c_schema));
    auto& column_types = options.column_types;
    for (auto field : schema->fields()) {
      column_types[field->name()] = field->type();
    }
  } else if (key == "strings_can_be_null") {
    options.strings_can_be_null = ParseBool(value);
  } else if (key == "check_utf8") {
    options.check_utf8 = ParseBool(value);
  } else if (key == "null_values") {
    options.null_values = {value};
  } else if (key == "true_values") {
    options.true_values = {value};
  } else if (key == "false_values") {
    options.false_values = {value};
  } else if (key == "quoted_strings_can_be_null") {
    options.quoted_strings_can_be_null = ParseBool(value);
  } else if (key == "auto_dict_encode") {
    options.auto_dict_encode = ParseBool(value);
  } else if (key == "auto_dict_max_cardinality") {
    options.auto_dict_max_cardinality = std::stoi(value);
  } else if (key == "decimal_point") {
    options.decimal_point = ParseChar(key, value);
  } else if (key == "include_missing_columns") {
    options.include_missing_columns = ParseBool(value);
  } else {
    return false;
  }
  return true;
}