Skip to content
This repository was archived by the owner on Jan 9, 2020. It is now read-only.

Commit 523071f

Browse files
wangyumhvanhovell
authored andcommitted
[SPARK-18681][SQL] Fix filtering to compatible with partition keys of type int
## What changes were proposed in this pull request? Cloudera put `/var/run/cloudera-scm-agent/process/15000-hive-HIVEMETASTORE/hive-site.xml` as the configuration file for the Hive Metastore Server, where `hive.metastore.try.direct.sql=false`. But Spark isn't reading this configuration file and get default value `hive.metastore.try.direct.sql=true`. As mallman said, we should use `getMetaConf` method to obtain the original configuration from Hive Metastore Server. I have tested this method few times and the return value is always consistent with Hive Metastore Server. ## How was this patch tested? The existing tests. Author: Yuming Wang <[email protected]> Closes apache#16122 from wangyum/SPARK-18681. (cherry picked from commit 90abfd1) Signed-off-by: Herman van Hovell <[email protected]>
1 parent 3501160 commit 523071f

File tree

1 file changed

+5
-2
lines changed
  • sql/hive/src/main/scala/org/apache/spark/sql/hive/client

1 file changed

+5
-2
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/client/HiveShim.scala

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -590,8 +590,11 @@ private[client] class Shim_v0_13 extends Shim_v0_12 {
590590
} else {
591591
logDebug(s"Hive metastore filter is '$filter'.")
592592
val tryDirectSqlConfVar = HiveConf.ConfVars.METASTORE_TRY_DIRECT_SQL
593-
val tryDirectSql =
594-
hive.getConf.getBoolean(tryDirectSqlConfVar.varname, tryDirectSqlConfVar.defaultBoolVal)
593+
// We should get this config value from the metaStore. otherwise hit SPARK-18681.
594+
// To be compatible with hive-0.12 and hive-0.13, In the future we can achieve this by:
595+
// val tryDirectSql = hive.getMetaConf(tryDirectSqlConfVar.varname).toBoolean
596+
val tryDirectSql = hive.getMSC.getConfigValue(tryDirectSqlConfVar.varname,
597+
tryDirectSqlConfVar.defaultBoolVal.toString).toBoolean
595598
try {
596599
// Hive may throw an exception when calling this method in some circumstances, such as
597600
// when filtering on a non-string partition column when the hive config key

0 commit comments

Comments
 (0)