You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@carbondata.apache.org by ra...@apache.org on 2018/10/27 02:00:16 UTC

carbondata git commit: [CARBONDATA-3039] Fix Custom Deterministic Expression for rand() UDF

Repository: carbondata
Updated Branches:
  refs/heads/master 58ba45ef8 -> 917f34421


[CARBONDATA-3039] Fix Custom Deterministic Expression for rand() UDF

Fix Custom Deterministic Expression for rand() UDF

This closes #2845


Project: http://git-wip-us.apache.org/repos/asf/carbondata/repo
Commit: http://git-wip-us.apache.org/repos/asf/carbondata/commit/917f3442
Tree: http://git-wip-us.apache.org/repos/asf/carbondata/tree/917f3442
Diff: http://git-wip-us.apache.org/repos/asf/carbondata/diff/917f3442

Branch: refs/heads/master
Commit: 917f34421b0dfcc44dd1efec6745db6c68eddbd5
Parents: 58ba45e
Author: Indhumathi27 <in...@gmail.com>
Authored: Tue Oct 23 11:29:51 2018 +0530
Committer: ravipesala <ra...@gmail.com>
Committed: Sat Oct 27 07:30:06 2018 +0530

----------------------------------------------------------------------
 .../spark/sql/CustomDeterministicExpression.scala       | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/carbondata/blob/917f3442/integration/spark2/src/main/scala/org/apache/spark/sql/CustomDeterministicExpression.scala
----------------------------------------------------------------------
diff --git a/integration/spark2/src/main/scala/org/apache/spark/sql/CustomDeterministicExpression.scala b/integration/spark2/src/main/scala/org/apache/spark/sql/CustomDeterministicExpression.scala
index 1ff9bc3..8a37989 100644
--- a/integration/spark2/src/main/scala/org/apache/spark/sql/CustomDeterministicExpression.scala
+++ b/integration/spark2/src/main/scala/org/apache/spark/sql/CustomDeterministicExpression.scala
@@ -26,15 +26,17 @@ import org.apache.spark.sql.types.{DataType, StringType}
  * Custom expression to override the deterministic property .
  */
 case class CustomDeterministicExpression(nonDt: Expression ) extends Expression with Serializable{
-  override def nullable: Boolean = true
+  override def nullable: Boolean = nonDt.nullable
 
-  override def eval(input: InternalRow): Any = null
+  override def eval(input: InternalRow): Any = nonDt.eval(input)
 
-  override def dataType: DataType = StringType
+  override def dataType: DataType = nonDt.dataType
 
-  override def children: Seq[Expression] = Seq()
+  override def children: Seq[Expression] = nonDt.children
 
-  def childexp : Expression = nonDt
+  def childexp: Expression = nonDt
+
+  override def genCode(ctx: CodegenContext): ExprCode = nonDt.genCode(ctx)
 
   override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = ev.copy("")
 }