File tree Expand file tree Collapse file tree 3 files changed +19
-3
lines changed
main/scala/org/apache/spark/sql
catalyst/expressions/codegen
test/scala/org/apache/spark/sql/catalyst/expressions/codegen Expand file tree Collapse file tree 3 files changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -1051,13 +1051,13 @@ object CodeGenerator extends Logging {
10511051 case e : JaninoRuntimeException =>
10521052 val msg = s " failed to compile: $e"
10531053 logError(msg, e)
1054- val maxLines = new SQLConf () .loggingMaxLinesForCodegen
1054+ val maxLines = SQLConf .get .loggingMaxLinesForCodegen
10551055 logInfo(s " \n ${CodeFormatter .format(code, maxLines)}" )
10561056 throw new JaninoRuntimeException (msg, e)
10571057 case e : CompileException =>
10581058 val msg = s " failed to compile: $e"
10591059 logError(msg, e)
1060- val maxLines = new SQLConf () .loggingMaxLinesForCodegen
1060+ val maxLines = SQLConf .get .loggingMaxLinesForCodegen
10611061 logInfo(s " \n ${CodeFormatter .format(code, maxLines)}" )
10621062 throw new CompileException (msg, e.getLocation)
10631063 }
Original file line number Diff line number Diff line change @@ -564,8 +564,10 @@ object SQLConf {
564564
565565 val CODEGEN_LOGGING_MAX_LINES = buildConf(" spark.sql.codegen.logging.maxLines" )
566566 .internal()
567- .doc(" The maximum number of codegen lines to log when errors occur." )
567+ .doc(" The maximum number of codegen lines to log when errors occur. Use -1 for unlimited. " )
568568 .intConf
569+ .checkValue(maxLines => maxLines >= - 1 , " The maximum must be a positive integer, 0 to " +
570+ " disable logging or -1 to apply no limit." )
569571 .createWithDefault(1000 )
570572
571573 val FILES_MAX_PARTITION_BYTES = buildConf(" spark.sql.files.maxPartitionBytes" )
Original file line number Diff line number Diff line change @@ -129,6 +129,20 @@ class CodeFormatterSuite extends SparkFunSuite {
129129 """ .stripMargin
130130 }
131131
132+ testCase(" function calls with maxLines=0" ) (
133+ """
134+ |foo(
135+ |a,
136+ |b,
137+ |c)
138+ """ .stripMargin,
139+ maxLines = 0
140+ ) {
141+ """
142+ |/* 001 */ [truncated to 0 lines (total lines is 4)]
143+ """ .stripMargin
144+ }
145+
132146 testCase(" function calls with maxLines=2" ) (
133147 """
134148 |foo(
You can’t perform that action at this time.
0 commit comments