[GitHub] carbondata pull request #3004: [WIP] Create carbon table as hive understanda...

classic Classic list List threaded Threaded
29 messages Options
12
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [WIP] Create carbon table as hive understanda...

qiuchenjian-2
GitHub user ravipesala opened a pull request:

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

    [WIP] Create carbon table as hive understandable metastore table needed by Presto and Hive

    Problem:
    Current carbon table created in spark creates the hive table internally but it does not have much information like schema, input/output format and location details. So other execution engines like Presto and Hive cannot read the table.
   
    Reason:
    Spark always checks in HiveSerde static map whether it is a hive supported table or not, since carbon is not registered to that map it cannot create hive understandable table. It justs creates a table without schema and location and adds its own schema as part of properties.
   
    Solution:
    Add the carbon details also to HiveSerde static map so that it can create Hive understandable table.
   
    Be sure to do all of the following checklist to help us incorporate
    your contribution quickly and easily:
   
     - [ ] Any interfaces changed?
     
     - [ ] Any backward compatibility impacted?
     
     - [ ] Document update required?
   
     - [ ] Testing done
            Please provide details on
            - Whether new unit test cases have been added or why no new tests are required?
            - How it is tested? Please attach test report.
            - Is it a performance related change? Please attach the performance test report.
            - Any additional information to help reviewers in testing this change.
           
     - [ ] 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/ravipesala/incubator-carbondata correct-carbon-table-creation

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

    https://github.com/apache/carbondata/pull/3004.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 #3004
   
----
commit 5218664382353d8ec8f7b3303eec46e1796c15c1
Author: ravipesala <ravi.pesala@...>
Date:   2018-12-19T16:30:57Z

    Create carbon table as hive metastore table

----


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [WIP] Create carbon table as hive understandable met...

qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1854/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [WIP] Create carbon table as hive understandable met...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Failed  with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1855/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [WIP] Create carbon table as hive understandable met...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1856/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [WIP] Create carbon table as hive understandable met...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Success with Spark 2.3.2, Please check CI http://136.243.101.176:8080/job/carbondataprbuilder2.3/10111/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [WIP] Create carbon table as hive understandable met...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Success with Spark 2.2.1, Please check CI http://95.216.28.178:8080/job/ApacheCarbonPRBuilder1/2064/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user SteNicholas commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    @ravipesala This pull request doesn't work in #3012 .HiveExample run exception through your changes.But this update does work in beeline.Therefore will you check the cause of HiveExample exception with me?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user ravipesala commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    @SteNicholas This PR does not work directly on the Hive integration as we need to set the right serde, inputformat and output format. We are planning to refactor the current Hive integration code to unify the inpuformat and outputformat with the hadoop modules input/outformats.  This PR is basic step for both Hive and Presto integration.


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user SteNicholas commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    @ravipesala Could I refactor the current Hive integration code with you?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001631
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    --- End diff --
   
    please use STORED AS carbondata


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001671
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    --- End diff --
   
    ```suggestion
             |STORED AS carbondata
    ```


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001830
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    --- End diff --
   
    use assertResult so that it can show the actual value when failed


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001857
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    --- End diff --
   
    same for line 61, 63


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001878
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    +    if (SparkUtil.isSparkVersionEqualTo("2.2")) {
    +      assert(table.storage.locationUri.get.equals(new Path(s"file:$storeLocation/source").toUri))
    +    }
    +    assert(table.storage.inputFormat.get.equals(classOf[CarbonFileInputFormat[_]].getName))
    +  }
    +
    +  test("test create table and verify the hive table correctness with using carbondata") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |using carbondata
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +
    --- End diff --
   
    remove extra line


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244001900
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    +    if (SparkUtil.isSparkVersionEqualTo("2.2")) {
    +      assert(table.storage.locationUri.get.equals(new Path(s"file:$storeLocation/source").toUri))
    +    }
    +    assert(table.storage.inputFormat.get.equals(classOf[CarbonFileInputFormat[_]].getName))
    +  }
    +
    +  test("test create table and verify the hive table correctness with using carbondata") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |using carbondata
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with using carbon") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |using carbon
    +     """.stripMargin)
    +
    +    verifyTable
    +
    --- End diff --
   
    remove extra line


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244002150
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    +    if (SparkUtil.isSparkVersionEqualTo("2.2")) {
    +      assert(table.storage.locationUri.get.equals(new Path(s"file:$storeLocation/source").toUri))
    +    }
    +    assert(table.storage.inputFormat.get.equals(classOf[CarbonFileInputFormat[_]].getName))
    --- End diff --
   
    please assert the serde class and outputformat class also


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata pull request #3004: [CARBONDATA-3188] Create carbon table as hive...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on a diff in the pull request:

    https://github.com/apache/carbondata/pull/3004#discussion_r244002248
 
    --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/createTable/TestCreateHiveTableWithCarbonDS.scala ---
    @@ -0,0 +1,94 @@
    +/*
    + * 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
    +
    +import java.io.File
    +
    +import org.apache.hadoop.fs.Path
    +import org.apache.spark.sql.catalyst.TableIdentifier
    +import org.apache.spark.sql.hive.CarbonSessionCatalog
    +import org.apache.spark.sql.test.util.QueryTest
    +import org.apache.spark.sql.{AnalysisException, CarbonEnv, CarbonSession}
    +import org.apache.spark.util.SparkUtil
    +import org.scalatest.BeforeAndAfterAll
    +
    +import org.apache.carbondata.core.constants.CarbonCommonConstants
    +import org.apache.carbondata.core.util.CarbonProperties
    +import org.apache.carbondata.hadoop.api.CarbonFileInputFormat
    +
    +class TestCreateHiveTableWithCarbonDS extends QueryTest with BeforeAndAfterAll {
    +
    +  override def beforeAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  override def afterAll(): Unit = {
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  test("test create table and verify the hive table correctness with stored by") {
    +    sql("DROP TABLE IF EXISTS source")
    +    sql(
    +      s"""
    +         |CREATE TABLE source (key INT, value string, col1 double)
    +         |STORED BY 'carbondata'
    +     """.stripMargin)
    +
    +    verifyTable
    +
    +    sql("DROP TABLE IF EXISTS source")
    +  }
    +
    +  private def verifyTable = {
    +    val table = sqlContext.sparkSession.asInstanceOf[CarbonSession].sessionState.catalog.asInstanceOf[CarbonSessionCatalog].getClient().getTable("default", "source")
    +    assert(table.schema.fields.length == 3)
    +    if (SparkUtil.isSparkVersionEqualTo("2.2")) {
    +      assert(table.storage.locationUri.get.equals(new Path(s"file:$storeLocation/source").toUri))
    +    }
    +    assert(table.storage.inputFormat.get.equals(classOf[CarbonFileInputFormat[_]].getName))
    --- End diff --
   
    Shouldn't it be CarbonTableInputFormat class?


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user jackylk commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    @SteNicholas Let's first merge this PR and then you can start refactory on carbondata-hive module


---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder2.1/1961/



---
Reply | Threaded
Open this post in threaded view
|

[GitHub] carbondata issue #3004: [CARBONDATA-3188] Create carbon table as hive unders...

qiuchenjian-2
In reply to this post by qiuchenjian-2
Github user SteNicholas commented on the issue:

    https://github.com/apache/carbondata/pull/3004
 
    @jackylk OK.I'd like to refactory on carbondata-hive module based on @ravipesala update.


---
12