Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,8 @@ trait HigherOrderFunction extends Expression with ExpectsInputTypes {
*/
trait SimpleHigherOrderFunction extends HigherOrderFunction {

override def nullable: Boolean = argument.nullable
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we moved the definition of nullable straight to HigherOrderFunction as arguments.exists(_.nullable), we could also avoid the duplicities in ZipWith and MapZipWith. WDYT?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this works too IMO, if others agree I'll update with this suggestion, thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea, let's go ahead then if the change is small, straightforward and more deduplciation


def argument: Expression

override def arguments: Seq[Expression] = argument :: Nil
Expand Down Expand Up @@ -217,8 +219,6 @@ case class ArrayTransform(
function: Expression)
extends ArrayBasedSimpleHigherOrderFunction with CodegenFallback {

override def nullable: Boolean = argument.nullable

override def dataType: ArrayType = ArrayType(function.dataType, function.nullable)

override def bind(f: (Expression, Seq[(DataType, Boolean)]) => LambdaFunction): ArrayTransform = {
Expand Down Expand Up @@ -287,8 +287,6 @@ case class MapFilter(
copy(function = f(function, (keyType, false) :: (valueType, valueContainsNull) :: Nil))
}

override def nullable: Boolean = argument.nullable

override def nullSafeEval(inputRow: InternalRow, argumentValue: Any): Any = {
val m = argumentValue.asInstanceOf[MapData]
val f = functionForEval
Expand Down Expand Up @@ -328,8 +326,6 @@ case class ArrayFilter(
function: Expression)
extends ArrayBasedSimpleHigherOrderFunction with CodegenFallback {

override def nullable: Boolean = argument.nullable

override def dataType: DataType = argument.dataType

override def functionType: AbstractDataType = BooleanType
Expand Down Expand Up @@ -375,8 +371,6 @@ case class ArrayExists(
function: Expression)
extends ArrayBasedSimpleHigherOrderFunction with CodegenFallback {

override def nullable: Boolean = argument.nullable

override def dataType: DataType = BooleanType

override def functionType: AbstractDataType = BooleanType
Expand Down Expand Up @@ -516,8 +510,6 @@ case class TransformKeys(
function: Expression)
extends MapBasedSimpleHigherOrderFunction with CodegenFallback {

override def nullable: Boolean = argument.nullable

@transient lazy val MapType(keyType, valueType, valueContainsNull) = argument.dataType

override def dataType: DataType = MapType(function.dataType, valueType, valueContainsNull)
Expand Down Expand Up @@ -568,8 +560,6 @@ case class TransformValues(
function: Expression)
extends MapBasedSimpleHigherOrderFunction with CodegenFallback {

override def nullable: Boolean = argument.nullable

@transient lazy val MapType(keyType, valueType, valueContainsNull) = argument.dataType

override def dataType: DataType = MapType(keyType, function.dataType, function.nullable)
Expand Down