aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorDaoyuan Wang <daoyuan.wang@intel.com>2015-06-08 11:06:27 -0700
committerReynold Xin <rxin@databricks.com>2015-06-08 11:06:27 -0700
commited5c2dccd0397c4c4b0008c437e6845dd583c9c2 (patch)
tree9795bd9599186cda7e4f3666edc5c85a84675992 /sql/hive
parent49f19b954b32d57d03ca0e25ea4205d01e794d48 (diff)
downloadspark-ed5c2dccd0397c4c4b0008c437e6845dd583c9c2.tar.gz
spark-ed5c2dccd0397c4c4b0008c437e6845dd583c9c2.tar.bz2
spark-ed5c2dccd0397c4c4b0008c437e6845dd583c9c2.zip
[SPARK-8158] [SQL] several fix for HiveShim
1. explicitly import implicit conversion support. 2. use .nonEmpty instead of .size > 0 3. use val instead of var 4. comment indention Author: Daoyuan Wang <daoyuan.wang@intel.com> Closes #6700 from adrian-wang/shimsimprove and squashes the following commits: d22e108 [Daoyuan Wang] several fix for HiveShim
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala21
1 files changed, 11 insertions, 10 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala
index fa5409f602..d08c594151 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveShim.scala
@@ -20,6 +20,11 @@ package org.apache.spark.sql.hive
import java.io.{InputStream, OutputStream}
import java.rmi.server.UID
+/* Implicit conversions */
+import scala.collection.JavaConversions._
+import scala.language.implicitConversions
+import scala.reflect.ClassTag
+
import com.esotericsoftware.kryo.Kryo
import com.esotericsoftware.kryo.io.{Input, Output}
import org.apache.hadoop.conf.Configuration
@@ -35,10 +40,6 @@ import org.apache.spark.Logging
import org.apache.spark.sql.types.Decimal
import org.apache.spark.util.Utils
-/* Implicit conversions */
-import scala.collection.JavaConversions._
-import scala.reflect.ClassTag
-
private[hive] object HiveShim {
// Precision and scale to pass for unlimited decimals; these are the same as the precision and
// scale Hive 0.13 infers for BigDecimals from sources that don't specify them (e.g. UDFs)
@@ -68,10 +69,10 @@ private[hive] object HiveShim {
* Cannot use ColumnProjectionUtils.appendReadColumns directly, if ids is null or empty
*/
def appendReadColumns(conf: Configuration, ids: Seq[Integer], names: Seq[String]) {
- if (ids != null && ids.size > 0) {
+ if (ids != null && ids.nonEmpty) {
ColumnProjectionUtils.appendReadColumns(conf, ids)
}
- if (names != null && names.size > 0) {
+ if (names != null && names.nonEmpty) {
appendReadColumnNames(conf, names)
}
}
@@ -197,11 +198,11 @@ private[hive] object HiveShim {
}
/*
- * Bug introduced in hive-0.13. FileSinkDesc is serializable, but its member path is not.
- * Fix it through wrapper.
- * */
+ * Bug introduced in hive-0.13. FileSinkDesc is serializable, but its member path is not.
+ * Fix it through wrapper.
+ */
implicit def wrapperToFileSinkDesc(w: ShimFileSinkDesc): FileSinkDesc = {
- var f = new FileSinkDesc(new Path(w.dir), w.tableInfo, w.compressed)
+ val f = new FileSinkDesc(new Path(w.dir), w.tableInfo, w.compressed)
f.setCompressCodec(w.compressCodec)
f.setCompressType(w.compressType)
f.setTableInfo(w.tableInfo)