Skip to content

Commit

Permalink
apache#36 optimize project codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
hn5092 committed Jul 18, 2019
1 parent ceae443 commit a272baa
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ object UnsafeProjection

protected def toBoundExprs(
exprs: Seq[Expression],
inputSchema: Seq[Attribute]): Seq[Expression] = {
inputSchema: AttributeSeq): Seq[Expression] = {
exprs.map(BindReferences.bindReference(_, inputSchema))
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,10 @@ object GenerateMutableProjection extends CodeGenerator[Seq[Expression], MutableP
protected def canonicalize(in: Seq[Expression]): Seq[Expression] =
in.map(ExpressionCanonicalizer.execute)

protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] =
in.map(BindReferences.bindReference(_, inputSchema))
protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] = {
val attSeq = AttributeSeq(inputSchema)
in.map(BindReferences.bindReference(_, attSeq))
}

def generate(
expressions: Seq[Expression],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,10 @@ object GenerateOrdering extends CodeGenerator[Seq[SortOrder], Ordering[InternalR
protected def canonicalize(in: Seq[SortOrder]): Seq[SortOrder] =
in.map(ExpressionCanonicalizer.execute(_).asInstanceOf[SortOrder])

protected def bind(in: Seq[SortOrder], inputSchema: Seq[Attribute]): Seq[SortOrder] =
in.map(BindReferences.bindReference(_, inputSchema))
protected def bind(in: Seq[SortOrder], inputSchema: Seq[Attribute]): Seq[SortOrder] = {
val attSeq = AttributeSeq(inputSchema)
in.map(BindReferences.bindReference(_, attSeq))
}

/**
* Creates a code gen ordering for sorting this schema, in ascending order.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,10 @@ object GenerateSafeProjection extends CodeGenerator[Seq[Expression], Projection]
protected def canonicalize(in: Seq[Expression]): Seq[Expression] =
in.map(ExpressionCanonicalizer.execute)

protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] =
in.map(BindReferences.bindReference(_, inputSchema))
protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] = {
val attSeq = AttributeSeq(inputSchema)
in.map(BindReferences.bindReference(_, attSeq))
}

private def createCodeForStruct(
ctx: CodegenContext,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -316,8 +316,10 @@ object GenerateUnsafeProjection extends CodeGenerator[Seq[Expression], UnsafePro
protected def canonicalize(in: Seq[Expression]): Seq[Expression] =
in.map(ExpressionCanonicalizer.execute)

protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] =
in.map(BindReferences.bindReference(_, inputSchema))
protected def bind(in: Seq[Expression], inputSchema: Seq[Attribute]): Seq[Expression] = {
val attSeq = AttributeSeq(inputSchema)
in.map(BindReferences.bindReference(_, attSeq))
}

def generate(
expressions: Seq[Expression],
Expand Down

0 comments on commit a272baa

Please sign in to comment.