Skip to content

Commit

Permalink
Fix UT
Browse files Browse the repository at this point in the history
  • Loading branch information
AngersZhuuuu committed Jul 14, 2020
1 parent d51c0dc commit 5d85160
Showing 1 changed file with 7 additions and 7 deletions.
Expand Up @@ -24,7 +24,7 @@ import scala.reflect.{classTag, ClassTag}

import org.apache.spark.sql.{AnalysisException, SaveMode}
import org.apache.spark.sql.catalyst.TableIdentifier
import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedAttribute}
import org.apache.spark.sql.catalyst.analysis.{AnalysisTest, UnresolvedAttribute, UnresolvedStar}
import org.apache.spark.sql.catalyst.catalog._
import org.apache.spark.sql.catalyst.dsl.expressions._
import org.apache.spark.sql.catalyst.dsl.plans
Expand Down Expand Up @@ -612,16 +612,16 @@ class DDLParserSuite extends AnalysisTest with SharedSparkSession {
}

test("transform query spec") {
val p = ScriptTransformation(
Seq(UnresolvedAttribute("a"), UnresolvedAttribute("b")),
"func", Seq.empty, plans.table("e"), null)
val p = Project(Seq(UnresolvedAttribute("a"), UnresolvedAttribute("b")), plans.table("e"))
val s = ScriptTransformation(Seq(UnresolvedStar(None)), "func", Seq.empty, p, null)

compareTransformQuery("select transform(a, b) using 'func' from e where f < 10",
p.copy(child = p.child.where('f < 10), output = Seq('key.string, 'value.string)))
s.copy(child = p.copy(child = p.child.where('f < 10)),
output = Seq('key.string, 'value.string)))
compareTransformQuery("map a, b using 'func' as c, d from e",
p.copy(output = Seq('c.string, 'd.string)))
s.copy(output = Seq('c.string, 'd.string)))
compareTransformQuery("reduce a, b using 'func' as (c int, d decimal(10, 0)) from e",
p.copy(output = Seq('c.int, 'd.decimal(10, 0))))
s.copy(output = Seq('c.int, 'd.decimal(10, 0))))
}

test("use backticks in output of Script Transform") {
Expand Down

0 comments on commit 5d85160

Please sign in to comment.