Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class OrcFileFormat extends FileFormat with DataSourceRegister with Serializable
options: Map[String, String],
files: Seq[FileStatus]): Option[StructType] = {
OrcFileOperator.readSchema(
files.map(_.getPath.toUri.toString),
files.map(_.getPath.toString),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fix looks good to me.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, the URI is right but this isn't expecting a URI

Some(sparkSession.sessionState.newHadoopConf())
)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -274,4 +274,16 @@ class OrcSourceSuite extends OrcSuite {
)).get.toString
}
}

test("SPARK-22146: read ORC files containing special characters") {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, @mgaido91 .
Could we generalize a test case to cover all file-based data sources? Or, at least,for Parquet, too?

cc @gatorsmile

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @dongjoon-hyun,
thank you for your review.
My only concern is that while ORC support is in the hive module, all the other datasources are in the sql module. So, where should we put the generalized test?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For DDL cases, we have HiveDDLSuite extends DDLSuite. But, in this case, I guess maybe HiveQuerySuite? I think the location will be settled during further reviews.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can do it in MetastoreDataSourcesSuite

val dir = Utils.createTempDir().getCanonicalFile
import spark.implicits._
try {
val nameWithSpecialChars = s"$dir/a%3Abad name.orc"
spark.createDataset(Seq("a", "b")).write.format("orc").save(nameWithSpecialChars)
spark.read.format("orc").load(nameWithSpecialChars)
} finally {
Utils.deleteRecursively(dir)
}
}
}