[GitHub] carbondata pull request #2821: [CARBONDATA-3017] Map DDL Support

2018-12-09 Thread manishnalla1994
Github user manishnalla1994 closed the pull request at:

https://github.com/apache/carbondata/pull/2821


---


[GitHub] carbondata pull request #2821: [CARBONDATA-3017] Map DDL Support

2018-12-02 Thread Indhumathi27
Github user Indhumathi27 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2821#discussion_r238161031
  
--- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateDDLForComplexMapType.scala
 ---
@@ -0,0 +1,330 @@
+/*
+
+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.spark.testsuite.createTable.TestCreateDDLForComplexMapType
+
+import java.io.File
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.test.util.QueryTest
+import org.scalatest.BeforeAndAfterAll
+
+class TestCreateDDLForComplexMapType extends QueryTest with 
BeforeAndAfterAll {
+  private val conf: Configuration = new Configuration(false)
+
+  val rootPath = new File(this.getClass.getResource("/").getPath
+  + "../../../..").getCanonicalPath
+
+  val path = 
s"$rootPath/examples/spark2/src/main/resources/mapDDLTestData.csv"
+
+  override def beforeAll(): Unit = {
+sql("DROP TABLE IF EXISTS carbon")
+  }
+
+  test("Single Map One Level") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map
+ | )
+ | STORED BY 'carbondata'
+ | """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map"))
+  }
+
+  test("Single Map with Two Nested Level") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY
+ |'carbondata'
+ |"""
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map>"))
+  }
+
+  test("Map Type with array type as value") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY 'carbondata'
+ |
+ """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map>"))
+  }
+
+  test("Map Type with struct type as value") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY
+ | 'carbondata'
+ | """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+assert(desc(0).get(1).asInstanceOf[String].trim
+  .equals("map>"))
+  }
+
+  test("Map Type as child to struct type") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField struct>
+ | )
+ | STORED BY
+ |'carbondata' """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+assert(desc(0).get(1).asInstanceOf[String].trim
+  .equals("struct>"))
+  }
+
+  test("Map Type as child to array type") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField array>
+ | )
+ | STORED BY 'carbondata'
+ | """
+ 

[GitHub] carbondata pull request #2821: [CARBONDATA-3017] Map DDL Support

2018-12-02 Thread Indhumathi27
Github user Indhumathi27 commented on a diff in the pull request:

https://github.com/apache/carbondata/pull/2821#discussion_r238160123
  
--- Diff: 
integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateDDLForComplexMapType.scala
 ---
@@ -0,0 +1,330 @@
+/*
+
+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.spark.testsuite.createTable.TestCreateDDLForComplexMapType
+
+import java.io.File
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.spark.sql.Row
+import org.apache.spark.sql.test.util.QueryTest
+import org.scalatest.BeforeAndAfterAll
+
+class TestCreateDDLForComplexMapType extends QueryTest with 
BeforeAndAfterAll {
+  private val conf: Configuration = new Configuration(false)
+
+  val rootPath = new File(this.getClass.getResource("/").getPath
+  + "../../../..").getCanonicalPath
+
+  val path = 
s"$rootPath/examples/spark2/src/main/resources/mapDDLTestData.csv"
+
+  override def beforeAll(): Unit = {
+sql("DROP TABLE IF EXISTS carbon")
+  }
+
+  test("Single Map One Level") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map
+ | )
+ | STORED BY 'carbondata'
+ | """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map"))
+  }
+
+  test("Single Map with Two Nested Level") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY
+ |'carbondata'
+ |"""
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map>"))
+  }
+
+  test("Map Type with array type as value") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY 'carbondata'
+ |
+ """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+
assert(desc(0).get(1).asInstanceOf[String].trim.equals("map>"))
+  }
+
+  test("Map Type with struct type as value") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField map>
+ | )
+ | STORED BY
+ | 'carbondata'
+ | """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+assert(desc(0).get(1).asInstanceOf[String].trim
+  .equals("map>"))
+  }
+
+  test("Map Type as child to struct type") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField struct>
+ | )
+ | STORED BY
+ |'carbondata' """
+.stripMargin)
+val desc = sql(
+  s"""
+ | Describe Formatted
+ | carbon
+ | """.stripMargin).collect()
+assert(desc(0).get(1).asInstanceOf[String].trim
+  .equals("struct>"))
+  }
+
+  test("Map Type as child to array type") {
+sql("DROP TABLE IF EXISTS carbon")
+sql(
+  s"""
+ | CREATE TABLE carbon(
+ | mapField array>
+ | )
+ | STORED BY 'carbondata'
+ | """
+ 

[GitHub] carbondata pull request #2821: [CARBONDATA-3017] Map DDL Support

2018-10-16 Thread manishnalla1994
GitHub user manishnalla1994 opened a pull request:

https://github.com/apache/carbondata/pull/2821

[CARBONDATA-3017] Map DDL Support

Support Create DDL for Map type.

 - [ ] Any interfaces changed?
 
 - [ ] Any backward compatibility impacted?
 
 - [ ] Document update required?

 - [x] Testing done
   
 - [ ] For large changes, please consider breaking it into sub-tasks under 
an umbrella JIRA. 



You can merge this pull request into a Git repository by running:

$ git pull https://github.com/manishnalla1994/carbondata MapDDLSupport16Oct

Alternatively you can review and apply these changes as the patch at:

https://github.com/apache/carbondata/pull/2821.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

This closes #2821


commit 5d8b36dfe3465cfd40668d24ffc85f0556dc66b1
Author: Manish Nalla 
Date:   2018-10-16T09:48:08Z

MapDDLSupport




---