jackylk commented on a change in pull request #3415: [CARBONDATA-3553] Support SDK Writer using existing schema file
URL:
https://github.com/apache/carbondata/pull/3415#discussion_r336920600
##########
File path: core/src/main/java/org/apache/carbondata/core/metadata/schema/SchemaReader.java
##########
@@ -58,6 +58,48 @@ public static CarbonTable readCarbonTableFromStore(AbsoluteTableIdentifier ident
}
}
+ /**
+ * Read specified schema file as CarbonTable
+ * @param schemaFilePath schema file path
+ * @param conf hadoop configuration
+ * @return CarbonTable object
+ * @throws IOException if IO error occurs
+ */
+ public static CarbonTable readCarbonTableFromSchema(String schemaFilePath, Configuration conf)
+ throws IOException {
+ TableInfo tableInfo = readTableInfoFromSchema(schemaFilePath, conf);
+ CarbonMetadata.getInstance().loadTableMetadata(tableInfo);
+ return CarbonMetadata.getInstance().getCarbonTable("dummy_dummy");
+ }
+
+ /**
+ * Read specified schema file as TableInfo
+ * @param schemaFilePath schema file path
+ * @param conf hadoop configuration
+ * @return TableInfo object
+ * @throws IOException if IO error occurs
+ */
+ public static TableInfo readTableInfoFromSchema(String schemaFilePath, Configuration conf)
+ throws IOException {
+ if (FileFactory.isFileExist(schemaFilePath, FileFactory.FileType.LOCAL) ||
Review comment:
Use `FileFactory.isFileExist(schemaFilePath)` instead of multiple calls
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[hidden email]
With regards,
Apache Git Services