Github user ericl commented on a diff in the pull request:
https://github.com/apache/spark/pull/15538#discussion_r85809383
--- 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 --
You could also call `ensureParquetLogRedirection` from some main class
right? e.g. `class Executor`.
---
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 [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]