Github user ajantha-bhat commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/2337#discussion_r190819633
  
    --- Diff: docs/sdk-guide.md ---
    @@ -398,3 +399,160 @@ Reference : [list of carbon 
properties](http://carbondata.apache.org/configurati
     */
     public static org.apache.carbondata.sdk.file.Schema 
getCarbonSchemaFromAvroSchema(String avroSchemaString);
     ```
    +# SDK Reader
    +This SDK reader reads CarbonData file and carbonindex file at a given path.
    +External client can make use of this reader to read CarbonData files 
without CarbonSession.
    +## Quick example
    +```
    +    // 1. Create carbon reader
    +    String path = "./testWriteFiles";
    +    CarbonReader reader = CarbonReader
    +        .builder(path, "_temp")
    +        .projection(new String[]{"name", "age"})
    +        .build();
    +
    +    // 2. Read data
    +    int i = 0;
    +    while (reader.hasNext()) {
    +      Object[] row = (Object[]) reader.readNextRow();
    +      System.out.println(row[0] + "\t" + row[1]);
    +      i++;
    +    }
    +    
    +    // 3. Close this reader
    +    reader.close();
    +```
    +
    +Find example code at 
[CarbonReaderExample](https://github.com/apache/carbondata/blob/master/examples/spark2/src/main/java/org/apache/carbondata/examples/sdk/CarbonReaderExample.java)
 in the CarbonData repo.
    +
    +## API List
    +
    +### org.apache.carbondata.sdk.file.CarbonReader
    +```
    + /**
    +  * Return a new CarbonReaderBuilder instance
    +  */
    +  public static CarbonReaderBuilder builder(String tablePath, String 
tableName);
    +```
    +
    +```
    +  /**
    +   * Read carbondata file and return the schema
    +   */
    +  public static List<ColumnSchema> readSchemaInDataFile(String 
dataFilePath);
    +```
    +
    +```
    + /**
    +  * Read schema file and return table info object
    +  */
    +  public static TableInfo readSchemaFile(String schemaFilePath);
    +```
    +
    +```
    +  /**
    +   * Return true if has next row
    +   */
    +  public boolean hasNext();
    +```
    +
    +```
    +  /**
    +   * Read and return next row object
    +   */
    +  public T readNextRow();
    +```
    +
    +```
    +  /**
    +   * Close reader
    +   */
    +  public void close();
    +```
    +
    +###org.apache.carbondata.sdk.file.CarbonReaderBuilder
    --- End diff --
    
    need to give space after ###, else formatting will not reflect


---

Reply via email to