Github user ajantha-bhat commented on a diff in the pull request: https://github.com/apache/carbondata/pull/2804#discussion_r229583983 --- Diff: store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonSchemaReader.java --- @@ -64,11 +66,70 @@ public static Schema readSchemaInSchemaFile(String schemaFilePath) throws IOExce /** * Read carbondata file and return the schema * - * @param dataFilePath complete path including carbondata file name + * @param path carbondata store path * @return Schema object * @throws IOException */ - public static Schema readSchemaInDataFile(String dataFilePath) throws IOException { + public static Schema readSchemaFromFirstDataFile(String path) throws IOException { + String dataFilePath = getFirstCarbonDataFile(path); + return readSchemaInDataFile(dataFilePath); + } + + /** + * get first carbondata file in path and don't check all files schema + * + * @param path carbondata file path + * @return first carbondata file name + */ + public static String getFirstCarbonDataFile(String path) { --- End diff -- I have already suggested to keep getFirstCarbonFile(path, extension) -- this only will give data or index file based on the extension. no need to have duplicate code for both index and data file
---