aboutsummaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorJim Carroll <jim@dontcallme.com>2014-11-14 15:33:21 -0800
committerMichael Armbrust <michael@databricks.com>2014-11-14 15:33:39 -0800
commitef39ec419a97ad9e8cfcb39f8141ca255e04c4aa (patch)
tree91ba690d36b55cc6bf6c8e3c97724305e2a88765 /sql
parentaa5d8e57c63d045b291a5c1fc99e782a0f191854 (diff)
downloadspark-ef39ec419a97ad9e8cfcb39f8141ca255e04c4aa.tar.gz
spark-ef39ec419a97ad9e8cfcb39f8141ca255e04c4aa.tar.bz2
spark-ef39ec419a97ad9e8cfcb39f8141ca255e04c4aa.zip
[SPARK-4412][SQL] Fix Spark's control of Parquet logging.
The Spark ParquetRelation.scala code makes the assumption that the parquet.Log class has already been loaded. If ParquetRelation.enableLogForwarding executes prior to the parquet.Log class being loaded then the code in enableLogForwarding has no affect. ParquetRelation.scala attempts to override the parquet logger but, at least currently (and if your application simply reads a parquet file before it does anything else with Parquet), the parquet.Log class hasn't been loaded yet. Therefore the code in ParquetRelation.enableLogForwarding has no affect. If you look at the code in parquet.Log there's a static initializer that needs to be called prior to enableLogForwarding or whatever enableLogForwarding does gets undone by this static initializer. The "fix" would be to force the static initializer to get called in parquet.Log as part of enableForwardLogging. Author: Jim Carroll <jim@dontcallme.com> Closes #3271 from jimfcarroll/parquet-logging and squashes the following commits: 37bdff7 [Jim Carroll] Fix Spark's control of Parquet logging. (cherry picked from commit 37482ce5a7b875f17d32a5e8c561cc8e9772c9b3) Signed-off-by: Michael Armbrust <michael@databricks.com>
Diffstat (limited to 'sql')
-rw-r--r--sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala b/sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala
index 82130b5459..b237a07c72 100644
--- a/sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala
+++ b/sql/core/src/main/scala/org/apache/spark/sql/parquet/ParquetRelation.scala
@@ -84,6 +84,21 @@ private[sql] case class ParquetRelation(
private[sql] object ParquetRelation {
def enableLogForwarding() {
+ // Note: the parquet.Log class has a static initializer that
+ // sets the java.util.logging Logger for "parquet". This
+ // checks first to see if there's any handlers already set
+ // and if not it creates them. If this method executes prior
+ // to that class being loaded then:
+ // 1) there's no handlers installed so there's none to
+ // remove. But when it IS finally loaded the desired affect
+ // of removing them is circumvented.
+ // 2) The parquet.Log static initializer calls setUseParentHanders(false)
+ // undoing the attempt to override the logging here.
+ //
+ // Therefore we need to force the class to be loaded.
+ // This should really be resolved by Parquet.
+ Class.forName(classOf[parquet.Log].getName())
+
// Note: Logger.getLogger("parquet") has a default logger
// that appends to Console which needs to be cleared.
val parquetLogger = java.util.logging.Logger.getLogger("parquet")