Github user xubo245 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/2931#discussion_r242387341
--- Diff:
store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonSchemaReader.java
---
@@ -147,34 +170,55 @@ public static Schema readSchema(String path, boolean
validateSchema) throws IOEx
throw new CarbonDataLoadingException("No carbonindex file in this
path.");
}
} else {
- String indexFilePath = getCarbonFile(path,
INDEX_FILE_EXT)[0].getAbsolutePath();
- return readSchemaFromIndexFile(indexFilePath);
+ String indexFilePath = getCarbonFile(path, INDEX_FILE_EXT,
conf)[0].getAbsolutePath();
+ return readSchemaFromIndexFile(indexFilePath, conf);
}
}
+ /**
+ * read schema from path,
+ * path can be folder path, carbonindex file path, and carbondata file
path
+ * and user can decide whether check all files schema
+ *
+ * @param path file/folder path
+ * @param validateSchema whether check all files schema
+ * @return schema
+ * @throws IOException
+ */
+ public static Schema readSchema(String path, boolean validateSchema)
throws IOException {
+ Configuration conf = new Configuration();
+ return readSchema(path, validateSchema, conf);
+ }
+
/**
* Read carbondata file and return the schema
* This interface will be removed,
* please use readSchema instead of this interface
*
* @param dataFilePath carbondata file store path
+ * @param conf hadoop configuration support, can set s3a AK,SK,
+ * end point and other conf with this
* @return Schema object
* @throws IOException
*/
@Deprecated
- public static Schema readSchemaInDataFile(String dataFilePath) throws
IOException {
- return readSchema(dataFilePath, false);
+ public static Schema readSchemaInDataFile(String dataFilePath,
Configuration conf)
--- End diff --
ok, done
---