Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
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 @@ -42,7 +42,7 @@
}

singleStatement
: statement EOF
: statement ';'* EOF
;

statement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,26 @@ class TestCallCommandParser extends HoodieSparkSqlTestBase {
checkParseExceptionContain("CALL cat.system radish kebab")("mismatched input 'CALL' expecting")
}

test("Test Call Produce with semicolon") {
val call = parser.parsePlan("CALL system.func(c1 => 1, c2 => '2', c3 => true)").asInstanceOf[CallCommand]
assertResult(ImmutableList.of("system", "func"))(JavaConverters.seqAsJavaListConverter(call.name).asJava)

assertResult(3)(call.args.size)

checkArg(call, 0, "c1", 1, DataTypes.IntegerType)
checkArg(call, 1, "c2", "2", DataTypes.StringType)
checkArg(call, 2, "c3", true, DataTypes.BooleanType)

val call2 = parser.parsePlan("CALL system.func2(c1 => 1, c2 => '2', c3 => true);").asInstanceOf[CallCommand]
assertResult(ImmutableList.of("system", "func2"))(JavaConverters.seqAsJavaListConverter(call2.name).asJava)

assertResult(3)(call2.args.size)

checkArg(call2, 0, "c1", 1, DataTypes.IntegerType)
checkArg(call2, 1, "c2", "2", DataTypes.StringType)
checkArg(call2, 2, "c3", true, DataTypes.BooleanType)
}

protected def checkParseExceptionContain(sql: String)(errorMsg: String): Unit = {
var hasException = false
try {
Expand Down