You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ch...@apache.org on 2016/08/07 00:07:26 UTC
[1/2] incubator-carbondata git commit: Fixed describe formatted issue
Repository: incubator-carbondata
Updated Branches:
refs/heads/master 65c48abef -> ffd911fb3
Fixed describe formatted issue
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/0f552b39
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/0f552b39
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/0f552b39
Branch: refs/heads/master
Commit: 0f552b39573ff63b2f77318915edb668cf4d1798
Parents: 65c48ab
Author: ravipesala <ra...@gmail.com>
Authored: Sat Aug 6 21:11:15 2016 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Sat Aug 6 21:11:15 2016 +0530
----------------------------------------------------------------------
.../spark/sql/CarbonCatalystOperators.scala | 7 +--
.../org/apache/spark/sql/CarbonSqlParser.scala | 6 +--
.../CarbonTableIdentifierImplicit.scala | 42 +++++++++++++++
.../spark/sql/catalyst/TableIdentifier.scala | 57 --------------------
.../execution/command/carbonTableSchema.scala | 2 +-
.../spark/sql/hive/CarbonStrategies.scala | 6 +--
6 files changed, 51 insertions(+), 69 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/CarbonCatalystOperators.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonCatalystOperators.scala b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonCatalystOperators.scala
index 2f5ec6f..3729d3c 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonCatalystOperators.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonCatalystOperators.scala
@@ -70,11 +70,8 @@ case class DescribeFormattedCommand(sql: String, tblIdentifier: TableIdentifier)
extends LogicalPlan with Command {
override def children: Seq[LogicalPlan] = Seq.empty
- override def output: Seq[AttributeReference] = {
- Seq(AttributeReference("col_name", StringType, nullable = false)(),
- AttributeReference("data_type", StringType, nullable = false)(),
- AttributeReference("comment", StringType, nullable = false)())
- }
+ override def output: Seq[AttributeReference] =
+ Seq(AttributeReference("result", StringType, nullable = false)())
}
case class CarbonDictionaryCatalystDecoder(
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
index 6a460e8..585ef74 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/CarbonSqlParser.scala
@@ -28,7 +28,8 @@ import scala.util.matching.Regex
import org.apache.hadoop.hive.ql.lib.Node
import org.apache.hadoop.hive.ql.parse._
import org.apache.spark.Logging
-import org.apache.spark.sql.catalyst.{SqlLexical, _}
+import org.apache.spark.sql.catalyst._
+import org.apache.spark.sql.catalyst.CarbonTableIdentifierImplicit._
import org.apache.spark.sql.catalyst.analysis._
import org.apache.spark.sql.catalyst.plans.logical._
import org.apache.spark.sql.catalyst.trees.CurrentOrigin
@@ -41,7 +42,6 @@ import org.carbondata.common.logging.LogServiceFactory
import org.carbondata.core.carbon.metadata.datatype.DataType
import org.carbondata.core.constants.CarbonCommonConstants
import org.carbondata.core.util.DataTypeUtil
-import org.carbondata.processing.etl.DataLoadingException
import org.carbondata.spark.exception.MalformedCarbonCommandException
import org.carbondata.spark.util.CommonUtil
@@ -1178,7 +1178,7 @@ class CarbonSqlParser()
case Some(dbName) =>
TableIdentifier(tbl.toLowerCase, Some(dbName))
case None =>
- TableIdentifier(tbl.toLowerCase)
+ TableIdentifier(tbl.toLowerCase, None)
}
if (ef.isDefined && "FORMATTED".equalsIgnoreCase(ef.get)) {
new DescribeFormattedCommand("describe formatted " + tblIdentifier,
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/CarbonTableIdentifierImplicit.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/CarbonTableIdentifierImplicit.scala b/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/CarbonTableIdentifierImplicit.scala
new file mode 100644
index 0000000..7884f9d
--- /dev/null
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/CarbonTableIdentifierImplicit.scala
@@ -0,0 +1,42 @@
+/*
+ * 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.catalyst
+
+import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
+
+/**
+ * Implicit functions for [TableIdentifier]
+ */
+object CarbonTableIdentifierImplicit {
+ def apply(tableName: String): TableIdentifier = new TableIdentifier(tableName)
+
+ implicit def toTableIdentifier(tableIdentifier: Seq[String]): TableIdentifier = {
+ tableIdentifier match {
+ case Seq(dbName, tableName) => TableIdentifier(tableName, Some(dbName))
+ case Seq(tableName) => TableIdentifier(tableName, None)
+ case _ => throw new NoSuchTableException
+ }
+ }
+
+ implicit def toSequence(tableIdentifier: TableIdentifier): Seq[String] = {
+ tableIdentifier.database match {
+ case Some(dbName) => Seq(dbName, tableIdentifier.table)
+ case _ => Seq(tableIdentifier.table)
+ }
+ }
+}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/TableIdentifier.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/TableIdentifier.scala b/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/TableIdentifier.scala
deleted file mode 100644
index b5b6eff..0000000
--- a/integration/spark/src/main/scala/org/apache/spark/sql/catalyst/TableIdentifier.scala
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- * 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.catalyst
-
-import org.apache.spark.sql.catalyst.analysis.NoSuchTableException
-
-/**
- * Identifies a `table` in `database`. If `database` is not defined, the current database is used.
- */
-private[sql] case class TableIdentifier(table: String, database: Option[String]) {
- def this(table: String) = this(table, None)
-
- override def toString: String = quotedString
-
- def quotedString: String = database.map(db => s"`$db`.`$table`").getOrElse(s"`$table`")
-
- def unquotedString: String = database.map(db => s"$db.$table").getOrElse(table)
-
- def withDatabase(database: String): TableIdentifier = this.copy(database = Some(database))
-
- def toSeq: Seq[String] = database.toSeq :+ table
-
-}
-
-private[sql] object TableIdentifier {
- def apply(tableName: String): TableIdentifier = new TableIdentifier(tableName)
-
- implicit def toTableIdentifier(tableIdentifier: Seq[String]): TableIdentifier = {
- tableIdentifier match {
- case Seq(dbName, tableName) => TableIdentifier(tableName, Some(dbName))
- case Seq(tableName) => TableIdentifier(tableName, None)
- case _ => throw new NoSuchTableException
- }
- }
-
- implicit def toSequence(tableIdentifier: TableIdentifier): Seq[String] = {
- tableIdentifier.database match {
- case Some(dbName) => Seq(dbName, tableIdentifier.table)
- case _ => Seq(tableIdentifier.table)
- }
- }
-}
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
index 11358fc..2a2bf2f 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/execution/command/carbonTableSchema.scala
@@ -29,8 +29,8 @@ import scala.util.Random
import org.apache.spark.SparkEnv
import org.apache.spark.sql._
+import org.apache.spark.sql.catalyst.CarbonTableIdentifierImplicit._
import org.apache.spark.sql.catalyst.TableIdentifier
-import org.apache.spark.sql.catalyst.TableIdentifier._
import org.apache.spark.sql.catalyst.expressions.{Attribute, AttributeReference, Cast, Literal}
import org.apache.spark.sql.execution.{RunnableCommand, SparkPlan}
import org.apache.spark.sql.hive.HiveContext
http://git-wip-us.apache.org/repos/asf/incubator-carbondata/blob/0f552b39/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonStrategies.scala
----------------------------------------------------------------------
diff --git a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonStrategies.scala b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonStrategies.scala
index 8cbe26b..b1a05a1 100644
--- a/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonStrategies.scala
+++ b/integration/spark/src/main/scala/org/apache/spark/sql/hive/CarbonStrategies.scala
@@ -23,16 +23,16 @@ import scala.collection.JavaConverters._
import org.apache.spark.sql._
import org.apache.spark.sql.catalyst.analysis.UnresolvedRelation
+import org.apache.spark.sql.catalyst.CarbonTableIdentifierImplicit._
import org.apache.spark.sql.catalyst.TableIdentifier
-import org.apache.spark.sql.catalyst.TableIdentifier._
import org.apache.spark.sql.catalyst.expressions
import org.apache.spark.sql.catalyst.expressions.{AttributeSet, _}
import org.apache.spark.sql.catalyst.planning.{PhysicalOperation, QueryPlanner}
import org.apache.spark.sql.catalyst.plans.logical.{Filter => LogicalFilter, LogicalPlan}
-import org.apache.spark.sql.execution.{DescribeCommand => RunnableDescribeCommand, ExecutedCommand, Filter, Project, SparkPlan}
+import org.apache.spark.sql.execution.{ExecutedCommand, Filter, Project, SparkPlan}
import org.apache.spark.sql.execution.command._
import org.apache.spark.sql.execution.datasources.{DescribeCommand => LogicalDescribeCommand, LogicalRelation}
-import org.apache.spark.sql.hive.execution.{DescribeHiveTableCommand, DropTable, HiveNativeCommand}
+import org.apache.spark.sql.hive.execution.{DropTable, HiveNativeCommand}
import org.apache.spark.sql.optimizer.{CarbonAliasDecoderRelation, CarbonDecoderRelation}
import org.apache.spark.sql.types.IntegerType
[2/2] incubator-carbondata git commit: [CARBONDATA-147]Fixed describe
formatted issue This closes #64
Posted by ch...@apache.org.
[CARBONDATA-147]Fixed describe formatted issue This closes #64
Project: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/commit/ffd911fb
Tree: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/tree/ffd911fb
Diff: http://git-wip-us.apache.org/repos/asf/incubator-carbondata/diff/ffd911fb
Branch: refs/heads/master
Commit: ffd911fb3cc93431ea8375b7f59a63e2f6ea5dfd
Parents: 65c48ab 0f552b3
Author: chenliang613 <ch...@apache.org>
Authored: Sun Aug 7 08:06:42 2016 +0800
Committer: chenliang613 <ch...@apache.org>
Committed: Sun Aug 7 08:06:42 2016 +0800
----------------------------------------------------------------------
.../spark/sql/CarbonCatalystOperators.scala | 7 +--
.../org/apache/spark/sql/CarbonSqlParser.scala | 6 +--
.../CarbonTableIdentifierImplicit.scala | 42 +++++++++++++++
.../spark/sql/catalyst/TableIdentifier.scala | 57 --------------------
.../execution/command/carbonTableSchema.scala | 2 +-
.../spark/sql/hive/CarbonStrategies.scala | 6 +--
6 files changed, 51 insertions(+), 69 deletions(-)
----------------------------------------------------------------------