Skip to content

Commit

Permalink
Code Review.
Browse files Browse the repository at this point in the history
  • Loading branch information
hvanhovell committed Feb 8, 2017
1 parent e378f62 commit 673168e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package org.apache.spark.sql
*/
package object types {
/**
* Metadata key used to store the the raw hive type string in the metadata of StructField. This
* Metadata key used to store the raw hive type string in the metadata of StructField. This
* is relevant for datatypes that do not have a direct Spark SQL counterpart, such as CHAR and
* VARCHAR. We need to preserve the original type in order to invoke the correct object
* inspector in Hive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,6 @@ private[hive] case class HiveSimpleUDF(
@transient
lazy val function = funcWrapper.createFunction[UDF]()

{
function
}
@transient
private lazy val method =
function.getResolver.getEvalMethod(children.map(_.dataType.toTypeInfo).asJava)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -152,18 +152,7 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA
assert(new OrcOptions(Map("Orc.Compress" -> "NONE")).compressionCodec == "NONE")
}

test("SPARK-18220: read Hive orc table with varchar column") {
val hiveClient = spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
try {
hiveClient.runSqlHive("CREATE TABLE orc_varchar(a VARCHAR(10)) STORED AS orc")
hiveClient.runSqlHive("INSERT INTO TABLE orc_varchar SELECT 'a' FROM (SELECT 1) t")
checkAnswer(spark.table("orc_varchar"), Row("a"))
} finally {
hiveClient.runSqlHive("DROP TABLE IF EXISTS orc_varchar")
}
}

test("SPARK-19459: read char/varchar column written by Hive") {
test("SPARK-19459/SPARK-18220: read char/varchar column written by Hive") {
val hiveClient = spark.sharedState.externalCatalog.asInstanceOf[HiveExternalCatalog].client
val location = Utils.createTempDir().toURI
try {
Expand All @@ -174,7 +163,7 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA
| b CHAR(10),
| c VARCHAR(10))
|STORED AS orc""".stripMargin)
// Hive throws an exception if I assign the location in the create table statment.
// Hive throws an exception if I assign the location in the create table statement.
hiveClient.runSqlHive(
s"ALTER TABLE hive_orc SET LOCATION '$location'")
hiveClient.runSqlHive(
Expand All @@ -190,7 +179,9 @@ abstract class OrcSuite extends QueryTest with TestHiveSingleton with BeforeAndA
| c VARCHAR(10))
|STORED AS orc
|LOCATION '$location'""".stripMargin)
checkAnswer(spark.table("spark_orc"), Row("a", "b ", "c"))
val result = Row("a", "b ", "c")
checkAnswer(spark.table("hive_orc"), result)
checkAnswer(spark.table("spark_orc"), result)
} finally {
hiveClient.runSqlHive("DROP TABLE IF EXISTS hive_orc")
hiveClient.runSqlHive("DROP TABLE IF EXISTS spark_orc")
Expand Down

0 comments on commit 673168e

Please sign in to comment.