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

    https://github.com/apache/carbondata/pull/2792#discussion_r228056749
  
    --- Diff: docs/csdk-guide.md ---
    @@ -30,106 +30,13 @@ code and without CarbonSession.
     In the carbon jars package, there exist a carbondata-sdk.jar, 
     including SDK reader for CSDK.
     ## Quick example
    -```
    -// 1. init JVM
    -JavaVM *jvm;
    -JNIEnv *initJVM() {
    -    JNIEnv *env;
    -    JavaVMInitArgs vm_args;
    -    int parNum = 3;
    -    int res;
    -    JavaVMOption options[parNum];
    -
    -    options[0].optionString = "-Djava.compiler=NONE";
    -    options[1].optionString = 
"-Djava.class.path=../../sdk/target/carbondata-sdk.jar";
    -    options[2].optionString = "-verbose:jni";
    -    vm_args.version = JNI_VERSION_1_8;
    -    vm_args.nOptions = parNum;
    -    vm_args.options = options;
    -    vm_args.ignoreUnrecognized = JNI_FALSE;
    -
    -    res = JNI_CreateJavaVM(&jvm, (void **) &env, &vm_args);
    -    if (res < 0) {
    -        fprintf(stderr, "\nCan't create Java VM\n");
    -        exit(1);
    -    }
    -
    -    return env;
    -}
    -
    -// 2. create carbon reader and read data 
    -// 2.1 read data from local disk
    -/**
    - * test read data from local disk, without projection
    - *
    - * @param env  jni env
    - * @return
    - */
    -bool readFromLocalWithoutProjection(JNIEnv *env) {
    -
    -    CarbonReader carbonReaderClass;
    -    carbonReaderClass.builder(env, "../resources/carbondata", "test");
    -    carbonReaderClass.build();
    -
    -    while (carbonReaderClass.hasNext()) {
    -        jobjectArray row = carbonReaderClass.readNextRow();
    -        jsize length = env->GetArrayLength(row);
    -        int j = 0;
    -        for (j = 0; j < length; j++) {
    -            jobject element = env->GetObjectArrayElement(row, j);
    -            char *str = (char *) env->GetStringUTFChars((jstring) element, 
JNI_FALSE);
    -            printf("%s\t", str);
    -        }
    -        printf("\n");
    -    }
    -    carbonReaderClass.close();
    -}
    -
    -// 2.2 read data from S3
    -
    -/**
    - * read data from S3
    - * parameter is ak sk endpoint
    - *
    - * @param env jni env
    - * @param argv argument vector
    - * @return
    - */
    -bool readFromS3(JNIEnv *env, char *argv[]) {
    -    CarbonReader reader;
    -
    -    char *args[3];
    -    // "your access key"
    -    args[0] = argv[1];
    -    // "your secret key"
    -    args[1] = argv[2];
    -    // "your endPoint"
    -    args[2] = argv[3];
    -
    -    reader.builder(env, "s3a://sdk/WriterOutput", "test");
    -    reader.withHadoopConf(3, args);
    -    reader.build();
    -    printf("\nRead data from S3:\n");
    -    while (reader.hasNext()) {
    -        jobjectArray row = reader.readNextRow();
    -        jsize length = env->GetArrayLength(row);
    -
    -        int j = 0;
    -        for (j = 0; j < length; j++) {
    -            jobject element = env->GetObjectArrayElement(row, j);
    -            char *str = (char *) env->GetStringUTFChars((jstring) element, 
JNI_FALSE);
    -            printf("%s\t", str);
    -        }
    -        printf("\n");
    -    }
    -
    -    reader.close();
    -}
    -
    -// 3. destory JVM
    -    (jvm)->DestroyJavaVM();
    -```
    -Find example code at main.cpp of CSDK module
    +
    +Please find example code at main.cpp of CSDK module  
    --- End diff --
    
    can we add a link here for main.cpp ? so that just click will take to 
main.cpp


---

Reply via email to