Repository: carbondata Updated Branches: refs/heads/master fc2a53991 -> e622fa998
[CARBONDATA-3066]add documentation for writtenBy and getVersionDetails APIs in SDK This PR adds the documentation for new APIs added in SDK builder API- writtenBy() reader API- getVersionDetails() This closes #2888 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/e622fa99 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/e622fa99 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/e622fa99 Branch: refs/heads/master Commit: e622fa9982ba72ce7203afbd94d153e74d8e538c Parents: fc2a539 Author: akashrn5 <[email protected]> Authored: Wed Oct 31 20:13:02 2018 +0530 Committer: manishgupta88 <[email protected]> Committed: Fri Nov 2 16:18:32 2018 +0530 ---------------------------------------------------------------------- docs/sdk-guide.md | 28 +++++++++++++++++++++++++--- 1 file changed, 25 insertions(+), 3 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/e622fa99/docs/sdk-guide.md ---------------------------------------------------------------------- diff --git a/docs/sdk-guide.md b/docs/sdk-guide.md index 3a9be71..0ee1524 100644 --- a/docs/sdk-guide.md +++ b/docs/sdk-guide.md @@ -67,7 +67,7 @@ These SDK writer output contains just carbondata and carbonindex files. No metad CarbonProperties.getInstance().addProperty("enable.offheap.sort", enableOffheap); - CarbonWriterBuilder builder = CarbonWriter.builder().outputPath(path).withCsvInput(schema); + CarbonWriterBuilder builder = CarbonWriter.builder().outputPath(path).withCsvInput(schema).writtenBy("SDK"); CarbonWriter writer = builder.build(); @@ -124,7 +124,7 @@ public class TestSdkAvro { try { CarbonWriter writer = CarbonWriter.builder() .outputPath(path) - .withAvroInput(new org.apache.avro.Schema.Parser().parse(avroSchema)).build(); + .withAvroInput(new org.apache.avro.Schema.Parser().parse(avroSchema)).writtenBy("SDK").build(); for (int i = 0; i < 100; i++) { writer.write(record); @@ -164,7 +164,7 @@ public class TestSdkJson { Schema CarbonSchema = new Schema(fields); - CarbonWriterBuilder builder = CarbonWriter.builder().outputPath(path).withJsonInput(CarbonSchema); + CarbonWriterBuilder builder = CarbonWriter.builder().outputPath(path).withJsonInput(CarbonSchema).writtenBy("SDK"); // initialize json writer with carbon schema CarbonWriter writer = builder.build(); @@ -431,6 +431,16 @@ public CarbonWriterBuilder withJsonInput(Schema carbonSchema); ``` /** +* To support writing the ApplicationName which is writing the carbondata file +* This is a mandatory API to call, else the build() call will fail with error. +* @param application name which is writing the carbondata files +* @return CarbonWriterBuilder +*/ +public CarbonWriterBuilder writtenBy(String appName) { +``` + +``` +/** * Build a {@link CarbonWriter} * This writer is not thread safe, * use withThreadSafe() configuration in multi thread environment @@ -686,6 +696,18 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ public static Schema readSchemaInIndexFile(String indexFilePath); ``` +``` + /** + * This method return the version details in formatted string by reading from carbondata file + * If application name is SDK_1.0.0 and this has written the carbondata file in carbondata 1.6 project version, + * then this API returns the String "SDK_1.0.0 in version: 1.6.0-SNAPSHOT" + * @param dataFilePath complete path including carbondata file name + * @return string with information of who has written this file in which carbondata project version + * @throws IOException + */ + public static String getVersionDetails(String dataFilePath); +``` + ### Class org.apache.carbondata.sdk.file.Schema ``` /**
