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
Prev Previous commit
Next Next commit
Mon Aug 15 01:31:47 PDT 2016
  • Loading branch information
ericl committed Aug 15, 2016
commit 29f953853405d3c69c30951972c72e4f8dcd8584
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object ResolveTableValuedFunctions extends Rule[LogicalPlan] {
private type TVF = Map[ArgumentList, Seq[Any] => LogicalPlan]

/**
* Internal registry of table-valued-functions. TODO(ekl) we should have a proper registry
* Internal registry of table-valued functions. TODO(ekl) we should have a proper registry
*/
private val builtinFunctions: Map[String, TVF] = Map(
"range" -> Map(
Expand Down Expand Up @@ -109,7 +109,7 @@ object ResolveTableValuedFunctions extends Rule[LogicalPlan] {
|${tvf.keys.map(_.toString).toSeq.sorted.map(x => s" ($x)").mkString("\n")}
|cannot be applied to: (${argTypes})""".stripMargin)
case _ =>
u.failAnalysis(s"could not resolve `${u.functionName}` to a table valued function")
u.failAnalysis(s"could not resolve `${u.functionName}` to a table-valued function")
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,13 @@ package org.apache.spark.sql
import org.apache.spark.sql.test.SharedSQLContext

class TableValuedFunctionSuite extends QueryTest with SharedSQLContext {
Copy link
Contributor

Choose a reason for hiding this comment

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

let's use the new SQLQueryTestSuite.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Done

import testImplicits._

test("unresolvable function") {
val error = intercept[AnalysisException] {
sql("select * from dummy(3)")
}
assert(error.getMessage.contains("could not resolve `dummy` to a table-valued function"))
}

test("built-in range") {
checkAnswer(
Expand Down