Github user kevinyu98 commented on a diff in the pull request: https://github.com/apache/spark/pull/23108#discussion_r239266816 --- Diff: sql/hive/src/test/scala/org/apache/spark/sql/hive/execution/HiveDDLSuite.scala --- @@ -2370,4 +2370,51 @@ class HiveDDLSuite )) } } + + test("SPARK-25993 Add test cases for resolution of Parquet table location") { + withTempPath { path => + val someDF1 = Seq((1, 1, "parq1"), (2, 2, "parq2")).toDF("c1", "c2", "c3").repartition(1) + withTable("tbl1", "tbl2", "tbl3") { + val dataDir = s"${path.getCanonicalPath}/l3/l2/l1/" + val parentDir = s"${path.getCanonicalPath}/l3/l2/" + val l3Dir = s"${path.getCanonicalPath}/l3/" + val wildcardParentDir = new File(s"${path}/l3/l2/*").toURI + val wildcardL3Dir = new File(s"${path}/l3/*").toURI + someDF1.write.parquet(dataDir) + val parentDirStatement = + s""" + |CREATE EXTERNAL TABLE tbl1( + | c1 int, + | c2 int, + | c3 string) + |STORED AS parquet + |LOCATION '${parentDir}'""".stripMargin + sql(parentDirStatement) + checkAnswer(sql("select * from tbl1"), Nil) + + val wildcardStatement = + s""" + |CREATE EXTERNAL TABLE tbl2( + | c1 int, + | c2 int, + | c3 string) + |STORED AS parquet + |LOCATION '${wildcardParentDir}'""".stripMargin + sql(wildcardStatement) + checkAnswer(sql("select * from tbl2"), + (1 to 2).map(i => Row(i, i, s"parq$i"))) + + val wildcardL3Statement = + s""" --- End diff -- fixed
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org