Github user ajantha-bhat commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2807#discussion_r228920786
--- Diff: store/CSDK/test/main.cpp ---
@@ -116,6 +118,66 @@ void printResult(JNIEnv *env, CarbonReader reader) {
reader.close();
}
+/**
+ * test read Schema from Index File
+ *
+ * @param env jni env
+ * @return whether it is success
+ */
+bool readSchemaInIndexFile(JNIEnv *env) {
+ printf("\nread Schema from Index File:\n");
+ CarbonSchemaReader carbonSchemaReader(env);
+ jobject schema;
+ try {
+ schema = carbonSchemaReader.readSchemaInIndexFile(
+
"../../../../resources/carbondata/510199997055746_batchno0-0-null-510199277323454.carbonindex");
+ } catch (jthrowable e) {
+ env->ExceptionDescribe();
+ }
+ Schema carbonSchema(env, schema);
+ int length = carbonSchema.getFieldsLength();
+ printf("schema length is:%d\n", length);
+ for (int i = 0; i < length; i++) {
+ printf("%d\t", i);
+ printf("%s\t", carbonSchema.getFieldName(i));
+ printf("%s\n", carbonSchema.getFieldDataTypeName(i));
+ if (strcmp(carbonSchema.getFieldDataTypeName(i), "ARRAY") == 0) {
+ printf("Array Element Type Name is:%s\n",
carbonSchema.getArrayElementTypeName(i));
+ }
+ }
+ return true;
+}
+
+/**
+ * test read Schema from Data File
+ *
+ * @param env jni env
+ * @return whether it is success
+ */
+bool readSchemaInDataFile(JNIEnv *env) {
+ printf("\nread Schema from Data File:\n");
+ CarbonSchemaReader carbonSchemaReader(env);
+ jobject schema;
+ try {
+ schema = carbonSchemaReader.readSchemaInDataFile(
+
"../../../../resources/carbondata/part-0-510199997055746_batchno0-0-null-510199277323454.carbondata");
--- End diff --
cannot keep your local test case in repo. Make a general test case without
binary dependency.
---