maropu commented on a change in pull request #31449:
URL: https://github.com/apache/spark/pull/31449#discussion_r569201299
##########
File path:
sql/core/src/test/scala/org/apache/spark/sql/execution/DataSourceScanExecRedactionSuite.scala
##########
@@ -122,24 +123,45 @@ class DataSourceScanExecRedactionSuite extends
DataSourceScanRedactionTest {
test("SPARK-31793: FileSourceScanExec metadata should contain limited file
paths") {
withTempPath { path =>
val dir = path.getCanonicalPath
+
+ // create a sub-directory with long name so that each root path will
always exceed the limit
+ // this is to ensure we always test the case for the path truncation
+ // 110 = limit 100 + margin 10 to clearly avoid edge case
+ val dataDir = if (dir.length >= 110) {
Review comment:
nit comment; for test simplicity, how about always creating a new dir
with fixed-length long name (e.g., 110?) instead of checking the length (`if
(dir.length >= 110)`)?
```
val tooLongDirName = Random.alphanumeric.take(110).toList.mkString
val f = new File(path, tooLongDirName)
f.mkdir()
```
----------------------------------------------------------------
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]