You are viewing a plain text version of this content. The canonical link for it is here.
Posted to jira@arrow.apache.org by "wuyue (Jira)" <ji...@apache.org> on 2022/04/01 03:59:00 UTC

[jira] [Commented] (ARROW-16088) Possible gandiva function problem

    [ https://issues.apache.org/jira/browse/ARROW-16088?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17515691#comment-17515691 ] 

wuyue commented on ARROW-16088:
-------------------------------

i can offer docker image, wuyueandrew/arrow-test:latest

> Possible gandiva function problem
> ---------------------------------
>
>                 Key: ARROW-16088
>                 URL: https://issues.apache.org/jira/browse/ARROW-16088
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: C++ - Gandiva
>    Affects Versions: 7.0.0
>         Environment: Aliyun ECS
> CentOS Linux release 7.9.2009 (Core)
> /arrow/cpp/src/gandiva/engine.cc:109: Detected CPU Name : skylake-avx512
> openjdk:8u322-jdk
>            Reporter: wuyue
>            Priority: Minor
>
> I use Gandiva JNI  and function greater_than_or_equal_to is not support.
> Is it really not support or i use it in a wrong way?
> {code:java}
> List<Field> fields = new ArrayList<>();
> Field idF = new Field("id", new FieldType(false, new ArrowType.Int(8, false), null), null);
> fields.add(idF);
> fields.add(new Field("name", new FieldType(false, new ArrowType.Utf8(), null), null));
> Schema schema = new Schema(fields);
> RootAllocator allocator = new RootAllocator(Long.MAX_VALUE);
> VectorSchemaRoot root = VectorSchemaRoot.create(schema, allocator);
> root.getFieldVectors().forEach(vec -> vec.setInitialCapacity(100));
> root.allocateNew();
> root.getFieldVectors().forEach(fv -> {
>     if (fv instanceof IntVector) {
>         for (int i = 0; i < 100; i++) {
>             ((IntVector) fv).setSafe(i, i);
>         }
>     }
>     if (fv instanceof VarCharVector) {
>         for (int i = 0; i < 100; i++) {
>             ((VarCharVector) fv).setSafe(i, String.valueOf(i + 100).getBytes());
>         }
>     }
> });
> List<TreeNode> list = new ArrayList<>();
> TreeNode idNode = TreeBuilder.makeField(idF);
> TreeNode literalNode = TreeBuilder.makeLiteral(50);
> TreeNode eqNode = TreeBuilder.makeFunction("greater_than_or_equal_to", list, new ArrowType.Bool());
> Condition condition = TreeBuilder.makeCondition(eqNode);
> Filter filter = Filter.make(root.getSchema(), condition);
> ArrowBuf selectionBuffer = allocator.buffer(200);
> SelectionVectorInt16 selectionVector = new SelectionVectorInt16(selectionBuffer);
> ArrowRecordBatch data = new VectorUnloader(root).getRecordBatch();
> filter.evaluate(data, selectionVector); {code}
>  



--
This message was sent by Atlassian Jira
(v8.20.1#820001)