carbondata-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From chenliang...@apache.org
Subject [17/35] incubator-carbondata-site git commit: Updated website for CarbonData release 1.0.0
Date Sat, 04 Feb 2017 02:38:16 GMT
http://git-wip-us.apache.org/repos/asf/incubator-carbondata-site/blob/0d4cdb1c/content/docs/latest/quick-start-guide.html
----------------------------------------------------------------------
diff --git a/content/docs/latest/quick-start-guide.html b/content/docs/latest/quick-start-guide.html
new file mode 100644
index 0000000..8402e55
--- /dev/null
+++ b/content/docs/latest/quick-start-guide.html
@@ -0,0 +1,92 @@
+<!--
+    Licensed to the Apache Software Foundation (ASF) under one
+    or more contributor license agreements.  See the NOTICE file
+    distributed with this work for additional information
+    regarding copyright ownership.  The ASF licenses this file
+    to you under the Apache License, Version 2.0 (the
+    "License"); you may not use this file except in compliance
+    with the License.  You may obtain a copy of the License at
+
+      http://www.apache.org/licenses/LICENSE-2.0
+
+    Unless required by applicable law or agreed to in writing,
+    software distributed under the License is distributed on an
+    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+    KIND, either express or implied.  See the License for the
+    specific language governing permissions and limitations
+    under the License.
+--><h1>Quick Start</h1><p>This tutorial provides a quick introduction
to using CarbonData.</p><h2>
+    Prerequisites</h2>
+<ul>
+    <li><a href="https://github.com/apache/incubator-carbondata/blob/master/build"
target="_blank">Installation and
+        building CarbonData</a>.
+    </li>
+    <li>Create a sample.csv file using the following commands. The CSV file is required
for loading
+        data into CarbonData.
+    </li>
+</ul><p><code>
+    cd carbondata
+    cat &gt; sample.csv &lt;&lt; EOF
+    id,name,city,age
+    1,david,shenzhen,31
+    2,eason,shenzhen,27
+    3,jarry,wuhan,35
+    EOF
+</code></p><h2>Interactive Analysis with Spark Shell Version 2.1</h2><p>Apache
Spark Shell provides
+    a simple way to learn the API, as well as a powerful tool to analyze data interactively.
Please
+    visit <a href="http://spark.apache.org/docs/latest/" target="_blank">Apache Spark
Documentation</a> for more
+    details on Spark shell.</p><h4>Basics</h4><p>Start Spark shell
by running the following command
+    in the Spark directory:</p><p><code>
+    ./bin/spark-shell --jars &lt;carbondata assembly jar path&gt;
+</code></p><p>In this shell, SparkSession is readily available as 'spark'
and Spark context is
+    readily available as 'sc'.</p><p>In order to create a CarbonSession we will
have to configure it
+    explicitly in the following manner :</p>
+<ul>
+    <li>Import the following :</li>
+</ul><p><code>
+    import org.apache.spark.sql.SparkSession
+    import org.apache.spark.sql.CarbonSession._
+</code></p>
+<ul>
+    <li>Create a CarbonSession :</li>
+</ul><p><code>
+    val carbon = SparkSession.builder().config(sc.getConf).getOrCreateCarbonSession()
+</code></p><h4>Executing Queries</h4><h5>Creating a Table</h5><p><code>
+    scala&gt;carbon.sql(&quot;CREATE TABLE IF NOT EXISTS test_table(id string, name
string, city
+    string, age Int) STORED BY &#39;carbondata&#39;&quot;)
+</code></p><h5>Loading Data to a Table</h5><p><code>
+    scala&gt;carbon.sql(&quot;LOAD DATA INPATH &#39;sample.csv file path&#39;
INTO TABLE test_table&quot;)
+</code> NOTE:Please provide the real file path of sample.csv for the above script.</p><h6>Query
Data
+    from a Table</h6><p><code>scala&gt;carbon.sql("SELECT * FROM test_table").show()</code></p><p><code>scala&gt;carbon.sql("SELECT
+    city, avg(age), sum(age) FROM test_table GROUP BY city").show()</code></p>
+<h2>Interactive Analysis with Spark Shell Version 1.6</h2>
+<h4>Basics</h4><p>Start Spark shell by running the following
+    command in the Spark directory:</p><p><code>
+    ./bin/spark-shell --jars &lt;carbondata assembly jar path&gt;
+</code></p><p>NOTE: In this shell, SparkContext is readily available as
sc.</p>
+<ul>
+    <li>In order to execute the Queries we need to import CarbonContext:</li>
+</ul><p><code>
+    import org.apache.spark.sql.CarbonContext
+</code></p>
+<ul>
+    <li>Create an instance of CarbonContext in the following manner :</li>
+</ul><p><code>
+    val cc = new CarbonContext(sc)
+</code></p><p>NOTE: By default store location is pointed to "../carbon.store",
user can provide own
+    store location to CarbonContext like new CarbonContext(sc, storeLocation).</p><h4>Executing
+    Queries</h4>
+<h5>Creating a Table</h5><p><code>
+    scala&gt;cc.sql(&quot;CREATE TABLE IF NOT EXISTS test_table (id string, name
string, city
+    string, age Int) STORED BY &#39;carbondata&#39;&quot;)
+</code>
+</p>To see the table created :<p><code>
+    scala&gt;cc.sql(&quot;SHOW TABLES&quot;).show()
+</code></p><h5>Loading Data to a Table</h5><p><code>
+    scala&gt;cc.sql(&quot;LOAD DATA INPATH &#39;sample.csv file path&#39;
INTO TABLE test_table&quot;)
+</code><br/>
+<p>NOTE:Please provide the real file path of sample.csv for the above script.</p><h5>Query
+    Data from a Table</h5><p><code>
+    scala&gt;cc.sql(&quot;SELECT * FROM test_table&quot;).show()
+    scala&gt;cc.sql(&quot;SELECT city, avg(age), sum(age) FROM test_table GROUP BY
city&quot;).show()
+</code></p>
\ No newline at end of file


Mime
View raw message