Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SPARK-9150][SQL] Create CodegenFallback and Unevaluable trait #7487

Closed
wants to merge 5 commits into from

Conversation

rxin
Copy link
Contributor

@rxin rxin commented Jul 18, 2015

It is very hard to track which expressions have code gen implemented or not. This patch removes the default fallback gencode implementation from Expression, and moves that into a new trait called CodegenFallback. Each concrete expression needs to either implement code generation, or mix in CodegenFallback. This makes it very easy to track which expressions have code generation implemented already.

Additionally, this patch creates an Unevaluable trait that can be used to track expressions that don't support evaluation (e.g. Star).

@rxin
Copy link
Contributor Author

rxin commented Jul 18, 2015

Note that this is based on #7486, so the diff is larger than it is.

@rxin rxin changed the title [SPARK-9150][SQL] Create a trait to track code generation for expressions [SPARK-9150][SQL] Create CodegenFallback and Unevaluable trait Jul 18, 2015
@SparkQA
Copy link

SparkQA commented Jul 18, 2015

Test build #37697 has finished for PR 7487 at commit f9dce26.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with Unevaluable
    • case class UnresolvedFunction(name: String, children: Seq[Expression])
    • case class UnresolvedStar(table: Option[String]) extends Star with Unevaluable
    • case class ResolvedStar(expressions: Seq[NamedExpression]) extends Star with Unevaluable
    • case class UnresolvedAlias(child: Expression)
    • case class Cast(child: Expression, dataType: DataType)
    • trait Unevaluable
    • case class SortOrder(child: Expression, direction: SortDirection)
    • trait AggregateExpression extends Expression with Unevaluable
    • case class Abs(child: Expression)
    • trait CodegenFallback
    • case class CreateArray(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateNamedStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CurrentDate() extends LeafExpression with CodegenFallback
    • case class CurrentTimestamp() extends LeafExpression with CodegenFallback
    • case class Explode(child: Expression) extends UnaryExpression with Generator with CodegenFallback
    • case class Literal protected (value: Any, dataType: DataType)
    • case class Hex(child: Expression)
    • case class Unhex(child: Expression)
    • case class PrettyAttribute(name: String) extends Attribute with Unevaluable
    • case class In(value: Expression, list: Seq[Expression]) extends Predicate with CodegenFallback
    • case class NewSet(elementType: DataType) extends LeafExpression with CodegenFallback
    • case class AddItemToSet(item: Expression, set: Expression)
    • case class CombineSets(left: Expression, right: Expression)
    • case class CountSet(child: Expression) extends UnaryExpression with CodegenFallback
    • case class Concat(children: Seq[Expression]) extends Expression with ImplicitCastInputTypes
    • case class Upper(child: Expression)
    • case class StringFormat(children: Expression*) extends Expression with CodegenFallback
    • case class StringSpace(child: Expression)
    • case class Ascii(child: Expression)
    • case class Base64(child: Expression)
    • case class UnBase64(child: Expression)

@SparkQA
Copy link

SparkQA commented Jul 18, 2015

Test build #37699 has finished for PR 7487 at commit 83f06c1.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • class IntArrayParam(parent: Params, name: String, doc: String, isValid: Array[Int] => Boolean)
    • case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with Unevaluable
    • case class UnresolvedFunction(name: String, children: Seq[Expression])
    • case class UnresolvedStar(table: Option[String]) extends Star with Unevaluable
    • case class ResolvedStar(expressions: Seq[NamedExpression]) extends Star with Unevaluable
    • case class UnresolvedAlias(child: Expression)
    • case class Cast(child: Expression, dataType: DataType)
    • trait Unevaluable
    • case class SortOrder(child: Expression, direction: SortDirection)
    • trait AggregateExpression extends Expression with Unevaluable
    • case class Abs(child: Expression)
    • trait CodegenFallback
    • case class CreateArray(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateNamedStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CurrentDate() extends LeafExpression with CodegenFallback
    • case class CurrentTimestamp() extends LeafExpression with CodegenFallback
    • case class Explode(child: Expression) extends UnaryExpression with Generator with CodegenFallback
    • case class Literal protected (value: Any, dataType: DataType)
    • case class Hex(child: Expression)
    • case class Unhex(child: Expression)
    • case class PrettyAttribute(name: String) extends Attribute with Unevaluable
    • case class In(value: Expression, list: Seq[Expression]) extends Predicate with CodegenFallback
    • case class NewSet(elementType: DataType) extends LeafExpression with CodegenFallback
    • case class AddItemToSet(item: Expression, set: Expression)
    • case class CombineSets(left: Expression, right: Expression)
    • case class CountSet(child: Expression) extends UnaryExpression with CodegenFallback
    • case class Concat(children: Seq[Expression]) extends Expression with ImplicitCastInputTypes
    • case class Upper(child: Expression)
    • case class StringFormat(children: Expression*) extends Expression with CodegenFallback
    • case class StringSpace(child: Expression)
    • case class Ascii(child: Expression)
    • case class Base64(child: Expression)
    • case class UnBase64(child: Expression)

@SparkQA
Copy link

SparkQA commented Jul 18, 2015

Test build #37727 has finished for PR 7487 at commit fba84d3.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with Unevaluable
    • case class UnresolvedFunction(name: String, children: Seq[Expression])
    • case class UnresolvedStar(table: Option[String]) extends Star with Unevaluable
    • case class ResolvedStar(expressions: Seq[NamedExpression]) extends Star with Unevaluable
    • case class UnresolvedAlias(child: Expression)
    • case class Cast(child: Expression, dataType: DataType)
    • abstract class Expression extends TreeNode[Expression]
    • trait Unevaluable
    • case class SortOrder(child: Expression, direction: SortDirection)
    • trait AggregateExpression extends Expression with Unevaluable
    • case class Abs(child: Expression)
    • trait CodegenFallback
    • case class CreateArray(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateNamedStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CurrentDate() extends LeafExpression with CodegenFallback
    • case class CurrentTimestamp() extends LeafExpression with CodegenFallback
    • case class Explode(child: Expression) extends UnaryExpression with Generator with CodegenFallback
    • case class Literal protected (value: Any, dataType: DataType)
    • case class Hex(child: Expression)
    • case class Unhex(child: Expression)
    • case class PrettyAttribute(name: String) extends Attribute with Unevaluable
    • case class IsNaN(child: Expression) extends UnaryExpression
    • case class In(value: Expression, list: Seq[Expression]) extends Predicate with CodegenFallback
    • case class NewSet(elementType: DataType) extends LeafExpression with CodegenFallback
    • case class AddItemToSet(item: Expression, set: Expression)
    • case class CombineSets(left: Expression, right: Expression)
    • case class CountSet(child: Expression) extends UnaryExpression with CodegenFallback
    • case class Concat(children: Seq[Expression]) extends Expression with ImplicitCastInputTypes
    • case class Upper(child: Expression)
    • case class StringFormat(children: Expression*) extends Expression with CodegenFallback
    • case class StringSpace(child: Expression)
    • case class Ascii(child: Expression)
    • case class Base64(child: Expression)
    • case class UnBase64(child: Expression)
    • abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging
    • abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product
    • abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializable
    • case class ConvertToUnsafe(child: SparkPlan) extends UnaryNode
    • case class ConvertToSafe(child: SparkPlan) extends UnaryNode

@SparkQA
Copy link

SparkQA commented Jul 18, 2015

Test build #37734 has finished for PR 7487 at commit 3c73192.

  • This patch fails Spark unit tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with Unevaluable
    • case class UnresolvedFunction(name: String, children: Seq[Expression])
    • case class UnresolvedStar(table: Option[String]) extends Star with Unevaluable
    • case class ResolvedStar(expressions: Seq[NamedExpression]) extends Star with Unevaluable
    • case class UnresolvedAlias(child: Expression)
    • case class Cast(child: Expression, dataType: DataType)
    • abstract class Expression extends TreeNode[Expression]
    • trait Unevaluable
    • case class SortOrder(child: Expression, direction: SortDirection)
    • trait AggregateExpression extends Expression with Unevaluable
    • case class Abs(child: Expression)
    • trait CodegenFallback
    • case class CreateArray(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateNamedStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CurrentDate() extends LeafExpression with CodegenFallback
    • case class CurrentTimestamp() extends LeafExpression with CodegenFallback
    • case class Explode(child: Expression) extends UnaryExpression with Generator with CodegenFallback
    • case class Literal protected (value: Any, dataType: DataType)
    • case class Hex(child: Expression)
    • case class Unhex(child: Expression)
    • case class PrettyAttribute(name: String) extends Attribute with Unevaluable
    • case class IsNaN(child: Expression) extends UnaryExpression
    • case class In(value: Expression, list: Seq[Expression]) extends Predicate with CodegenFallback
    • case class NewSet(elementType: DataType) extends LeafExpression with CodegenFallback
    • case class AddItemToSet(item: Expression, set: Expression)
    • case class CombineSets(left: Expression, right: Expression)
    • case class CountSet(child: Expression) extends UnaryExpression with CodegenFallback
    • case class Concat(children: Seq[Expression]) extends Expression with ImplicitCastInputTypes
    • case class Upper(child: Expression)
    • case class StringFormat(children: Expression*) extends Expression with CodegenFallback
    • case class StringSpace(child: Expression)
    • case class Ascii(child: Expression)
    • case class Base64(child: Expression)
    • case class UnBase64(child: Expression)
    • abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging
    • abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product
    • abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializable
    • case class ConvertToUnsafe(child: SparkPlan) extends UnaryNode
    • case class ConvertToSafe(child: SparkPlan) extends UnaryNode

@SparkQA
Copy link

SparkQA commented Jul 19, 2015

Test build #37740 has finished for PR 7487 at commit 14ebf38.

  • This patch passes all tests.
  • This patch merges cleanly.
  • This patch adds the following public classes (experimental):
    • case class UnresolvedAttribute(nameParts: Seq[String]) extends Attribute with Unevaluable
    • case class UnresolvedFunction(name: String, children: Seq[Expression])
    • case class UnresolvedStar(table: Option[String]) extends Star with Unevaluable
    • case class ResolvedStar(expressions: Seq[NamedExpression]) extends Star with Unevaluable
    • case class UnresolvedAlias(child: Expression)
    • case class Cast(child: Expression, dataType: DataType)
    • abstract class Expression extends TreeNode[Expression]
    • trait Unevaluable
    • case class SortOrder(child: Expression, direction: SortDirection)
    • trait AggregateExpression extends Expression with Unevaluable
    • case class Abs(child: Expression)
    • trait CodegenFallback
    • case class CreateArray(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CreateNamedStruct(children: Seq[Expression]) extends Expression with CodegenFallback
    • case class CurrentDate() extends LeafExpression with CodegenFallback
    • case class CurrentTimestamp() extends LeafExpression with CodegenFallback
    • case class Explode(child: Expression) extends UnaryExpression with Generator with CodegenFallback
    • case class Literal protected (value: Any, dataType: DataType)
    • case class Hex(child: Expression)
    • case class Unhex(child: Expression)
    • case class PrettyAttribute(name: String) extends Attribute with Unevaluable
    • case class IsNaN(child: Expression) extends UnaryExpression
    • case class In(value: Expression, list: Seq[Expression]) extends Predicate with CodegenFallback
    • case class NewSet(elementType: DataType) extends LeafExpression with CodegenFallback
    • case class AddItemToSet(item: Expression, set: Expression)
    • case class CombineSets(left: Expression, right: Expression)
    • case class CountSet(child: Expression) extends UnaryExpression with CodegenFallback
    • case class Concat(children: Seq[Expression]) extends Expression with ImplicitCastInputTypes
    • case class Upper(child: Expression)
    • case class StringFormat(children: Expression*) extends Expression with CodegenFallback
    • case class StringSpace(child: Expression)
    • case class Ascii(child: Expression)
    • case class Base64(child: Expression)
    • case class UnBase64(child: Expression)
    • abstract class LogicalPlan extends QueryPlan[LogicalPlan] with Logging
    • abstract class TreeNode[BaseType <: TreeNode[BaseType]] extends Product
    • abstract class SparkPlan extends QueryPlan[SparkPlan] with Logging with Serializable
    • case class ConvertToUnsafe(child: SparkPlan) extends UnaryNode
    • case class ConvertToSafe(child: SparkPlan) extends UnaryNode

@asfgit asfgit closed this in 9914b1b Jul 19, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants