beam-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Work logged] (BEAM-5279) Metadata is lost in CalciteUtils schema conversion
Date Thu, 06 Sep 2018 18:29:00 GMT

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

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

                Author: ASF GitHub Bot
            Created on: 06/Sep/18 18:28
            Start Date: 06/Sep/18 18:28
    Worklog Time Spent: 10m 
      Work Description: apilloud closed pull request #6337: [BEAM-5279] Don't wipe SQL metadata,
keep types simple
URL: https://github.com/apache/beam/pull/6337
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
index 3bb7b2c16b7..80222bd02b7 100644
--- a/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
+++ b/sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/utils/CalciteUtils.java
@@ -54,12 +54,12 @@
           .put(
               FieldType.DATETIME.withMetadata("TIME_WITH_LOCAL_TZ"),
               SqlTypeName.TIME_WITH_LOCAL_TIME_ZONE)
-          .put(FieldType.DATETIME.withMetadata("TS"), SqlTypeName.TIMESTAMP)
+          .put(FieldType.DATETIME, SqlTypeName.TIMESTAMP)
           .put(
               FieldType.DATETIME.withMetadata("TS_WITH_LOCAL_TZ"),
               SqlTypeName.TIMESTAMP_WITH_LOCAL_TIME_ZONE)
           .put(FieldType.STRING.withMetadata("CHAR"), SqlTypeName.CHAR)
-          .put(FieldType.STRING.withMetadata("VARCHAR"), SqlTypeName.VARCHAR)
+          .put(FieldType.STRING, SqlTypeName.VARCHAR)
           .build();
 
   private static final BiMap<SqlTypeName, FieldType> CALCITE_TO_BEAM_TYPE_MAPPING =
@@ -124,7 +124,7 @@ public static FieldType toFieldType(SqlTypeName sqlTypeName) {
                     + "so it cannot be converted to a %s",
                 sqlTypeName, Schema.FieldType.class.getSimpleName()));
       default:
-        return CALCITE_TO_BEAM_TYPE_MAPPING.get(sqlTypeName).withMetadata((byte[]) null);
+        return CALCITE_TO_BEAM_TYPE_MAPPING.get(sqlTypeName);
     }
   }
 
diff --git a/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
b/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
index 54f5f4b42ac..d16defa61ca 100644
--- a/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
+++ b/sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/BeamSqlCliTest.java
@@ -158,16 +158,16 @@ public void testExecute_createTableWithRowField() throws Exception {
                         "address",
                         Schema.FieldType.row(
                             Schema.builder()
-                                .addNullableField("street", Schema.FieldType.STRING)
-                                .addNullableField("country", Schema.FieldType.STRING)
+                                .addNullableField("street", VARCHAR)
+                                .addNullableField("country", VARCHAR)
                                 .build()))
                     .withNullable(true),
                 Field.of(
                         "addressAngular",
                         Schema.FieldType.row(
                             Schema.builder()
-                                .addNullableField("street", Schema.FieldType.STRING)
-                                .addNullableField("country", Schema.FieldType.STRING)
+                                .addNullableField("street", VARCHAR)
+                                .addNullableField("country", VARCHAR)
                                 .build()))
                     .withNullable(true),
                 Field.of("isRobot", BOOLEAN).withNullable(true))


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on 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: 141896)
    Time Spent: 0.5h  (was: 20m)

> Metadata is lost in CalciteUtils schema conversion
> --------------------------------------------------
>
>                 Key: BEAM-5279
>                 URL: https://issues.apache.org/jira/browse/BEAM-5279
>             Project: Beam
>          Issue Type: Bug
>          Components: dsl-sql
>            Reporter: Andrew Pilloud
>            Assignee: Andrew Pilloud
>            Priority: Major
>          Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> We just delete it:
> {code:java}
> return CALCITE_TO_BEAM_TYPE_MAPPING.get(sqlTypeName).withMetadata((byte[]) null);{code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Mime
View raw message