@@ -22,6 +22,7 @@ import java.sql.{Date, Timestamp}
2222
2323import org .apache .hadoop .fs .{FileSystem , Path }
2424
25+ import org .apache .spark .SparkEnv
2526import org .apache .spark .rdd .RDD
2627import org .apache .spark .sql .{AnalysisException , Row , SparkSession }
2728import org .apache .spark .sql .catalyst .InternalRow
@@ -260,7 +261,10 @@ class QueryExecution(val sparkSession: SparkSession, val logical: LogicalPlan) {
260261 val filePath = new Path (path)
261262 val fs = FileSystem .get(filePath.toUri, sparkSession.sparkContext.hadoopConfiguration)
262263 val dos = fs.create(filePath)
264+ val maxFields = SparkEnv .get.conf.getInt(Utils .MAX_TO_STRING_FIELDS ,
265+ Utils .DEFAULT_MAX_TO_STRING_FIELDS )
263266 try {
267+ SparkEnv .get.conf.set(Utils .MAX_TO_STRING_FIELDS , Int .MaxValue .toString)
264268 dos.writeBytes(" == Parsed Logical Plan ==\n " )
265269 logical.treeString(dos, verbose = true , addSuffix = false )
266270 dos.writeBytes(" == Analyzed Logical Plan ==\n " )
@@ -276,6 +280,7 @@ class QueryExecution(val sparkSession: SparkSession, val logical: LogicalPlan) {
276280 org.apache.spark.sql.execution.debug.codegenToOutputStream(dos, executedPlan)
277281 } finally {
278282 dos.close()
283+ SparkEnv .get.conf.set(Utils .MAX_TO_STRING_FIELDS , maxFields.toString)
279284 }
280285 }
281286 }
0 commit comments