-
Notifications
You must be signed in to change notification settings - Fork 29k
[Spark-25993][SQL][TEST]Add test cases for CREATE EXTERNAL TABLE with subdirectories #23108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 2 commits
4e45ef9
e238764
e731746
d6e582b
39ebcf8
d75b923
fe472c8
51d1d78
d851169
fef8c68
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -597,6 +597,38 @@ abstract class OrcQueryTest extends OrcTest { | |
| assert(m4.contains("Malformed ORC file")) | ||
| } | ||
| } | ||
|
|
||
| test("SPARK-25993 Add test cases for resolution of ORC table location") { | ||
|
||
| withTempDir { dir => | ||
| val someDF1 = Seq((1, 1, "orc1"), (2, 2, "orc2")).toDF("c1", "c2", "c3").repartition(1) | ||
| val tableName1 = "orcTable1" | ||
| val tableName2 = "orcTable2" | ||
| withTable(tableName1, tableName2) { | ||
| val path1 = s"${dir.getCanonicalPath}/dir1/" | ||
| someDF1.write.orc(path1) | ||
| val path2 = s"${dir.getCanonicalPath}/" | ||
| val sqlStatement1 = | ||
| s""" | ||
| |CREATE EXTERNAL TABLE $tableName1(C1 INT, C2 INT, C3 STRING) | ||
| |STORED AS ORC LOCATION '${path2}' | ||
| """.stripMargin | ||
| sql(sqlStatement1) | ||
| checkAnswer( | ||
| sql(s"SELECT * FROM ${tableName1}"), Nil) | ||
|
|
||
| val path3 = s"${dir.getCanonicalPath}/*" | ||
| val sqlStatement2 = | ||
| s""" | ||
| |CREATE EXTERNAL TABLE $tableName2(C1 INT, C2 INT, C3 STRING) | ||
| |STORED AS ORC LOCATION '${path3}' | ||
| """.stripMargin | ||
| sql(sqlStatement2) | ||
| checkAnswer( | ||
| sql(s"SELECT * FROM ${tableName2}"), | ||
| (1 to 2).map(i => Row(i, i, s"orc$i"))) | ||
| } | ||
| } | ||
| } | ||
| } | ||
|
|
||
| class OrcQuerySuite extends OrcQueryTest with SharedSQLContext { | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you change
but will not if you specify the parent directorymore clearly with examples like the other sentence?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sure.