GitHub user mayunSaicmotor opened a pull request:
https://github.com/apache/carbondata/pull/1094 [CARBONDATA-1181] Show partitions Show table partition information You can merge this pull request into a Git repository by running: $ git pull https://github.com/mayunSaicmotor/incubator-carbondata SHOW-PARTITION Alternatively you can review and apply these changes as the patch at: https://github.com/apache/carbondata/pull/1094.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 #1094 ---- commit e41b983ab07c01449d9e1d43f694a2f87d6c90bc Author: mayun <[hidden email]> Date: 2017-06-25T04:12:06Z show partition function ---- --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
Github user asfgit commented on the issue:
https://github.com/apache/carbondata/pull/1094 Can one of the admins verify this patch? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/118/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2692/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user asfgit commented on the issue:
https://github.com/apache/carbondata/pull/1094 Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/carbondata-pr-spark-1.6/617/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user chenerlu commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123893046 --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala --- @@ -0,0 +1,128 @@ +/* + * 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 scala.collection.mutable.LinkedHashMap + +import org.apache.spark.sql.AnalysisException + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties +import org.apache.carbondata.examples.util.ExampleUtils + +object CarbonPartitionExample { + def main(args: Array[String]) { + CarbonPartitionExample.extracted("t3", args) + } + def extracted(tableName: String, args: Array[String]): Unit = { + val cc = ExampleUtils.createCarbonContext("CarbonPartitionExample") + val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv" + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd") + + // none partition table + cc.sql("DROP TABLE IF EXISTS t0") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t0 + | ( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | STORED BY 'carbondata' + """.stripMargin) + try { + cc.sql("""SHOW PARTITIONS t0""").show() + } catch { + case ex: AnalysisException => print(ex.getMessage()) + } --- End diff -- Why use try catch ? --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user chenerlu commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123893089 --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala --- @@ -0,0 +1,128 @@ +/* + * 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 scala.collection.mutable.LinkedHashMap + +import org.apache.spark.sql.AnalysisException + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties +import org.apache.carbondata.examples.util.ExampleUtils + +object CarbonPartitionExample { + def main(args: Array[String]) { + CarbonPartitionExample.extracted("t3", args) + } + def extracted(tableName: String, args: Array[String]): Unit = { + val cc = ExampleUtils.createCarbonContext("CarbonPartitionExample") + val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv" + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd") + + // none partition table + cc.sql("DROP TABLE IF EXISTS t0") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t0 + | ( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | STORED BY 'carbondata' + """.stripMargin) + try { + cc.sql("""SHOW PARTITIONS t0""").show() + } catch { + case ex: AnalysisException => print(ex.getMessage()) + } + + // range partition + cc.sql("DROP TABLE IF EXISTS t1") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t1( + | vin STRING, + | phonenumber INT, + | country STRING, + | area STRING + | ) + | PARTITIONED BY (logdate TIMESTAMP) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='RANGE', + | 'RANGE_INFO'='2014/01/01,2015/01/01,2016/01/01') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t1""").show() + + // hash partition + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t3( + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | PARTITIONED BY (vin String) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='HASH','NUM_PARTITIONS'='5') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t3""").show() + + // list partition + cc.sql("DROP TABLE IF EXISTS t5") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t5( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | area String + | ) + | PARTITIONED BY (country string) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='LIST', + | 'LIST_INFO'='(China,United States),UK ,japan,(Canada,Russia), South Korea ') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t5""").show() + + cc.sql(s"DROP TABLE IF EXISTS partitionDB.$tableName") --- End diff -- I think $tableName is not proper. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user chenerlu commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123894295 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala --- @@ -117,6 +117,8 @@ class DDLStrategy(sparkSession: SparkSession) extends SparkStrategy { sparkSession.sessionState.executePlan(UnresolvedRelation(identifier, None)).analyzed val resultPlan = sparkSession.sessionState.executePlan(resolvedTable).executedPlan ExecutedCommandExec(DescribeCommandFormatted(resultPlan, plan.output, identifier)) :: Nil + case ShowPartitionsCommand(t, cols) => + ExecutedCommandExec(ShowCarbonPartitionsCommand(t)) :: Nil --- End diff -- Test the compatible with hive partition table. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123987699 --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala --- @@ -0,0 +1,128 @@ +/* + * 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 scala.collection.mutable.LinkedHashMap + +import org.apache.spark.sql.AnalysisException + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties +import org.apache.carbondata.examples.util.ExampleUtils + +object CarbonPartitionExample { --- End diff -- No need to add seperate Example class for Partitions. --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123987924 --- Diff: integration/spark/src/main/scala/org/apache/spark/sql/execution/command/ShowCarbonPartitionsCommand.scala --- @@ -0,0 +1,51 @@ +/* + * 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.spark.sql.execution.command + +import org.apache.spark.sql._ +import org.apache.spark.sql.catalyst.TableIdentifier +import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference} +import org.apache.spark.sql.execution.RunnableCommand +import org.apache.spark.sql.types._ + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.spark.util.CommonUtil + +private[sql] case class ShowCarbonPartitionsCommand( --- End diff -- Move this case class to carbonTableSchema --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123987965 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/ShowCarbonPartitionsCommand.scala --- @@ -0,0 +1,52 @@ +/* + * 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.spark.sql.execution.command + +import org.apache.spark.sql.AnalysisException +import org.apache.spark.sql.CarbonEnv +import org.apache.spark.sql.catalyst.TableIdentifier +import org.apache.spark.sql.hive.CarbonRelation +import org.apache.spark.sql.Row +import org.apache.spark.sql.SparkSession + +import org.apache.carbondata.common.logging.LogServiceFactory +import org.apache.carbondata.spark.util.CommonUtil + +private[sql] case class ShowCarbonPartitionsCommand( --- End diff -- Move to carbonTableScheam --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user kunal642 commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r123987774 --- Diff: integration/spark-common-test/src/test/scala/org/apache/carbondata/spark/testsuite/partition/TestShowPartitions.scala --- @@ -0,0 +1,188 @@ +/* + * 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.partition + +import java.sql.Timestamp + +import org.apache.spark.sql.AnalysisException +import org.apache.spark.sql.catalyst.analysis.NoSuchDatabaseException +import org.apache.spark.sql.Row +import org.apache.spark.sql.common.util.QueryTest +import org.scalatest.BeforeAndAfterAll + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties + + + +class TestShowPartition extends QueryTest with BeforeAndAfterAll { + override def beforeAll = { + + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "dd-MM-yyyy") + + sql("drop table if exists notPartitionTable") + sql(""" + | CREATE TABLE notPartitionTable + | ( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | STORED BY 'carbondata' + """.stripMargin) + + sql("drop table if exists hashTable") + sql( + """ + | CREATE TABLE hashTable (empname String, designation String, doj Timestamp, + | workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (empno int) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='HASH','NUM_PARTITIONS'='3') + """.stripMargin) + + sql("drop table if exists rangeTable") + sql( + """ + | CREATE TABLE rangeTable (empno int, empname String, designation String, + | workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (doj Timestamp) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='RANGE', + | 'RANGE_INFO'='01-01-2010, 01-01-2015') + """.stripMargin) + + sql("drop table if exists listTable") + sql( + """ + | CREATE TABLE listTable (empno int, empname String, designation String, doj Timestamp, + | workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (workgroupcategory int) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='LIST', + | 'LIST_INFO'='0, 1, (2, 3)') + """.stripMargin) + + sql(s"CREATE DATABASE if not exists partitionDB") + sql("drop table if exists partitionDB.hashTable") + sql("drop table if exists partitionDB.rangeTable") + sql("drop table if exists partitionDB.listTable") + sql( + """ + | CREATE TABLE partitionDB.hashTable (empname String, designation String, doj Timestamp, + | workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (empno int) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='HASH','NUM_PARTITIONS'='3') + """.stripMargin) + sql( + """ + | CREATE TABLE partitionDB.rangeTable (empno int, empname String, designation String, + | workgroupcategory int, workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (doj Timestamp) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='RANGE', + | 'RANGE_INFO'='01-01-2010, 01-01-2015') + """.stripMargin) + sql( + """ + | CREATE TABLE partitionDB.listTable (empno int, empname String, designation String, + | doj Timestamp,workgroupcategoryname String, deptno int, deptname String, + | projectcode int, projectjoindate Timestamp, projectenddate Timestamp,attendance int, + | utilization int,salary int) + | PARTITIONED BY (workgroupcategory int) + | STORED BY 'org.apache.carbondata.format' + | TBLPROPERTIES('PARTITION_TYPE'='LIST', + | 'LIST_INFO'='0, 1, (2, 3)') + """.stripMargin) + + } + + test("show partition table: exception when show not partition table") { + var exceptionFlg = false + try { --- End diff -- use intercept instead of try catch --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/142/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2717/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user asfgit commented on the issue:
https://github.com/apache/carbondata/pull/1094 Refer to this link for build results (access rights to CI server needed): https://builds.apache.org/job/carbondata-pr-spark-1.6/642/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user mayunSaicmotor commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r124204837 --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala --- @@ -0,0 +1,128 @@ +/* + * 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 scala.collection.mutable.LinkedHashMap + +import org.apache.spark.sql.AnalysisException + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties +import org.apache.carbondata.examples.util.ExampleUtils + +object CarbonPartitionExample { + def main(args: Array[String]) { + CarbonPartitionExample.extracted("t3", args) + } + def extracted(tableName: String, args: Array[String]): Unit = { + val cc = ExampleUtils.createCarbonContext("CarbonPartitionExample") + val testData = ExampleUtils.currentPath + "/src/main/resources/data.csv" + CarbonProperties.getInstance() + .addProperty(CarbonCommonConstants.CARBON_TIMESTAMP_FORMAT, "yyyy/MM/dd") + + // none partition table + cc.sql("DROP TABLE IF EXISTS t0") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t0 + | ( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | STORED BY 'carbondata' + """.stripMargin) + try { + cc.sql("""SHOW PARTITIONS t0""").show() + } catch { + case ex: AnalysisException => print(ex.getMessage()) + } + + // range partition + cc.sql("DROP TABLE IF EXISTS t1") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t1( + | vin STRING, + | phonenumber INT, + | country STRING, + | area STRING + | ) + | PARTITIONED BY (logdate TIMESTAMP) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='RANGE', + | 'RANGE_INFO'='2014/01/01,2015/01/01,2016/01/01') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t1""").show() + + // hash partition + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t3( + | logdate Timestamp, + | phonenumber Int, + | country String, + | area String + | ) + | PARTITIONED BY (vin String) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='HASH','NUM_PARTITIONS'='5') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t3""").show() + + // list partition + cc.sql("DROP TABLE IF EXISTS t5") + cc.sql(""" + | CREATE TABLE IF NOT EXISTS t5( + | vin String, + | logdate Timestamp, + | phonenumber Int, + | area String + | ) + | PARTITIONED BY (country string) + | STORED BY 'carbondata' + | TBLPROPERTIES('PARTITION_TYPE'='LIST', + | 'LIST_INFO'='(China,United States),UK ,japan,(Canada,Russia), South Korea ') + """.stripMargin) + cc.sql("""SHOW PARTITIONS t5""").show() + + cc.sql(s"DROP TABLE IF EXISTS partitionDB.$tableName") --- End diff -- fixed --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user mayunSaicmotor commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r124204888 --- Diff: integration/spark2/src/main/scala/org/apache/spark/sql/execution/command/DDLStrategy.scala --- @@ -117,6 +117,8 @@ class DDLStrategy(sparkSession: SparkSession) extends SparkStrategy { sparkSession.sessionState.executePlan(UnresolvedRelation(identifier, None)).analyzed val resultPlan = sparkSession.sessionState.executePlan(resolvedTable).executedPlan ExecutedCommandExec(DescribeCommandFormatted(resultPlan, plan.output, identifier)) :: Nil + case ShowPartitionsCommand(t, cols) => + ExecutedCommandExec(ShowCarbonPartitionsCommand(t)) :: Nil --- End diff -- fixed --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 2.1.0, Please check CI http://136.243.101.176:8080/job/ApacheCarbonPRBuilder/2722/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user mayunSaicmotor commented on a diff in the pull request:
https://github.com/apache/carbondata/pull/1094#discussion_r124206197 --- Diff: examples/spark/src/main/scala/org/apache/carbondata/examples/CarbonPartitionExample.scala --- @@ -0,0 +1,128 @@ +/* + * 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 scala.collection.mutable.LinkedHashMap + +import org.apache.spark.sql.AnalysisException + +import org.apache.carbondata.core.constants.CarbonCommonConstants +import org.apache.carbondata.core.util.CarbonProperties +import org.apache.carbondata.examples.util.ExampleUtils + +object CarbonPartitionExample { --- End diff -- do you mean delete this class? actually it is convenient for users to take a look âshow partitionâ result on spark1.6 and for me as a dev user, I can use it to test and debug --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
In reply to this post by qiuchenjian-2
Github user CarbonDataQA commented on the issue:
https://github.com/apache/carbondata/pull/1094 Build Success with Spark 1.6, Please check CI http://144.76.159.231:8080/job/ApacheCarbonPRBuilder/147/ --- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at [hidden email] or file a JIRA ticket with INFRA. --- |
Free forum by Nabble | Edit this page |