Github user twalthr commented on a diff in the pull request:

    https://github.com/apache/flink/pull/4746#discussion_r142642598
  
    --- Diff: 
flink-libraries/flink-table/src/main/scala/org/apache/flink/table/expressions/literals.scala
 ---
    @@ -49,10 +50,51 @@ object Literal {
         case sqlTime: Time => Literal(sqlTime, SqlTimeTypeInfo.TIME)
         case sqlTimestamp: Timestamp => Literal(sqlTimestamp, 
SqlTimeTypeInfo.TIMESTAMP)
       }
    +
    +  private[flink] def apply(rexNode: RexLiteral): Literal = {
    +    val literalType = FlinkTypeFactory.toTypeInfo(rexNode.getType)
    +
    +    val literalValue = literalType match {
    +      // Chrono use cases.  We're force-adjusting the UTC-based epoch 
timestamps to a new
    +      // timestamp such that we get the same year/month/hour/day field 
values in the query's
    +      // timezone (UTC)
    +      case [email protected] =>
    +        val rexValue = rexNode.getValueAs(classOf[DateString])
    +        val adjustedCal = adjustCalendar(rexValue.toCalendar, 
TimeZone.getDefault)
    +        new Date(adjustedCal.getTimeInMillis)
    --- End diff --
    
    This can be simplified to `new Date(rexValue.toString)`.


---

Reply via email to