Skip to content

Commit

Permalink
apache#3480 Support abbreviate timezone in SQL
Browse files Browse the repository at this point in the history
  • Loading branch information
navis committed Oct 30, 2020
1 parent c2bbe7c commit b6c1088
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
package io.druid.sql.calcite.expression.builtin;

import com.google.common.collect.ImmutableList;
import io.druid.common.utils.JodaUtils;
import io.druid.sql.calcite.expression.DruidExpression;
import io.druid.sql.calcite.expression.Expressions;
import io.druid.sql.calcite.expression.OperatorConversions;
Expand Down Expand Up @@ -72,7 +73,7 @@ public DruidExpression toDruidExpression(
? RexLiteral.stringValue(call.getOperands().get(1))
: "yyyy-MM-dd'T'HH:mm:ss.SSSZZ";
final DateTimeZone timeZone = call.getOperands().size() > 2 && !RexLiteral.isNullLiteral(call.getOperands().get(2))
? DateTimeZone.forID(RexLiteral.stringValue(call.getOperands().get(2)))
? JodaUtils.toTimeZone(RexLiteral.stringValue(call.getOperands().get(2)))
: plannerContext.getTimeZone();

return DruidExpression.fromFunctionCall(
Expand Down

0 comments on commit b6c1088

Please sign in to comment.