Skip to content

Commit

Permalink
Remove calls to Bind
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Jul 15, 2022
1 parent 851ea24 commit 800fb99
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
8 changes: 0 additions & 8 deletions r/src/compute-exec.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -146,20 +146,12 @@ std::shared_ptr<compute::ExecNode> ExecNode_Scan(

options->dataset_schema = dataset->schema();

// ScanNode needs the filter to do predicate pushdown and skip partitions
options->filter = ValueOrStop(filter->Bind(*dataset->schema()));

// ScanNode needs to know which fields to materialize (and which are unnecessary)
std::vector<compute::Expression> exprs;
for (const auto& name : materialized_field_names) {
exprs.push_back(compute::field_ref(name));
}

options->projection =
ValueOrStop(call("make_struct", std::move(exprs),
compute::MakeStructOptions{std::move(materialized_field_names)})
.Bind(*dataset->schema()));

return MakeExecNodeOrStop("scan", plan.get(), {},
ds::ScanNodeOptions{dataset, options});
}
Expand Down
4 changes: 4 additions & 0 deletions r/tests/testthat/test-dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -1240,4 +1240,8 @@ test_that("can add in augmented fields", {
mutate(file_name = add_filenames()) %>%
collect()

expect_named(
ds,
c("int", "dbl", "lgl", "chr", "fct", "ts", "group", "other", "file_name")
)
})

0 comments on commit 800fb99

Please sign in to comment.