Skip to content

Commit

Permalink
More debug log for converted format (#11)
Browse files Browse the repository at this point in the history
* debug log for converted format

---------

Signed-off-by: Firestarman <firestarmanllc@gmail.com>
  • Loading branch information
firestarman authored Dec 11, 2023
1 parent 2caf870 commit 8e7ddf3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1770,7 +1770,7 @@ object GpuOverrides extends Logging {
("format", TypeSig.lit(TypeEnum.STRING)
.withPsNote(TypeEnum.STRING, "Only a limited number of formats are supported"),
TypeSig.STRING)),
(a, conf, p, r) => new FromUnitTimeMeta(a ,conf ,p ,r)),
(a, conf, p, r) => new FromUnixTimeMeta(a ,conf ,p ,r)),
expr[FromUTCTimestamp](
"Render the input UTC timestamp in the input timezone",
ExprChecks.binaryProject(TypeSig.TIMESTAMP, TypeSig.TIMESTAMP,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ import com.nvidia.spark.rapids.RapidsPluginImplicits._
import com.nvidia.spark.rapids.jni.GpuTimeZoneDB
import com.nvidia.spark.rapids.shims.ShimBinaryExpression

import org.apache.spark.internal.Logging
import org.apache.spark.sql.catalyst.expressions.{BinaryExpression, ExpectsInputTypes, Expression, FromUnixTime, FromUTCTimestamp, ImplicitCastInputTypes, NullIntolerant, TimeZoneAwareExpression}
import org.apache.spark.sql.catalyst.util.DateTimeConstants
import org.apache.spark.sql.internal.SQLConf
Expand Down Expand Up @@ -997,10 +998,11 @@ case class GpuGetTimestamp(
override def right: Expression = format
}

class FromUnitTimeMeta(a: FromUnixTime,
class FromUnixTimeMeta(a: FromUnixTime,
override val conf: RapidsConf,
val p: Option[RapidsMeta[_, _, _]],
r: DataFromReplacementRule) extends UnixTimeExprMeta[FromUnixTime](a, conf, p, r) {
r: DataFromReplacementRule
) extends UnixTimeExprMeta[FromUnixTime](a, conf, p, r) with Logging {

private type FmtConverter = ColumnView => ColumnVector

Expand All @@ -1024,6 +1026,7 @@ class FromUnitTimeMeta(a: FromUnixTime,
)

override def tagExprForGpu(): Unit = {
logInfo(s"==> FORMAT_BY_CONVERSION: Start conversion to support more formats")
extractStringLit(a.right) match {
case Some(rightLit) =>
sparkFormat = rightLit
Expand All @@ -1034,6 +1037,8 @@ class FromUnitTimeMeta(a: FromUnixTime,
}.getOrElse(sparkFormat)
strfFormat = DateUtils.tagAndGetCudfFormat(this,
sparkFormat, a.left.dataType == DataTypes.StringType, inputFormat)
logInfo(s"==> FORMAT_BY_CONVERSION: Get converted temp format $inputFormat " +
s"for target format $sparkFormat")
case None =>
willNotWorkOnGpu("format has to be a string literal")
}
Expand Down

0 comments on commit 8e7ddf3

Please sign in to comment.