You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by gu...@apache.org on 2018/12/10 14:26:35 UTC

spark git commit: [SPARK-26319][SQL][TEST] Add appendReadColumns Unit Test for HiveShimSuite

Repository: spark
Updated Branches:
  refs/heads/master 3bc83de3c -> c8ac6ae84


[SPARK-26319][SQL][TEST] Add appendReadColumns Unit Test for HiveShimSuite

## What changes were proposed in this pull request?

Add appendReadColumns Unit Test for HiveShimSuite.

## How was this patch tested?
```
$ build/sbt
> project hive
> testOnly *HiveShimSuite
```

Closes #23268 from sadhen/refactor/hiveshim.

Authored-by: Darcy Shen <sa...@zoho.com>
Signed-off-by: Hyukjin Kwon <gu...@apache.org>


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/c8ac6ae8
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/c8ac6ae8
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/c8ac6ae8

Branch: refs/heads/master
Commit: c8ac6ae84c8a3cc7ed787155a84cbeb56c78a048
Parents: 3bc83de
Author: Darcy Shen <sa...@zoho.com>
Authored: Mon Dec 10 22:26:28 2018 +0800
Committer: Hyukjin Kwon <gu...@apache.org>
Committed: Mon Dec 10 22:26:28 2018 +0800

----------------------------------------------------------------------
 .../apache/spark/sql/hive/HiveShimSuite.scala   | 44 ++++++++++++++++++++
 1 file changed, 44 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/c8ac6ae8/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveShimSuite.scala
----------------------------------------------------------------------
diff --git a/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveShimSuite.scala b/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveShimSuite.scala
new file mode 100644
index 0000000..a716f73
--- /dev/null
+++ b/sql/hive/src/test/scala/org/apache/spark/sql/hive/HiveShimSuite.scala
@@ -0,0 +1,44 @@
+/*
+ * 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.hive
+
+import scala.collection.JavaConverters._
+import scala.language.implicitConversions
+
+import org.apache.hadoop.conf.Configuration
+import org.apache.hadoop.hive.serde2.ColumnProjectionUtils
+
+import org.apache.spark.SparkFunSuite
+
+class HiveShimSuite extends SparkFunSuite {
+
+  test("appendReadColumns") {
+    val conf = new Configuration
+    val ids = Seq(1, 2, 3).map(Int.box)
+    val names = Seq("a", "b", "c")
+    val moreIds = Seq(4, 5).map(Int.box)
+    val moreNames = Seq("d", "e")
+
+    // test when READ_COLUMN_NAMES_CONF_STR is empty
+    HiveShim.appendReadColumns(conf, ids, names)
+    assert(names.asJava === ColumnProjectionUtils.getReadColumnNames(conf))
+
+    // test when READ_COLUMN_NAMES_CONF_STR is non-empty
+    HiveShim.appendReadColumns(conf, moreIds, moreNames)
+    assert((names ++ moreNames).asJava === ColumnProjectionUtils.getReadColumnNames(conf))
+  }
+}


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@spark.apache.org
For additional commands, e-mail: commits-help@spark.apache.org