carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject carbondata git commit: [CARBONDATA-2404] Add documentation for using carbondata and stored as carbondata
Date Thu, 03 May 2018 03:45:46 GMT
Repository: carbondata
Updated Branches:
  refs/heads/master 1c84d69f2 -> 380473b40


[CARBONDATA-2404] Add documentation for using carbondata and stored as carbondata

Add documentation for using carbondata and stored as carbondata

This closes #2230


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

Branch: refs/heads/master
Commit: 380473b408ef606c20a4b00d51ed90d5a245e695
Parents: 1c84d69
Author: xubo245 <601450868@qq.com>
Authored: Thu Apr 26 17:35:56 2018 +0800
Committer: chenliang613 <chenliang613@huawei.com>
Committed: Thu May 3 11:45:34 2018 +0800

----------------------------------------------------------------------
 docs/data-management-on-carbondata.md                  |  3 ++-
 .../carbondata/examples/CarbonSessionExample.scala     | 13 +++++++++++++
 2 files changed, 15 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/380473b4/docs/data-management-on-carbondata.md
----------------------------------------------------------------------
diff --git a/docs/data-management-on-carbondata.md b/docs/data-management-on-carbondata.md
index 1f12b78..51e98ab 100644
--- a/docs/data-management-on-carbondata.md
+++ b/docs/data-management-on-carbondata.md
@@ -39,7 +39,7 @@ This tutorial is going to introduce all commands and data operations on
CarbonDa
   [TBLPROPERTIES (property_name=property_value, ...)]
   [LOCATION 'path']
   ```
-  
+  **NOTE:** CarbonData also supports "STORED AS carbondata". Find example code at [CarbonSessionExample](https://github.com/apache/carbondata/blob/master/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala)
in the CarbonData repo.
 ### Usage Guidelines
 
   Following are the guidelines for TBLPROPERTIES, CarbonData's additional table options can
be set via carbon.properties.
@@ -138,6 +138,7 @@ This tutorial is going to introduce all commands and data operations on
CarbonDa
     TBLPROPERTIES ('SORT_COLUMNS'='productName,storeCity',
                    'SORT_SCOPE'='NO_SORT')
    ```
+  **NOTE:** CarbonData also supports "using carbondata". Find example code at [SparkSessionExample](https://github.com/apache/carbondata/blob/master/examples/spark2/src/main/scala/org/apache/carbondata/examples/SparkSessionExample.scala)
in the CarbonData repo.
 
 ## CREATE TABLE AS SELECT
   This function allows user to create a Carbon table from any of the Parquet/Hive/Carbon
table. This is beneficial when the user wants to create Carbon table from any other Parquet/Hive
table and use the Carbon query engine to query and achieve better query results for cases
where Carbon is faster than other file formats. Also this feature can be used for backing
up the data.

http://git-wip-us.apache.org/repos/asf/carbondata/blob/380473b4/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala
----------------------------------------------------------------------
diff --git a/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala
b/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala
index a0ceeca..2883ded 100644
--- a/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala
+++ b/examples/spark2/src/main/scala/org/apache/carbondata/examples/CarbonSessionExample.scala
@@ -50,6 +50,7 @@ object CarbonSessionExample {
                             + "../../../..").getCanonicalPath
 
     spark.sql("DROP TABLE IF EXISTS carbonsession_table")
+    spark.sql("DROP TABLE IF EXISTS stored_as_carbondata_table")
 
     // Create table
     spark.sql(
@@ -135,7 +136,19 @@ object CarbonSessionExample {
          | WHERE stringField = 'spark' and floatField > 2.8
        """.stripMargin).show()
 
+    spark.sql(
+      s"""
+         | CREATE TABLE stored_as_carbondata_table(
+         |    name STRING,
+         |    age INT
+         |    )
+         | STORED AS carbondata
+       """.stripMargin)
+    spark.sql("INSERT INTO stored_as_carbondata_table VALUES ('Bob',28) ")
+    spark.sql("SELECT * FROM stored_as_carbondata_table").show()
+
     // Drop table
     spark.sql("DROP TABLE IF EXISTS carbonsession_table")
+    spark.sql("DROP TABLE IF EXISTS stored_as_carbondata_table")
   }
 }
\ No newline at end of file


Mime
View raw message