[
https://issues.apache.org/jira/browse/BEAM-9037?focusedWorklogId=377416&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-377416
]
ASF GitHub Bot logged work on BEAM-9037:
----------------------------------------
Author: ASF GitHub Bot
Created on: 26/Jan/20 19:06
Start Date: 26/Jan/20 19:06
Worklog Time Spent: 10m
Work Description: alexvanboxel commented on pull request #10486:
[BEAM-9037] Instant and duration as logical type
URL: https://github.com/apache/beam/pull/10486#discussion_r371022191
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/NanosType.java
##########
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.beam.sdk.schemas.logicaltypes;
+
+import java.util.UUID;
+import org.apache.beam.sdk.schemas.Schema;
+import org.apache.beam.sdk.values.Row;
+
+/** Base class for types representing timestamps or durations as nanoseconds.
*/
+abstract class NanosType<T> implements Schema.LogicalType<T, Row> {
+ private final String identifier;
+
+ protected static final Schema SCHEMA;
+
+ static {
+ Schema schema =
Schema.builder().addInt64Field("seconds").addInt32Field("nanos").build();
+ schema.setUUID(UUID.fromString("dc5915f1-6db8-3134-9444-4980fb088e92"));
+ SCHEMA = schema;
Review comment:
Switched to instance variables. Proto conversion used by ByteBuddy still
uses a static version of the schema for performance reasons.
----------------------------------------------------------------
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:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 377416)
Time Spent: 1.5h (was: 1h 20m)
> Instant and duration as logical type
> -------------------------------------
>
> Key: BEAM-9037
> URL: https://issues.apache.org/jira/browse/BEAM-9037
> Project: Beam
> Issue Type: Task
> Components: sdk-java-core
> Reporter: Alex Van Boxel
> Assignee: Alex Van Boxel
> Priority: Major
> Fix For: 2.19.0
>
> Time Spent: 1.5h
> Remaining Estimate: 0h
>
> The proto schema includes Timestamp and Duration with nano precision. The
> logical types should be promoted to the core logical types, so they can be
> handled on various IO's as standard mandatory conversions.
> This means that the logical type should use the proto specific Timestamp and
> Duration but the java 8 Instant and Duration.
> See discussion in the design document:
> [https://docs.google.com/document/d/1uu9pJktzT_O3DxGd1-Q2op4nRk4HekIZbzi-0oTAips/edit#heading=h.9uhml95iygqr]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)