JoshRosen commented on code in PR #39488: URL: https://github.com/apache/spark/pull/39488#discussion_r1070402135
########## core/src/main/scala/org/apache/spark/paths/SparkPath.scala: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.paths + +import java.net.URI + +import org.apache.hadoop.fs.{FileStatus, Path} + +/** + * A SparkPath is the result of a URI.toString call. + */ +case class SparkPath private (private val underlying: String) { + def uriEncoded: String = underlying Review Comment: Should this be `uriEncode` (with an 'I' ) or `urlEncoded` (with an 'L')? I think that "URL encoding" is the more common terminology (https://en.wikipedia.org/wiki/Percent-encoding) ########## common/network-common/src/main/java/org/apache/spark/network/util/JavaUtils.java: ########## @@ -383,6 +383,7 @@ public static File createTempDir() throws IOException { public static File createTempDir(String root, String namePrefix) throws IOException { if (root == null) root = System.getProperty("java.io.tmpdir"); if (namePrefix == null) namePrefix = "spark"; + namePrefix = namePrefix + " with a space"; Review Comment: I like the methodology of ensuring that our test paths contain spaces or special characters. Should we have a `Utils.isTesting` to flag this only for test code? Are there other methods for creating temporary files in tests that should also be updated? ########## core/src/main/scala/org/apache/spark/paths/SparkPath.scala: ########## @@ -0,0 +1,40 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package org.apache.spark.paths + +import java.net.URI + +import org.apache.hadoop.fs.{FileStatus, Path} + +/** + * A SparkPath is the result of a URI.toString call. + */ +case class SparkPath private (private val underlying: String) { + def uriEncoded: String = underlying + def toUri: URI = new URI(underlying) + def toPath: Path = new Path(toUri) + override def toString: String = underlying +} + +object SparkPath { + def fromPathString(str: String): SparkPath = fromPath(new Path(str)) Review Comment: I think it would be a good idea to explain what a path string is (perhaps with a reference to the Hadoop docs at https://hadoop.apache.org/docs/stable/api/org/apache/hadoop/fs/Path.html#Path-java.lang.String-) -- 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. To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org