Skip to content

arrow::compute hash_* functions matching input types #11799

@jrecuerda

Description

@jrecuerda

I am not able to use the hash_* compute functions. I have tried both in python and directly in C++ but I am always getting the following error:

Function hash_sum has no kernel matching input types (array[int64], array[string])

I have tried multiple combinations of input types: float-int64, float-string, double-string, double-int64...

These are two simplified examples of what I'm trying:

Python

>>> import pyarrow.compute as pc
>>> pc.sum([1,2,3])
<pyarrow.Int64Scalar: 6>
>>> pc.hash_sum([1,2,3], ["a", "b", "a"])
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/vscode/.local/lib/python3.6/site-packages/pyarrow/compute.py", line 191, in wrapper
    return func.call(args, options, memory_pool)
  File "pyarrow/_compute.pyx", line 327, in pyarrow._compute.Function.call
  File "pyarrow/error.pxi", line 143, in pyarrow.lib.pyarrow_internal_check_status
  File "pyarrow/error.pxi", line 120, in pyarrow.lib.check_status
pyarrow.lib.ArrowNotImplementedError: Function hash_sum has no kernel matching input types (array[int64], array[string])

C++

        arrow::DoubleBuilder builder;
        builder.Append(1);
        builder.Append(2);
        builder.Append(3);
        auto array = builder.Finish();

        arrow::StringBuilder builderStr;
        builderStr.Append("a");
        builderStr.Append("b");
        builderStr.Append("a");
        auto arrayKey = builderStr.Finish();

        std::vector<std::shared_ptr<arrow::Field>> schema_vector = {
            arrow::field("id", arrow::float64()), arrow::field("cat", arrow::utf8())};

        auto schema = std::make_shared<arrow::Schema>(schema_vector);
        auto table = arrow::Table::Make(schema, {*array, *arrayKey});
        auto res = arrow::compute::CallFunction(std::string("hash_count"), {table->GetColumnByName("id"), table->GetColumnByName("cat")});

What am I missing?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions