aboutsummaryrefslogtreecommitdiff
path: root/sql/hive
diff options
context:
space:
mode:
authorEric Liang <ekl@databricks.com>2016-10-29 06:49:57 +0200
committerReynold Xin <rxin@databricks.com>2016-10-29 06:49:57 +0200
commitd2d438d1d549628a0183e468ed11d6e85b5d6061 (patch)
tree333e396c0241eafa1144ccae00db07165c188ec9 /sql/hive
parent59cccbda489f25add3e10997e950de7e88704aa7 (diff)
downloadspark-d2d438d1d549628a0183e468ed11d6e85b5d6061.tar.gz
spark-d2d438d1d549628a0183e468ed11d6e85b5d6061.tar.bz2
spark-d2d438d1d549628a0183e468ed11d6e85b5d6061.zip
[SPARK-18167][SQL] Add debug code for SQLQuerySuite flakiness when metastore partition pruning is enabled
## What changes were proposed in this pull request? org.apache.spark.sql.hive.execution.SQLQuerySuite is flaking when hive partition pruning is enabled. Based on the stack traces, it seems to be an old issue where Hive fails to cast a numeric partition column ("Invalid character string format for type DECIMAL"). There are two possibilities here: either we are somehow corrupting the partition table to have non-decimal values in that column, or there is a transient issue with Derby. This PR logs the result of the retry when this exception is encountered, so we can confirm what is going on. ## How was this patch tested? n/a cc yhuai Author: Eric Liang <ekl@databricks.com> Closes #15676 from ericl/spark-18167.
Diffstat (limited to 'sql/hive')
-rw-r--r--sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala15
1 files changed, 14 insertions, 1 deletions
diff --git a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
index 3238770761..4bbbd66132 100644
--- a/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
+++ b/sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala
@@ -24,6 +24,7 @@ import java.util.{ArrayList => JArrayList, List => JList, Map => JMap, Set => JS
import java.util.concurrent.TimeUnit
import scala.collection.JavaConverters._
+import scala.util.Try
import scala.util.control.NonFatal
import org.apache.hadoop.fs.{FileSystem, Path}
@@ -585,7 +586,19 @@ private[client] class Shim_v0_13 extends Shim_v0_12 {
getAllPartitionsMethod.invoke(hive, table).asInstanceOf[JSet[Partition]]
} else {
logDebug(s"Hive metastore filter is '$filter'.")
- getPartitionsByFilterMethod.invoke(hive, table, filter).asInstanceOf[JArrayList[Partition]]
+ try {
+ getPartitionsByFilterMethod.invoke(hive, table, filter)
+ .asInstanceOf[JArrayList[Partition]]
+ } catch {
+ case e: InvocationTargetException =>
+ // SPARK-18167 retry to investigate the flaky test. This should be reverted before
+ // the release is cut.
+ val retry = Try(getPartitionsByFilterMethod.invoke(hive, table, filter))
+ val full = Try(getAllPartitionsMethod.invoke(hive, table))
+ logError("getPartitionsByFilter failed, retry success = " + retry.isSuccess)
+ logError("getPartitionsByFilter failed, full fetch success = " + full.isSuccess)
+ throw e
+ }
}
partitions.asScala.toSeq