Skip to content

[C++] Error when creating Table and using schema with decimal type #29501

@asfimport

Description

@asfimport

I'm writing a recipe in the cookbook about creating schemas, and when I try to create one, I get the following error:

Error: NotImplemented: Extend

Here's the R code which I run to get this error:

share_data <- tibble::tibble(
  company = c("AMZN", "GOOG", "BKNG", "TSLA"),
  price = c(3463.12, 2884.38, 2300.46, 732.39),
  date = c("2021-09-03","2021-09-03", "2021-09-03", "2021-09-03")
)

share_schema <- schema(
  company = utf8(),
  price = decimal(precision = 1, scale = 1),
  date = utf8()
)

Table$create(share_data, schema = share_schema)

I've tried to have a bit of a play around with parameters and a dig around to see what's going on, but I don't have much to go on.

The schema creation itself is working fine, it's when it's passed into Table$create which is where it's causing problems.

I'm not sure if the error is at the C++ or R layer.

This is the C++ function at the R layer which is where the error is coming from:

arrow/r/src/r_to_arrow.cpp

Lines 1327 to 1342 in 1440d5a

std::shared_ptr<arrow::Table> Table__from_dots(SEXP lst, SEXP schema_sxp,
bool use_threads) {
bool infer_schema = !Rf_inherits(schema_sxp, "Schema");
int num_fields;
StopIfNotOk(arrow::r::count_fields(lst, &num_fields));
// schema + metadata
std::shared_ptr<arrow::Schema> schema;
StopIfNotOk(arrow::r::InferSchemaFromDots(lst, schema_sxp, num_fields, schema));
StopIfNotOk(arrow::r::AddMetadataFromDots(lst, num_fields, schema));
if (!infer_schema && schema->num_fields() != num_fields) {
cpp11::stop("incompatible. schema has %d fields, and %d columns are supplied",
schema->num_fields(), num_fields);
}

Reporter: Nicola Crane / @thisisnic

Related issues:

Note: This issue was originally created as ARROW-13885. Please see the migration documentation for further details.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions