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

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

                Author: ASF GitHub Bot
            Created on: 30/Nov/19 20:50
            Start Date: 30/Nov/19 20:50
    Worklog Time Spent: 10m 
      Work Description: reuvenlax commented on pull request #10247: [BEAM-7274] 
In preparation for protocol-buffer schemas, add OneOf and Enumeration logical 
types
URL: https://github.com/apache/beam/pull/10247#discussion_r352303817
 
 

 ##########
 File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/LogicalTypes.java
 ##########
 @@ -111,4 +134,247 @@ public FieldType getBaseType() {
       }
     }
   }
+
+  /**
+   * This class represents a single enum value. It can be referenced as a 
String or as an integer.
+   */
+  public static class EnumerationValue {
+    private final String stringValue;
+    private final int value;
+
+    EnumerationValue(String stringValue, int value) {
+      this.stringValue = stringValue;
+      this.value = value;
+    }
+
+    /** Return the integer enum value. */
+    int getValue() {
+      return value;
+    }
+
+    /** Return the String enum value. */
+    @Override
+    public String toString() {
+      return stringValue;
+    }
+
+    @Override
+    public boolean equals(Object o) {
+      if (this == o) {
+        return true;
+      }
+      if (o == null || getClass() != o.getClass()) {
+        return false;
+      }
+      EnumerationValue enumValue = (EnumerationValue) o;
+      return value == enumValue.value && Objects.equals(stringValue, 
enumValue.stringValue);
+    }
+
+    @Override
+    public int hashCode() {
+      return Objects.hash(stringValue, value);
+    }
+  }
+
+  /** This {@link LogicalType} represent an enumeration over a fixed set of 
values. */
+  public static class EnumerationType implements LogicalType<EnumerationValue, 
Integer> {
 
 Review comment:
   good idea - done
 
----------------------------------------------------------------
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:
us...@infra.apache.org


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

    Worklog Id:     (was: 351579)
    Time Spent: 12h 10m  (was: 12h)

> Protobuf Beam Schema support
> ----------------------------
>
>                 Key: BEAM-7274
>                 URL: https://issues.apache.org/jira/browse/BEAM-7274
>             Project: Beam
>          Issue Type: Improvement
>          Components: sdk-java-core
>            Reporter: Alex Van Boxel
>            Assignee: Alex Van Boxel
>            Priority: Minor
>          Time Spent: 12h 10m
>  Remaining Estimate: 0h
>
> Add support for the new Beam Schema to the Protobuf extension.



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

Reply via email to