Skip to content
This repository has been archived by the owner on May 1, 2024. It is now read-only.

Commit

Permalink
Merge pull request #54 from bdrillard/issue-47
Browse files Browse the repository at this point in the history
issue-47: uplifting for Spark 2.4.4
  • Loading branch information
bdrillard authored Oct 2, 2019
2 parents c65d6da + e063ce4 commit e6a58c6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
language: java
jdk:
- oraclejdk8
- openjdk8
cache:
directories:
- "$HOME/.m2"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import com.cerner.bunsen.datatypes.DataTypeMappings
import org.apache.spark.sql.catalyst.analysis.{GetColumnByOrdinal, UnresolvedAttribute, UnresolvedExtractValue}
import org.apache.spark.sql.catalyst.encoders.ExpressionEncoder
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
import org.apache.spark.sql.catalyst.expressions.objects._
import org.apache.spark.sql.catalyst.{InternalRow, expressions}
Expand Down Expand Up @@ -638,7 +639,7 @@ case class GetClassFromContained(targetObject: Expression,
val obj = targetObject.genCode(ctx)

ev.copy(code =
s"""
code"""
|${obj.code}
|$javaType ${ev.value} = null;
|boolean ${ev.isNull} = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
package com.cerner.bunsen.backports

import scala.language.existentials

import org.apache.spark.sql.catalyst.InternalRow
import org.apache.spark.sql.catalyst.expressions._
import org.apache.spark.sql.catalyst.expressions.codegen.{CodegenContext, ExprCode}
import org.apache.spark.sql.catalyst.expressions.codegen.Block._
import org.apache.spark.sql.catalyst.expressions.codegen.{CodeGenerator, CodegenContext, ExprCode, FalseLiteral}
import org.apache.spark.sql.types._

/**
Expand All @@ -37,13 +37,13 @@ case class StaticField(staticObject: Class[_],
throw new UnsupportedOperationException("Only code-generated evaluation is supported.")

override def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {
val javaType = ctx.javaType(dataType)
val javaType = CodeGenerator.javaType(dataType)

val code =
s"""
code"""
final $javaType ${ev.value} = $objectName.$fieldName;
"""
ev.copy(code = code, isNull = "false")
ev.copy(code = code, isNull = FalseLiteral)
}
}

Expand All @@ -68,12 +68,12 @@ case class InstanceOf(value: Expression,
val obj = value.genCode(ctx)

val code =
s"""
code"""
${obj.code}
final boolean ${ev.value} = ${obj.value} instanceof ${checkedType.getName};
"""

ev.copy(code = code, isNull = "false")
ev.copy(code = code, isNull = FalseLiteral)
}
}

Expand All @@ -95,11 +95,11 @@ case class ObjectCast(value: Expression, resultType: DataType)

override protected def doGenCode(ctx: CodegenContext, ev: ExprCode): ExprCode = {

val javaType = ctx.javaType(resultType)
val javaType = CodeGenerator.javaType(resultType)
val obj = value.genCode(ctx)

val code =
s"""
code"""
${obj.code}
final $javaType ${ev.value} = ($javaType) ${obj.value};
"""
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<compile.source>1.8</compile.source>

<!-- Spark -->
<spark.version>2.3.2</spark.version>
<spark.version>2.4.4</spark.version>
<scala.version>2.11.8</scala.version>
<scala.binary.version>2.11</scala.binary.version>
<parquet.version>1.7.0</parquet.version>
Expand Down

0 comments on commit e6a58c6

Please sign in to comment.