Github user xubo245 commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2792#discussion_r228062513
  
    --- Diff: store/CSDK/CarbonRow.cpp ---
    @@ -0,0 +1,129 @@
    +/*
    + * Licensed to the Apache Software Foundation (ASF) under one or more
    + * contributor license agreements.  See the NOTICE file distributed with
    + * this work for additional information regarding copyright ownership.
    + * The ASF licenses this file to You under the Apache License, Version 2.0
    + * (the "License"); you may not use this file except in compliance with
    + * the License.  You may obtain a copy of the License at
    + *
    + *    http://www.apache.org/licenses/LICENSE-2.0
    + *
    + * Unless required by applicable law or agreed to in writing, software
    + * distributed under the License is distributed on an "AS IS" BASIS,
    + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    + * See the License for the specific language governing permissions and
    + * limitations under the License.
    + */
    +
    +#include <jni.h>
    +#include <cstring>
    +#include "CarbonRow.h"
    +
    +CarbonRow::CarbonRow(JNIEnv *env) {
    +    this->rowUtilClass = 
env->FindClass("org/apache/carbondata/sdk/file/RowUtil");
    +    this->jniEnv = env;
    +    getShortId = jniEnv->GetStaticMethodID(rowUtilClass, "getShort",
    +        "([Ljava/lang/Object;I)S");
    +    getIntId = jniEnv->GetStaticMethodID(rowUtilClass, "getInt",
    +        "([Ljava/lang/Object;I)I");
    +    getLongId = jniEnv->GetStaticMethodID(rowUtilClass, "getLong",
    +        "([Ljava/lang/Object;I)J");
    +    getDoubleId = jniEnv->GetStaticMethodID(rowUtilClass, "getDouble",
    +        "([Ljava/lang/Object;I)D");
    +    getFloatId = jniEnv->GetStaticMethodID(rowUtilClass, "getFloat",
    +        "([Ljava/lang/Object;I)F");
    +    getBooleanId = jniEnv->GetStaticMethodID(rowUtilClass, "getBoolean",
    +        "([Ljava/lang/Object;I)Z");
    +    getStringId = jniEnv->GetStaticMethodID(rowUtilClass, "getString",
    +        "([Ljava/lang/Object;I)Ljava/lang/String;");
    +    getDecimalId = jniEnv->GetStaticMethodID(rowUtilClass, "getDecimal",
    +        "([Ljava/lang/Object;I)Ljava/lang/String;");
    +    getVarcharId = jniEnv->GetStaticMethodID(rowUtilClass, "getVarchar",
    +        "([Ljava/lang/Object;I)Ljava/lang/String;");
    +    getArrayId = jniEnv->GetStaticMethodID(rowUtilClass, "getArray",
    +        "([Ljava/lang/Object;I)[Ljava/lang/Object;");
    +}
    +
    +void CarbonRow::setCarbonRow(jobject data) {
    +    this->carbonRow = data;
    +}
    +
    +short CarbonRow::getShort(int ordinal) {
    +    jvalue args[2];
    +    args[0].l = carbonRow;
    +    args[1].i = ordinal;
    +    return jniEnv->CallStaticShortMethodA(rowUtilClass, getShortId, args);
    --- End diff --
    
    can't cast like this, I tried before


---

Reply via email to