1 // Licensed to the Apache Software Foundation (ASF) under one
2 // or more contributor license agreements. See the NOTICE file
3 // distributed with this work for additional information
4 // regarding copyright ownership. The ASF licenses this file
5 // to you under the Apache License, Version 2.0 (the
6 // "License"); you may not use this file except in compliance
7 // with the License. You may obtain a copy of the License at
9 // http://www.apache.org/licenses/LICENSE-2.0
11 // Unless required by applicable law or agreed to in writing,
12 // software distributed under the License is distributed on an
13 // "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
14 // KIND, either express or implied. See the License for the
15 // specific language governing permissions and limitations
20 #include "gandiva/configuration.h"
21 #include "gandiva/jni/config_holder.h"
22 #include "gandiva/jni/env_helper.h"
23 #include "jni/org_apache_arrow_gandiva_evaluator_ConfigurationBuilder.h"
25 using gandiva::ConfigHolder
;
26 using gandiva::Configuration
;
27 using gandiva::ConfigurationBuilder
;
30 * Class: org_apache_arrow_gandiva_evaluator_ConfigBuilder
31 * Method: buildConfigInstance
34 JNIEXPORT jlong JNICALL
35 Java_org_apache_arrow_gandiva_evaluator_ConfigurationBuilder_buildConfigInstance(
36 JNIEnv
* env
, jobject configuration
, jboolean optimize
, jboolean target_host_cpu
) {
37 ConfigurationBuilder configuration_builder
;
38 std::shared_ptr
<Configuration
> config
= configuration_builder
.build();
39 config
->set_optimize(optimize
);
40 config
->target_host_cpu(target_host_cpu
);
41 return ConfigHolder::MapInsert(config
);
45 * Class: org_apache_arrow_gandiva_evaluator_ConfigBuilder
46 * Method: releaseConfigInstance
49 JNIEXPORT
void JNICALL
50 Java_org_apache_arrow_gandiva_evaluator_ConfigurationBuilder_releaseConfigInstance(
51 JNIEnv
* env
, jobject configuration
, jlong config_id
) {
52 ConfigHolder::MapErase(config_id
);