carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From gvram...@apache.org
Subject [18/50] [abbrv] carbondata git commit: [CARBONDATA-2440] doc updated to set the property for SDK user
Date Fri, 08 Jun 2018 11:40:43 GMT
[CARBONDATA-2440] doc updated to set the property for SDK user

doc updated to set the property for SDK user

This closes #2274


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/e1ef85ac
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/e1ef85ac
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/e1ef85ac

Branch: refs/heads/spark-2.3
Commit: e1ef85ac749e3fade0942d746c9e18533aa6f620
Parents: 07a77fa
Author: rahulforallp <rahul.kumar@knoldus.in>
Authored: Fri May 11 16:10:49 2018 +0530
Committer: chenliang613 <chenliang613@huawei.com>
Committed: Tue May 22 19:02:13 2018 +0800

----------------------------------------------------------------------
 docs/sdk-writer-guide.md | 62 ++++++++++++++++++++++++++++++++++++++++---
 1 file changed, 58 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/e1ef85ac/docs/sdk-writer-guide.md
----------------------------------------------------------------------
diff --git a/docs/sdk-writer-guide.md b/docs/sdk-writer-guide.md
index 682b27a..3d9a3de 100644
--- a/docs/sdk-writer-guide.md
+++ b/docs/sdk-writer-guide.md
@@ -13,25 +13,33 @@ These SDK writer output contains just a carbondata and carbonindex files.
No met
  
  import org.apache.carbondata.common.exceptions.sql.InvalidLoadOptionException;
  import org.apache.carbondata.core.metadata.datatype.DataTypes;
+ import org.apache.carbondata.core.util.CarbonProperties;
  import org.apache.carbondata.sdk.file.CarbonWriter;
  import org.apache.carbondata.sdk.file.CarbonWriterBuilder;
  import org.apache.carbondata.sdk.file.Field;
  import org.apache.carbondata.sdk.file.Schema;
  
  public class TestSdk {
- 
+
+   // pass true or false while executing the main to use offheap memory or not
    public static void main(String[] args) throws IOException, InvalidLoadOptionException
{
-     testSdkWriter();
+     if (args.length > 0 && args[0] != null) {
+       testSdkWriter(args[0]);
+     } else {
+       testSdkWriter("true");
+     }
    }
  
-   public static void testSdkWriter() throws IOException, InvalidLoadOptionException {
-     String path = "/home/root1/Documents/ab/temp";
+   public static void testSdkWriter(String enableOffheap) throws IOException, InvalidLoadOptionException
{
+     String path = "./target/testCSVSdkWriter";
  
      Field[] fields = new Field[2];
      fields[0] = new Field("name", DataTypes.STRING);
      fields[1] = new Field("age", DataTypes.INT);
  
      Schema schema = new Schema(fields);
+
+     CarbonProperties.getInstance().addProperty("enable.offheap.sort", enableOffheap);
  
      CarbonWriterBuilder builder = CarbonWriter.builder().outputPath(path);
  
@@ -334,6 +342,52 @@ public Schema(Field[] fields);
 public static Schema parseJson(String json);
 ```
 
+### Class org.apache.carbondata.core.util.CarbonProperties
+
+```
+/**
+* This method will be responsible to get the instance of CarbonProperties class
+*
+* @return carbon properties instance
+*/
+public static CarbonProperties getInstance();
+```
+
+```
+/**
+* This method will be used to add a new property
+*
+* @param key is a property name to set for carbon.
+* @param value is valid parameter corresponding to property.
+* @return CarbonProperties object
+*/
+public CarbonProperties addProperty(String key, String value);
+```
+
+```
+/**
+* This method will be used to get the property value. If property is not
+* present, then it will return the default value.
+*
+* @param key is a property name to get user specified value.
+* @return properties value for corresponding key. If not set, then returns null.
+*/
+public String getProperty(String key);
+```
+
+```
+/**
+* This method will be used to get the property value. If property is not
+* present, then it will return the default value.
+*
+* @param key is a property name to get user specified value..
+* @param defaultValue used to be returned by function if corrosponding key not set.
+* @return properties value for corresponding key. If not set, then returns specified defaultValue.
+*/
+public String getProperty(String key, String defaultValue);
+```
+Reference : [list of carbon properties](http://carbondata.apache.org/configuration-parameters.html)
+
 ### Class org.apache.carbondata.sdk.file.AvroCarbonWriter
 ```
 /**


Mime
View raw message