Skip to content

Commit

Permalink
udf tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
rxin committed Feb 3, 2015
1 parent 0a0b339 commit 639c0f8
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Expand Up @@ -21,7 +21,7 @@ import org.apache.spark.sql.Dsl._
import org.apache.spark.sql.types._

/* Implicits */
import org.apache.spark.sql.test.TestSQLContext._
import org.apache.spark.sql.test.TestSQLContext.{createDataFrame, logicalPlanToSparkQuery}

import scala.language.postfixOps

Expand Down
Expand Up @@ -19,16 +19,16 @@ package org.apache.spark.sql

import java.util.TimeZone

import org.apache.spark.sql.test.TestSQLContext
import org.scalatest.BeforeAndAfterAll

import org.apache.spark.sql.Dsl._
import org.apache.spark.sql.catalyst.errors.TreeNodeException
import org.apache.spark.sql.catalyst.plans.logical.LogicalPlan
import org.apache.spark.sql.types._

/* Implicits */
import org.apache.spark.sql.TestData._
import org.apache.spark.sql.test.TestSQLContext._
import org.apache.spark.sql.test.TestSQLContext.{udf => _, _}


class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
Expand Down Expand Up @@ -787,7 +787,7 @@ class SQLQuerySuite extends QueryTest with BeforeAndAfterAll {
}

test("SPARK-3371 Renaming a function expression with group by gives error") {
udf.register("len", (s: String) => s.length)
TestSQLContext.udf.register("len", (s: String) => s.length)
checkAnswer(
sql("SELECT len(value) as temp FROM testData WHERE key = 1 group by len(value)"),
Row(1))
Expand Down
Expand Up @@ -21,7 +21,8 @@ import scala.beans.{BeanInfo, BeanProperty}

import org.apache.spark.rdd.RDD
import org.apache.spark.sql.Dsl._
import org.apache.spark.sql.test.TestSQLContext._
import org.apache.spark.sql.test.TestSQLContext
import org.apache.spark.sql.test.TestSQLContext.{udf => _, _}
import org.apache.spark.sql.types._


Expand Down Expand Up @@ -83,7 +84,7 @@ class UserDefinedTypeSuite extends QueryTest {
}

test("UDTs and UDFs") {
udf.register("testType", (d: MyDenseVector) => d.isInstanceOf[MyDenseVector])
TestSQLContext.udf.register("testType", (d: MyDenseVector) => d.isInstanceOf[MyDenseVector])
pointsRDD.registerTempTable("points")
checkAnswer(
sql("SELECT testType(features) from points"),
Expand Down

0 comments on commit 639c0f8

Please sign in to comment.