You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ja...@apache.org on 2016/11/19 15:09:41 UTC

[1/2] incubator-carbondata git commit: Added example for loading data using case class

Repository: incubator-carbondata
Updated Branches:
  refs/heads/master 8201132bb -> 4aeba911b


Added example for loading data using case class

Added drop table query in CaseClassDataFrameAPIExample

Changed import order in CaseClassDataFrameAPIExample

Formatted imports

Changed ordering in import statementin CaseClassDataFrameAPIExample

Refactored parameter


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

Branch: refs/heads/master
Commit: 290920189327bcde1c224fdc19a2d3dc995a9fdd
Parents: 8201132
Author: SangeetaGulia <sa...@knoldus.in>
Authored: Fri Nov 18 12:36:45 2016 +0530
Committer: jackylk <ja...@huawei.com>
Committed: Sat Nov 19 23:04:27 2016 +0800

----------------------------------------------------------------------
 .../examples/CaseClassDataFrameAPIExample.scala | 49 ++++++++++++++++++++
 1 file changed, 49 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/29092018/examples/src/main/scala/org/apache/carbondata/examples/CaseClassDataFrameAPIExample.scala
----------------------------------------------------------------------
diff --git a/examples/src/main/scala/org/apache/carbondata/examples/CaseClassDataFrameAPIExample.scala b/examples/src/main/scala/org/apache/carbondata/examples/CaseClassDataFrameAPIExample.scala
new file mode 100644
index 0000000..21bd002
--- /dev/null
+++ b/examples/src/main/scala/org/apache/carbondata/examples/CaseClassDataFrameAPIExample.scala
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+package org.apache.carbondata.examples
+
+import org.apache.spark.rdd.RDD
+import org.apache.spark.sql.{DataFrame, SaveMode}
+
+import org.apache.carbondata.examples.util.ExampleUtils
+
+case class People(name: String, occupation: String, id: Int)
+
+object CaseClassDataFrameAPIExample {
+
+  def main(args: Array[String]) {
+    val cc = ExampleUtils.createCarbonContext("CaseClassDataFrameAPIExample")
+    import cc.implicits._
+
+    val people = List(People("sangeeta", "engineer", 1), People("pallavi", "consultant", 2))
+    val peopleRDD: RDD[People] = cc.sc.parallelize(people)
+    val peopleDF: DataFrame = peopleRDD.toDF("name", "occupation", "id")
+
+    // writing data to carbon table
+    peopleDF.write
+      .format("carbondata")
+      .option("tableName", "carbon2")
+      .option("compress", "true")
+      .mode(SaveMode.Overwrite)
+      .save()
+
+    cc.sql("SELECT * FROM carbon2").show()
+
+    cc.sql("DROP TABLE IF EXISTS carbon2")
+  }
+}


[2/2] incubator-carbondata git commit: [CARBONDATA-423] - Added Example to Load Data to carbon Table using case class This closes #330

Posted by ja...@apache.org.
[CARBONDATA-423] - Added Example to Load Data to carbon Table using case class This closes #330


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

Branch: refs/heads/master
Commit: 4aeba911b711e5dcf1616889b7f332a748b8f3a2
Parents: 8201132 2909201
Author: jackylk <ja...@huawei.com>
Authored: Sat Nov 19 23:08:59 2016 +0800
Committer: jackylk <ja...@huawei.com>
Committed: Sat Nov 19 23:08:59 2016 +0800

----------------------------------------------------------------------
 .../examples/CaseClassDataFrameAPIExample.scala | 49 ++++++++++++++++++++
 1 file changed, 49 insertions(+)
----------------------------------------------------------------------