You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by mallman <gi...@git.apache.org> on 2016/11/07 18:31:05 UTC
[GitHub] spark pull request #15538: [SPARK-17993][SQL] Fix Parquet log output redirec...
Github user mallman commented on a diff in the pull request:
https://github.com/apache/spark/pull/15538#discussion_r86837361
--- Diff: sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/parquet/ParquetFileFormat.scala ---
@@ -55,6 +56,21 @@ class ParquetFileFormat
with DataSourceRegister
with Logging
with Serializable {
+ // Poor man's "static initializer". Scala doesn't have language support for static initializers,
+ // and it's important that we initialize `ParquetFileFormat.redirectParquetLogsViaSLF4J` before
+ // doing anything with the Parquet libraries. Rather than expect clients to initialize the
+ // `ParquetFileFormat` singleton object at the right time, we put that initialization in the
+ // constructor of this class. This method is idempotent, and essentially a no-op after its first
+ // call.
+ ParquetFileFormat.ensureParquetLogRedirection
+
+ // Java serialization will not call the default constructor. Make sure we call
+ // ParquetFileFormat.ensureParquetLogRedirection in deserialization by implementing this hook
+ // method.
+ private def readObject(in: ObjectInputStream): Unit = {
+ in.defaultReadObject
+ ParquetFileFormat.ensureParquetLogRedirection
--- End diff --
I've tried to keep this code isolated to the parquet implementation.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org