You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@beam.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2020/05/01 22:13:00 UTC

[jira] [Work logged] (BEAM-9641) Support ZetaSQL DATE functions in BeamSQL

     [ https://issues.apache.org/jira/browse/BEAM-9641?focusedWorklogId=429688&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-429688 ]

ASF GitHub Bot logged work on BEAM-9641:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 01/May/20 22:12
            Start Date: 01/May/20 22:12
    Worklog Time Spent: 10m 
      Work Description: TheNeuralBit commented on a change in pull request #11272:
URL: https://github.com/apache/beam/pull/11272#discussion_r418759689



##########
File path: sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##########
@@ -427,17 +430,12 @@ private static Expression value(
 
     private static Expression value(Expression value, Schema.FieldType type) {
       if (type.getTypeName().isLogicalType()) {
-        Expression millisField = Expressions.call(value, "getMillis");
         String logicalId = type.getLogicalType().getIdentifier();
         if (logicalId.equals(TimeType.IDENTIFIER)) {
-          return nullOr(value, Expressions.convert_(millisField, int.class));
-        } else if (logicalId.equals(DateType.IDENTIFIER)) {
-          value =
-              nullOr(
-                  value,
-                  Expressions.convert_(
-                      Expressions.divide(millisField, Expressions.constant(MILLIS_PER_DAY)),
-                      int.class));
+          return nullOr(
+              value, Expressions.convert_(Expressions.call(value, "getMillis"), int.class));
+        } else if (logicalId.equals(SqlTypes.DATE.getIdentifier())) {

Review comment:
       what about using a switch statement? Is there any style guidance on using switch on a String in java?




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Issue Time Tracking
-------------------

    Worklog Id:     (was: 429688)
    Time Spent: 1h  (was: 50m)

> Support ZetaSQL DATE functions in BeamSQL
> -----------------------------------------
>
>                 Key: BEAM-9641
>                 URL: https://issues.apache.org/jira/browse/BEAM-9641
>             Project: Beam
>          Issue Type: New Feature
>          Components: dsl-sql-zetasql
>            Reporter: Yueyang Qiu
>            Assignee: Yueyang Qiu
>            Priority: Major
>              Labels: zetasql-compliance
>          Time Spent: 1h
>  Remaining Estimate: 0h
>




--
This message was sent by Atlassian Jira
(v8.3.4#803005)