Skip to content
Closed
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
Prev Previous commit
Fix conflicts
  • Loading branch information
weiqingy committed Oct 20, 2016
commit b21eec2566d99f289a8ed0ee058f4fce093533df
Original file line number Diff line number Diff line change
Expand Up @@ -1920,6 +1920,7 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
}
}


test("SPARK-17108: Fix BIGINT and INT comparison failure in spark sql") {
sql("create table t1(a map<bigint, array<string>>)")
sql("select * from t1 where a[1] is not null")
Expand All @@ -1931,6 +1932,33 @@ class SQLQuerySuite extends QueryTest with SQLTestUtils with TestHiveSingleton {
sql("select * from t3 where a[1L] is not null")
}

test("SPARK-17796 Support wildcard character in filename for LOAD DATA LOCAL INPATH") {
withTempDir { dir =>
for (i <- 1 to 3) {
Files.write(s"$i", new File(s"$dir/part-r-0000$i"), StandardCharsets.UTF_8)
}
for (i <- 5 to 7) {
Files.write(s"$i", new File(s"$dir/part-s-0000$i"), StandardCharsets.UTF_8)
}

withTable("load_t") {
sql("CREATE TABLE load_t (a STRING)")
sql(s"LOAD DATA LOCAL INPATH '$dir/*part-r*' INTO TABLE load_t")
checkAnswer(sql("SELECT * FROM load_t"), Seq(Row("1"), Row("2"), Row("3")))

val m = intercept[AnalysisException] {
sql("LOAD DATA LOCAL INPATH '/non-exist-folder/*part*' INTO TABLE load_t")
}.getMessage
assert(m.contains("LOAD DATA input path does not exist"))

val m2 = intercept[AnalysisException] {
sql(s"LOAD DATA LOCAL INPATH '$dir*/*part*' INTO TABLE load_t")
}.getMessage
assert(m2.contains("LOAD DATA input path allows only filename wildcard"))
}
}
}

def testCommandAvailable(command: String): Boolean = {
val attempt = Try(Process(command).run(ProcessLogger(_ => ())).exitValue())
attempt.isSuccess && attempt.get == 0
Expand Down
You are viewing a condensed version of this merge commit. You can view the full changes here.