Skip to content

Commit

Permalink
repair bindings
Browse files Browse the repository at this point in the history
  • Loading branch information
bkietz committed Apr 28, 2021
1 parent 472b90f commit 874b9fe
Show file tree
Hide file tree
Showing 14 changed files with 127 additions and 108 deletions.
2 changes: 2 additions & 0 deletions cpp/src/arrow/compute/exec/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# specific language governing permissions and limitations
# under the License.

arrow_install_all_headers("arrow/compute/exec")

add_arrow_compute_test(expression_test PREFIX "arrow-compute")

add_arrow_benchmark(expression_benchmark PREFIX "arrow-compute")
Expand Down
10 changes: 5 additions & 5 deletions cpp/src/arrow/dataset/scanner_internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ inline RecordBatchIterator FilterRecordBatch(RecordBatchIterator it,
}

inline Result<std::shared_ptr<RecordBatch>> ProjectSingleBatch(
const std::shared_ptr<RecordBatch>& in, const Expression& projection,
const std::shared_ptr<RecordBatch>& in, const compute::Expression& projection,
MemoryPool* pool) {
compute::ExecContext exec_context{pool};
ARROW_ASSIGN_OR_RAISE(Datum projected,
Expand Down Expand Up @@ -126,10 +126,10 @@ class FilterAndProjectScanTask : public ScanTask {
Result<RecordBatchIterator> ToFilteredAndProjectedIterator(
const RecordBatchVector& rbs) {
auto it = MakeVectorIterator(rbs);
ARROW_ASSIGN_OR_RAISE(Expression simplified_filter,
ARROW_ASSIGN_OR_RAISE(compute::Expression simplified_filter,
SimplifyWithGuarantee(options()->filter, partition_));

ARROW_ASSIGN_OR_RAISE(Expression simplified_projection,
ARROW_ASSIGN_OR_RAISE(compute::Expression simplified_projection,
SimplifyWithGuarantee(options()->projection, partition_));

RecordBatchIterator filter_it =
Expand All @@ -141,10 +141,10 @@ class FilterAndProjectScanTask : public ScanTask {

Result<std::shared_ptr<RecordBatch>> FilterAndProjectBatch(
const std::shared_ptr<RecordBatch>& batch) {
ARROW_ASSIGN_OR_RAISE(Expression simplified_filter,
ARROW_ASSIGN_OR_RAISE(compute::Expression simplified_filter,
SimplifyWithGuarantee(options()->filter, partition_));

ARROW_ASSIGN_OR_RAISE(Expression simplified_projection,
ARROW_ASSIGN_OR_RAISE(compute::Expression simplified_projection,
SimplifyWithGuarantee(options()->projection, partition_));
ARROW_ASSIGN_OR_RAISE(auto filtered,
FilterSingleBatch(batch, simplified_filter, options_->pool));
Expand Down
2 changes: 1 addition & 1 deletion cpp/src/arrow/dataset/scanner_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -566,7 +566,7 @@ class ControlledDataset : public Dataset {
void FinishFragment(int fragment_index) { fragments_[fragment_index]->Finish(); }

protected:
Result<FragmentIterator> GetFragmentsImpl(Expression predicate) override {
Result<FragmentIterator> GetFragmentsImpl(compute::Expression predicate) override {
std::vector<std::shared_ptr<Fragment>> casted_fragments(fragments_.begin(),
fragments_.end());
return MakeVectorIterator(std::move(casted_fragments));
Expand Down
26 changes: 15 additions & 11 deletions python/pyarrow/includes/libarrow_dataset.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -32,28 +32,36 @@ cdef extern from "arrow/api.h" namespace "arrow" nogil:
pass


cdef extern from "arrow/dataset/api.h" namespace "arrow::dataset" nogil:
cdef extern from "arrow/compute/exec/expression.h" namespace "arrow::compute" nogil:

cdef cppclass CExpression "arrow::dataset::Expression":
cdef cppclass CExpression "arrow::compute::Expression":
c_bool Equals(const CExpression& other) const
c_string ToString() const
CResult[CExpression] Bind(const CSchema&)

cdef CExpression CMakeScalarExpression \
"arrow::dataset::literal"(shared_ptr[CScalar] value)
"arrow::compute::literal"(shared_ptr[CScalar] value)

cdef CExpression CMakeFieldExpression \
"arrow::dataset::field_ref"(c_string name)
"arrow::compute::field_ref"(c_string name)

cdef CExpression CMakeCallExpression \
"arrow::dataset::call"(c_string function,
"arrow::compute::call"(c_string function,
vector[CExpression] arguments,
shared_ptr[CFunctionOptions] options)

cdef CResult[shared_ptr[CBuffer]] CSerializeExpression \
"arrow::dataset::Serialize"(const CExpression&)
"arrow::compute::Serialize"(const CExpression&)

cdef CResult[CExpression] CDeserializeExpression \
"arrow::dataset::Deserialize"(shared_ptr[CBuffer])
"arrow::compute::Deserialize"(shared_ptr[CBuffer])

cdef CResult[unordered_map[CFieldRef, CDatum, CFieldRefHash]] \
CExtractKnownFieldValues "arrow::compute::ExtractKnownFieldValues"(
const CExpression& partition_expression)


cdef extern from "arrow/dataset/api.h" namespace "arrow::dataset" nogil:

cdef cppclass CScanOptions "arrow::dataset::ScanOptions":
@staticmethod
Expand Down Expand Up @@ -331,10 +339,6 @@ cdef extern from "arrow/dataset/api.h" namespace "arrow::dataset" nogil:
shared_ptr[CPartitioning] partitioning() const
shared_ptr[CPartitioningFactory] factory() const

cdef CResult[unordered_map[CFieldRef, CDatum, CFieldRefHash]] \
CExtractKnownFieldValues "arrow::dataset::ExtractKnownFieldValues"(
const CExpression& partition_expression)

cdef cppclass CFileSystemFactoryOptions \
"arrow::dataset::FileSystemFactoryOptions":
CPartitioningOrFactory partitioning
Expand Down
1 change: 1 addition & 0 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,7 @@ export(ParquetArrowReaderProperties)
export(ParquetFileFormat)
export(ParquetFileReader)
export(ParquetFileWriter)
export(ParquetFragmentScanOptions)
export(ParquetVersionType)
export(ParquetWriterProperties)
export(Partitioning)
Expand Down
20 changes: 10 additions & 10 deletions r/R/arrowExports.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

10 changes: 5 additions & 5 deletions r/R/expression.R
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ print.array_expression <- function(x, ...) {
#' @export
Expression <- R6Class("Expression", inherit = ArrowObject,
public = list(
ToString = function() dataset___expr__ToString(self),
ToString = function() compute___expr__ToString(self),
cast = function(to_type, safe = TRUE, ...) {
opts <- list(
to_type = to_type,
Expand All @@ -265,22 +265,22 @@ Expression <- R6Class("Expression", inherit = ArrowObject,
}
),
active = list(
field_name = function() dataset___expr__get_field_ref_name(self)
field_name = function() compute___expr__get_field_ref_name(self)
)
)
Expression$create <- function(function_name,
...,
args = list(...),
options = empty_named_list()) {
assert_that(is.string(function_name))
dataset___expr__call(function_name, args, options)
compute___expr__call(function_name, args, options)
}
Expression$field_ref <- function(name) {
assert_that(is.string(name))
dataset___expr__field_ref(name)
compute___expr__field_ref(name)
}
Expression$scalar <- function(x) {
dataset___expr__scalar(Scalar$create(x))
compute___expr__scalar(Scalar$create(x))
}

build_dataset_expression <- function(FUN,
Expand Down
5 changes: 1 addition & 4 deletions r/man/FileFormat.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions r/man/FragmentScanOptions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions r/man/arrow-package.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

82 changes: 41 additions & 41 deletions r/src/arrowExports.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 874b9fe

Please sign in to comment.