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

    https://github.com/apache/carbondata/pull/2816#discussion_r228932584
  
    --- Diff: store/CSDK/test/main.cpp ---
    @@ -220,6 +393,86 @@ bool tryCatchException(JNIEnv *env) {
      */
     bool readFromS3(JNIEnv *env, char *argv[]) {
         printf("\nRead data from S3:\n");
    +    struct timeval start, build, read;
    +    gettimeofday(&start, NULL);
    +
    +    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/carbondata", "test");
    +    reader.withHadoopConf("fs.s3a.access.key", argv[1]);
    +    reader.withHadoopConf("fs.s3a.secret.key", argv[2]);
    +    reader.withHadoopConf("fs.s3a.endpoint", argv[3]);
    +    reader.build();
    +
    +    gettimeofday(&build, NULL);
    +    int time = 1000000 * (build.tv_sec - start.tv_sec) + build.tv_usec - 
start.tv_usec;
    +    int buildTime = time / 1000000.0;
    +    printf("build time: %lf s\n", time / 1000000.0);
    +
    +    CarbonRow carbonRow(env);
    +    int i = 0;
    +    while (reader.hasNext()) {
    +        jobject row = reader.readNextRow();
    +        i++;
    +        carbonRow.setCarbonRow(row);
    +
    +        printf("%s\t", carbonRow.getString(0));
    +        printf("%d\t", carbonRow.getInt(1));
    +        printf("%ld\t", carbonRow.getLong(2));
    +        printf("%s\t", carbonRow.getVarchar(3));
    +        jobjectArray arr = carbonRow.getArray(4);
    +        jsize length = env->GetArrayLength(arr);
    +        int j = 0;
    +        for (j = 0; j < length; j++) {
    +            jobject element = env->GetObjectArrayElement(arr, j);
    +            char *str = (char *) env->GetStringUTFChars((jstring) element, 
JNI_FALSE);
    +            printf("%s\t", str);
    +        }
    +        env->DeleteLocalRef(arr);
    +        printf("%d\t", carbonRow.getShort(5));
    +        printf("%d\t", carbonRow.getInt(6));
    +        printf("%ld\t", carbonRow.getLong(7));
    +        printf("%lf\t", carbonRow.getDouble(8));
    +        bool bool1 = carbonRow.getBoolean(9);
    +        if (bool1) {
    +            printf("true\t");
    +        } else {
    +            printf("false\t");
    +        }
    +        printf("%s\t", carbonRow.getDecimal(10));
    +        printf("%f\t", carbonRow.getFloat(11));
    +        printf("\n");
    +        env->DeleteLocalRef(row);
    +    }
    +    gettimeofday(&read, NULL);
    +    time = 1000000 * (read.tv_sec - start.tv_sec) + read.tv_usec - 
start.tv_usec;
    +    printf("total lines is %d: build time: %lf, read time is %lf s, 
average speed is %lf records/s\n",
    +           i, buildTime, time / 1000000.0, i / (time / 1000000.0));
    +
    +    reader.close();
    +}
    +
    +/**
    + * read data from S3
    + * parameter is ak sk endpoint
    + *
    + * @param env jni env
    + * @param argv argument vector
    + * @return
    + */
    +bool readFromS3ForBigData(JNIEnv *env, char **argv) {
    --- End diff --
    
    same as above


---

Reply via email to