Skip to content

Commit

Permalink
remove codegen and add lazy in testsuite
Browse files Browse the repository at this point in the history
  • Loading branch information
adrian-wang committed Jul 3, 2015
1 parent 27c9f95 commit 6a20b64
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,6 @@ case class CurrentDate() extends LeafExpression {
override def eval(input: InternalRow): Any = {
DateTimeUtils.millisToDays(System.currentTimeMillis())
}

override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = {
val datetimeUtils = "org.apache.spark.sql.catalyst.util.DateTimeUtils"
s"""
boolean ${ev.isNull} = false;
${ctx.javaType(dataType)} ${ev.primitive} =
$datetimeUtils.millisToDays(System.currentTimeMillis());
"""
}
}

/**
Expand All @@ -58,11 +49,4 @@ case class CurrentTimestamp() extends LeafExpression {
override def eval(input: InternalRow): Any = {
System.currentTimeMillis() * 10000L
}

override def genCode(ctx: CodeGenContext, ev: GeneratedExpressionCode): String = {
s"""
boolean ${ev.isNull} = false;
${ctx.javaType(dataType)} ${ev.primitive} = System.currentTimeMillis() * 10000L;
"""
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@

package org.apache.spark.sql

import java.sql.Date

import org.apache.spark.sql.catalyst.util.DateTimeUtils
import org.apache.spark.sql.functions._

Expand All @@ -27,7 +25,7 @@ class DatetimeExpressionsSuite extends QueryTest {

import ctx.implicits._

val df1 = Seq((1, 2), (3, 1)).toDF("a", "b")
lazy val df1 = Seq((1, 2), (3, 1)).toDF("a", "b")

test("function current_date") {
val d0 = DateTimeUtils.millisToDays(System.currentTimeMillis())
Expand Down

0 comments on commit 6a20b64

Please sign in to comment.