Github user marmbrus commented on a diff in the pull request:

    https://github.com/apache/spark/pull/224#discussion_r11002606
  
    --- Diff: 
sql/catalyst/src/test/scala/org/apache/spark/sql/catalyst/expressions/ExpressionEvaluationSuite.scala
 ---
    @@ -26,7 +26,186 @@ import org.apache.spark.sql.catalyst.types._
     /* Implicit conversions */
     import org.apache.spark.sql.catalyst.dsl.expressions._
     
    -class ExpressionEvaluationSuite extends FunSuite {
    +import org.apache.spark.sql.catalyst.types._
    +import org.apache.spark.sql.catalyst.dsl._
    +
    +
    +/**
    + * Root class of expression evaluation test
    + */
    +trait ExprEvalTest {
    +  type Execution = (Row => Row)
    +
    +  def engine: Execution
    +}
    +
    +case class InterpretExprEvalTest(exprs: Seq[Expression]) extends 
ExprEvalTest {
    +  override def engine: Execution = new Projection(exprs)
    +}
    +
    +class InterpretExpressionEvaluationSuite extends ExpressionEvaluationSuite 
{
    +  override def executor(exprs: Seq[Expression]) = 
InterpretExprEvalTest(exprs)
    +}
    +
    +trait ExpressionEvaluationSuite extends FunSuite {
    +  /**
    +   * The sub classes need to create the ExprEvalTest object 
    +   */
    +  def executor(exprs: Seq[Expression]): ExprEvalTest
    +  
    +  val data: Row = new GenericRow(Array(1, null, 1.0, true, 4, 5, null, 
"abcccd", "a%"))
    +
    +  // TODO add to DSL
    +  val c1 = BoundReference(0, AttributeReference("a", IntegerType)())
    +  val c2 = BoundReference(1, AttributeReference("b", IntegerType)())
    +  val c3 = BoundReference(2, AttributeReference("c", DoubleType)())
    +  val c4 = BoundReference(3, AttributeReference("d", BooleanType)())
    +  val c5 = BoundReference(4, AttributeReference("e", IntegerType)())
    +  val c6 = BoundReference(5, AttributeReference("f", IntegerType)())
    +  val c7 = BoundReference(6, AttributeReference("g", StringType)())
    +  val c8 = BoundReference(7, AttributeReference("h", StringType)())
    +  val c9 = BoundReference(8, AttributeReference("i", StringType)())
    +  
    +  /**
    +   * Compare each of the field if it equals the expected value.
    +   * 
    +   * expected is a sequence of (Any, Any), 
    --- End diff --
    
    Use `@param` to document what parameters are used for.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to