Repository: carbondata Updated Branches: refs/heads/master 6e04fe65a -> c55279c5c
[CARBONDATA-3095] Optimize the documentation of SDK/CSDK Optimize the documentation of SDK/CSDK. 1.correct one error: after split(int maxSplits) of sdk-guide.md, the format has problem because less ` 2.add doc 3.move the order of doc This closes #2915 Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/c55279c5 Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/c55279c5 Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/c55279c5 Branch: refs/heads/master Commit: c55279c5c464f91b9261b9d9d08f0c23dd7699bf Parents: 6e04fe6 Author: xubo245 <[email protected]> Authored: Thu Nov 29 10:07:42 2018 +0800 Committer: kunal642 <[email protected]> Committed: Fri Nov 30 15:07:36 2018 +0530 ---------------------------------------------------------------------- docs/csdk-guide.md | 103 +++++++++++++++++-- docs/sdk-guide.md | 65 ++++++++++-- store/CSDK/src/CarbonReader.h | 2 +- .../sdk/file/CarbonReaderBuilder.java | 4 +- .../sdk/file/CarbonWriterBuilder.java | 2 +- 5 files changed, 153 insertions(+), 23 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/carbondata/blob/c55279c5/docs/csdk-guide.md ---------------------------------------------------------------------- diff --git a/docs/csdk-guide.md b/docs/csdk-guide.md index 95b9cf8..6002cf5 100644 --- a/docs/csdk-guide.md +++ b/docs/csdk-guide.md @@ -53,7 +53,20 @@ C++ SDK support read batch row. User can set batch by using withBatch(int batch) * @return CarbonReaderBuilder object */ jobject builder(JNIEnv *env, char *path, char *tableName); +``` + +``` + /** + * create a CarbonReaderBuilder object for building carbonReader, + * CarbonReaderBuilder object can configure different parameter + * + * @param env JNIEnv + * @param path data store path + * */ + void builder(JNIEnv *env, char *path); +``` +``` /** * Configure the projection column names of carbon reader * @@ -62,7 +75,9 @@ C++ SDK support read batch row. User can set batch by using withBatch(int batch) * @return CarbonReaderBuilder object */ jobject projection(int argc, char *argv[]); +``` +``` /** * build carbon reader with argument vector * it support multiple parameter @@ -74,15 +89,26 @@ C++ SDK support read batch row. User can set batch by using withBatch(int batch) * @return CarbonReaderBuilder object **/ jobject withHadoopConf(int argc, char *argv[]); +``` +``` /** - * set batch size + * Sets the batch size of records to read * * @param batch batch size * @return CarbonReaderBuilder object */ void withBatch(int batch); +``` + +``` + /** + * Configure Row Record Reader for reading. + */ + void withRowRecordReader(); +``` +``` /** * build carbonReader object for reading data * it support read data from load disk @@ -90,34 +116,41 @@ C++ SDK support read batch row. User can set batch by using withBatch(int batch) * @return carbonReader object */ jobject build(); +``` +``` /** * Whether it has next row data * * @return boolean value, if it has next row, return true. if it hasn't next row, return false. */ jboolean hasNext(); +``` +``` /** * read next carbonRow from data * @return carbonRow object of one row */ jobject readNextRow(); +``` +``` /** * read Next Batch Row * * @return rows */ jobjectArray readNextBatchRow(); +``` +``` /** * close the carbon reader * * @return boolean value */ jboolean close(); - ``` # C++ SDK Writer @@ -148,6 +181,7 @@ release the memory and destroy JVM. */ void builder(JNIEnv *env); ``` + ``` /** * Sets the output path of the writer builder @@ -158,6 +192,7 @@ release the memory and destroy JVM. */ void outputPath(char *path); ``` + ``` /** * configure the schema with json style schema @@ -167,9 +202,10 @@ release the memory and destroy JVM. */ void withCsvInput(char *jsonSchema); ``` + ``` /** - * configure parameter, including ak,sk and endpoint + * Updates the hadoop configuration with the given key value * * @param key key word * @param value value @@ -177,12 +213,14 @@ release the memory and destroy JVM. */ void withHadoopConf(char *key, char *value); ``` + ``` /** * @param appName appName which is writing the carbondata files */ void writtenBy(char *appName); ``` + ``` /** * build carbonWriter object for writing data @@ -192,6 +230,7 @@ release the memory and destroy JVM. */ void build(); ``` + ``` /** * Write an object to the file, the format of the object depends on the @@ -200,6 +239,7 @@ release the memory and destroy JVM. */ void write(jobject obj); ``` + ``` /** * close the carbon Writer @@ -217,6 +257,7 @@ release the memory and destroy JVM. */ CarbonSchemaReader(JNIEnv *env); ``` + ``` /** * read schema from path, @@ -228,6 +269,7 @@ release the memory and destroy JVM. */ jobject readSchema(char *path); ``` + ``` /** * read schema from path, @@ -241,7 +283,7 @@ release the memory and destroy JVM. jobject readSchema(char *path, bool validateSchema); ``` -###Schema +### Schema ``` /** * constructor with jni env and carbon schema data @@ -250,8 +292,8 @@ release the memory and destroy JVM. * @param schema carbon schema data */ Schema(JNIEnv *env, jobject schema); - ``` + ``` /** * get fields length of schema @@ -259,8 +301,8 @@ release the memory and destroy JVM. * @return fields length */ int getFieldsLength(); - ``` + ``` /** * get field name by ordinal @@ -269,8 +311,8 @@ release the memory and destroy JVM. * @return ordinal field name */ char *getFieldName(int ordinal); - ``` + ``` /** * get field data type name by ordinal @@ -279,8 +321,8 @@ release the memory and destroy JVM. * @return ordinal field data type name */ char *getFieldDataTypeName(int ordinal); - ``` + ``` /** * get array child element data type name by ordinal @@ -289,4 +331,47 @@ release the memory and destroy JVM. * @return ordinal array child element data type name */ char *getArrayElementTypeName(int ordinal); -``` \ No newline at end of file +``` + +### CarbonProperties +``` + /** + * Constructor of CarbonProperties + * + * @param env JNI env + */ + CarbonProperties(JNIEnv *env); +``` + +``` + /** + * This method will be used to add a new property + * + * @param key property key + * @param value property value + * @return CarbonProperties object + */ + jobject addProperty(char *key, char *value); +``` + +``` + /** + * This method will be used to get the properties value + * + * @param key property key + * @return property value + */ + char *getProperty(char *key); +``` + +``` + /** + * This method will be used to get the properties value + * if property is not present then it will return the default value + * + * @param key property key + * @param defaultValue property default Value + * @return + */ + char *getProperty(char *key, char *defaultValue); +``` http://git-wip-us.apache.org/repos/asf/carbondata/blob/c55279c5/docs/sdk-guide.md ---------------------------------------------------------------------- diff --git a/docs/sdk-guide.md b/docs/sdk-guide.md index c32477a..8abc3b1 100644 --- a/docs/sdk-guide.md +++ b/docs/sdk-guide.md @@ -406,6 +406,17 @@ public CarbonWriterBuilder withHadoopConf(Configuration conf) ``` ``` + /** + * Updates the hadoop configuration with the given key value + * + * @param key key word + * @param value value + * @return this object + */ + public CarbonWriterBuilder withHadoopConf(String key, String value); +``` + +``` /** * to build a {@link CarbonWriter}, which accepts row in CSV format * @@ -478,6 +489,16 @@ public CarbonWriter build() throws IOException, InvalidLoadOptionException; ``` ### Class org.apache.carbondata.sdk.file.CarbonWriter + +``` +/** +* Create a {@link CarbonWriterBuilder} to build a {@link CarbonWriter} +*/ +public static CarbonWriterBuilder builder() { + return new CarbonWriterBuilder(); +} +``` + ``` /** * Write an object to the file, the format of the object depends on the implementation @@ -498,15 +519,6 @@ public abstract void write(Object object) throws IOException; public abstract void close() throws IOException; ``` -``` -/** -* Create a {@link CarbonWriterBuilder} to build a {@link CarbonWriter} -*/ -public static CarbonWriterBuilder builder() { - return new CarbonWriterBuilder(); -} -``` - ### Class org.apache.carbondata.sdk.file.Field ``` /** @@ -633,7 +645,7 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ * @return list of CarbonReader objects */ public List<CarbonReader> split(int maxSplits); -`` +``` ``` /** @@ -651,6 +663,13 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ ``` /** + * Read and return next batch row objects + */ + public Object[] readNextBatchRow(); +``` + +``` + /** * Close reader */ public void close(); @@ -688,6 +707,16 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ ``` ``` + /** + * Sets the batch size of records to read + * + * @param batch batch size + * @return updated CarbonReaderBuilder + */ + public CarbonReaderBuilder withBatch(int batch); +``` + +``` /** * To support hadoop configuration * @@ -698,6 +727,17 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ ``` ``` + /** + * Updates the hadoop configuration with the given key value + * + * @param key key word + * @param value value + * @return this object + */ + public CarbonReaderBuilder withHadoopConf(String key, String value); +``` + +``` /** * Build CarbonReader * @@ -717,6 +757,7 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ * @return schema object * @throws IOException */ + @Deprecated public static Schema readSchemaInSchemaFile(String schemaFilePath); ``` @@ -727,6 +768,7 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ * @param dataFilePath complete path including carbondata file name * @return Schema object */ + @Deprecated public static Schema readSchemaInDataFile(String dataFilePath); ``` @@ -738,8 +780,10 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ * @return schema object * @throws IOException */ + @Deprecated public static Schema readSchemaInIndexFile(String indexFilePath); ``` + ``` /** * read schema from path, @@ -752,6 +796,7 @@ Find example code at [CarbonReaderExample](https://github.com/apache/carbondata/ */ public static Schema readSchema(String path); ``` + ``` /** * read schema from path, http://git-wip-us.apache.org/repos/asf/carbondata/blob/c55279c5/store/CSDK/src/CarbonReader.h ---------------------------------------------------------------------- diff --git a/store/CSDK/src/CarbonReader.h b/store/CSDK/src/CarbonReader.h index 9a1daeb..0b4a82e 100644 --- a/store/CSDK/src/CarbonReader.h +++ b/store/CSDK/src/CarbonReader.h @@ -108,7 +108,7 @@ public: void withHadoopConf(char *key, char *value); /** - * set batch size + * Sets the batch size of records to read * * @param batch batch size * @return CarbonReaderBuilder object http://git-wip-us.apache.org/repos/asf/carbondata/blob/c55279c5/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java ---------------------------------------------------------------------- diff --git a/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java b/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java index 2b76d7b..82d2430 100644 --- a/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java +++ b/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonReaderBuilder.java @@ -109,7 +109,7 @@ public class CarbonReaderBuilder { } /** - * set read batch size before build + * Sets the batch size of records to read * * @param batch batch size * @return updated CarbonReaderBuilder @@ -122,7 +122,7 @@ public class CarbonReaderBuilder { } /** - * configure hadoop configuration with key value + * Updates the hadoop configuration with the given key value * * @param key key word * @param value value http://git-wip-us.apache.org/repos/asf/carbondata/blob/c55279c5/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java ---------------------------------------------------------------------- diff --git a/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java b/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java index 1ca5b74..2257639 100644 --- a/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java +++ b/store/sdk/src/main/java/org/apache/carbondata/sdk/file/CarbonWriterBuilder.java @@ -299,7 +299,7 @@ public class CarbonWriterBuilder { } /** - * configure hadoop configuration with key value + * Updates the hadoop configuration with the given key value * * @param key key word * @param value value
