Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2837#discussion_r228700880
  
    --- Diff: store/CSDK/src/CarbonWriter.cpp ---
    @@ -0,0 +1,161 @@
    +/*
    + * 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 <stdexcept>
    +#include "CarbonWriter.h"
    +
    +void CarbonWriter::builder(JNIEnv *env) {
    +    if (env == NULL) {
    +        throw std::runtime_error("JNIEnv parameter can't be NULL.");
    +    }
    +    jniEnv = env;
    +    carbonWriter = 
env->FindClass("org/apache/carbondata/sdk/file/CarbonWriter");
    +    if (carbonWriter == NULL) {
    +        throw std::runtime_error("Can't find the class in java: 
org/apache/carbondata/sdk/file/CarbonWriter");
    +    }
    +    jmethodID carbonWriterBuilderID = env->GetStaticMethodID(carbonWriter, 
"builder",
    +        "()Lorg/apache/carbondata/sdk/file/CarbonWriterBuilder;");
    +    if (carbonWriterBuilderID == NULL) {
    +        throw std::runtime_error("Can't find the method in java: 
carbonWriterBuilder");
    +    }
    +    carbonWriterBuilderObject = env->CallStaticObjectMethod(carbonWriter, 
carbonWriterBuilderID);
    +}
    +
    +bool CarbonWriter::checkBuilder() {
    +    if (carbonWriterBuilderObject == NULL) {
    +        throw std::runtime_error("carbonWriterBuilder Object can't be 
NULL. Please call builder method first.");
    +    }
    +}
    +
    +void CarbonWriter::outputPath(char *path) {
    +    if (path == NULL) {
    +        throw std::runtime_error("path parameter can't be NULL.");
    +    }
    +    checkBuilder();
    --- End diff --
    
    This logic is required for carbon Reader also in CarbonReader.cpp
    for API which is called after builder. please add 


---

Reply via email to