Skip to content

fix: resolve compile error in statements.cpp #1149

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/statement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ SEXP duckdb::duckdb_execute_R_impl(MaterializedQueryResult *result, const duckdb
return Rf_ScalarReal(0); // no need for protection because no allocation can happen afterwards
}

auto rows = result->RowCount();
auto nrows = result->RowCount();

// Note we cannot use cpp11's data frame here as it tries to calculate the number of rows itself,
// but gives the wrong answer if the first column is another data frame. So we set the necessary
Expand All @@ -159,7 +159,7 @@ SEXP duckdb::duckdb_execute_R_impl(MaterializedQueryResult *result, const duckdb

for (size_t col_idx = 0; col_idx < ncols; col_idx++) {
cpp11::sexp varvalue =
duckdb_r_allocate(result->types[col_idx], rows, result->names[col_idx], convert_opts, "duckdb_execute_R_impl");
duckdb_r_allocate(result->types[col_idx], nrows, result->names[col_idx], convert_opts, "duckdb_execute_R_impl");
duckdb_r_decorate(result->types[col_idx], varvalue, convert_opts);
data_frame.push_back(varvalue);
}
Expand All @@ -181,7 +181,7 @@ SEXP duckdb::duckdb_execute_R_impl(MaterializedQueryResult *result, const duckdb
(void)(SEXP)data_frame;

SET_NAMES(data_frame, StringsToSexp(result->names));
duckdb_r_df_decorate(data_frame, rows, class_);
duckdb_r_df_decorate(data_frame, nrows, class_);

// at this point data_frame is fully allocated and the only protected SEXP

Expand Down
Loading