Skip to content

How to retrieve value from a org.bytedeco.arrow.Scalar? #998

@xuchen-plus

Description

@xuchen-plus

After calling an arrow::compute::ScalarAggregationFunction, it returns a Datum object which contains a Scalar object. However, there's no value() method in the generated java wrapper to retrieve the underlying value, e.g. long/int, etc.

My code:

ArrowBuf buf; // this is an int64 ArrowBuf java object initialized in java

// Below are all javacpp calls

ArrowBuffer buffer = new ArrowBuffer(buf.nioBuffer(), capacity);
ExecContext context = new ExecContext();
DataType type = int64();
PrimitiveArray array = new PrimitiveArray(type, capacity, buffer);
Function func = context.func_registry().GetFunction("sum").ValueOrDie();
DatumVector vector = new DatumVector(new Datum(array));
Scalar s = func.Execute(vector, null, context).ValueOrDie().scalar();
// How can I retrieve the `long` value from the Scalar result object here?  Haven't found such methods from either Scalar or Int64Scalar classes.

Please help advice. Thanks very much.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions