[
https://issues.apache.org/jira/browse/BEAM-6701?focusedWorklogId=200434&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-200434
]
ASF GitHub Bot logged work on BEAM-6701:
----------------------------------------
Author: ASF GitHub Bot
Created on: 19/Feb/19 09:56
Start Date: 19/Feb/19 09:56
Worklog Time Spent: 10m
Work Description: amaliujia commented on pull request #7865: [BEAM-6701]
Add logical types to schema
URL: https://github.com/apache/beam/pull/7865#discussion_r257956360
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
##########
@@ -398,6 +443,50 @@ public boolean isSupertypeOf(TypeName other) {
}
}
+ /**
+ * A LogicalType allows users to define a custom schema type.
+ *
+ * <p>A LogicalType is a way to define a new type that can be stored in a
schema field using an
+ * underlying FieldType as storage. A LogicalType must specify a base
FieldType used to store the
+ * data by overriding the {@link #getBaseType()} method. Usually the
FieldType returned will be
+ * one of the standard ones implemented by Schema. It is legal to return
another LogicalType, but
+ * the storage types must eventually resolve to one of the standard Schema
types; it is not
+ * allowed to have LogicalTypes reference each other recursively via
getBaseType. The {@link
+ * #toBaseType} and {@link #toInputType} should convert back and forth
between the Java type for
+ * the LogicalType (InputT) and the Java type appropriate for the underlying
base type (BaseT).
+ *
+ * <p>{@link #getIdentifier} must define a globally unique identifier for
this LogicalType. A
Review comment:
It seems that there is no verification on globally uniqueness of
identifiers. What's the effect if identifiers are not unique (seems to me that
there is no any effect)?
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 200434)
Time Spent: 2h 10m (was: 2h)
> Create LogicalType for Schema fields
> ------------------------------------
>
> Key: BEAM-6701
> URL: https://issues.apache.org/jira/browse/BEAM-6701
> Project: Beam
> Issue Type: Sub-task
> Components: sdk-java-core
> Reporter: Reuven Lax
> Assignee: Reuven Lax
> Priority: Major
> Time Spent: 2h 10m
> Remaining Estimate: 0h
>
> This will allow users to create their own logical types to store in schema
> fields, backed by one of the fundamental schema field types. Today SQL hacks
> on top of the field metadata to distinguish its types. LogicalTypes would
> allow for a more principled way of doing this.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)