WeichenXu123 commented on a change in pull request #25134: [SPARK-28366][CORE]
Logging in driver when loading single large unsplittable file
URL: https://github.com/apache/spark/pull/25134#discussion_r308033335
##########
File path:
sql/core/src/main/scala/org/apache/spark/sql/execution/datasources/v2/TextBasedFileScan.scala
##########
@@ -33,14 +34,16 @@ abstract class TextBasedFileScan(
readPartitionSchema: StructType,
options: CaseInsensitiveStringMap)
extends FileScan(sparkSession, fileIndex, readDataSchema,
readPartitionSchema) {
- private var codecFactory: CompressionCodecFactory = _
+ @transient private lazy val codecFactory: CompressionCodecFactory = new
CompressionCodecFactory(
+ sparkSession.sessionState.newHadoopConfWithOptions(options.asScala.toMap))
- override def isSplitable(path: Path): Boolean = {
- if (codecFactory == null) {
- codecFactory = new CompressionCodecFactory(
-
sparkSession.sessionState.newHadoopConfWithOptions(options.asScala.toMap))
+ override def isSplitable(path: Path): Boolean = Utils.isFileSplittable(path,
codecFactory)
+
+ override def getFileUnSplittableReason(path: Path): String = {
+ if (!isSplitable(path)) {
+ "the file is compressed by unsplittable compression codec"
+ } else {
+ null
Review comment:
What about add an `require` inside method `getFileUnSplittableReason`
`require(!isSplitable(path), "file is splittable.")`
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]