[
https://issues.apache.org/jira/browse/BEAM-12697?focusedWorklogId=672848&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-672848
]
ASF GitHub Bot logged work on BEAM-12697:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 01/Nov/21 20:52
Start Date: 01/Nov/21 20:52
Worklog Time Spent: 10m
Work Description: TheNeuralBit commented on a change in pull request
#15733:
URL: https://github.com/apache/beam/pull/15733#discussion_r740522140
##########
File path:
sdks/java/extensions/sbe/src/main/java/org/apache/beam/sdk/extensions/sbe/TimeValues.java
##########
@@ -0,0 +1,460 @@
+/*
+ * 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.extensions.sbe;
+
+import static org.apache.beam.sdk.extensions.sbe.Schemas.TZ_TIME_SCHEMA;
+import static
org.apache.beam.sdk.extensions.sbe.Schemas.TimeFieldNames.TIME_FIELD_NAME;
+import static
org.apache.beam.sdk.extensions.sbe.Schemas.TimeFieldNames.TIME_ZONE_HOUR_FIELD_NAME;
+import static
org.apache.beam.sdk.extensions.sbe.Schemas.TimeFieldNames.TIME_ZONE_MINUTE_FIELD_NAME;
+import static
org.apache.beam.sdk.extensions.sbe.Schemas.TimeFieldNames.UNIT_FIELD_NAME;
+import static org.apache.beam.sdk.extensions.sbe.Schemas.UTC_TIME_SCHEMA;
+import static
org.apache.beam.vendor.guava.v26_0_jre.com.google.common.base.Preconditions.checkArgument;
+
+import java.time.Instant;
+import java.time.OffsetDateTime;
+import java.time.OffsetTime;
+import java.time.ZoneOffset;
+import java.time.temporal.ChronoUnit;
+import java.util.Objects;
+import java.util.concurrent.TimeUnit;
+import org.apache.beam.sdk.values.Row;
+import org.checkerframework.checker.initialization.qual.Initialized;
+import org.checkerframework.checker.nullness.qual.NonNull;
+import org.checkerframework.checker.nullness.qual.Nullable;
+
+/**
+ * Representations of SBE value types.
+ *
+ * <p>These are convertible to/from a {@link Row} that is a direct mapping of
an SBE composite type.
+ */
+public final class TimeValues {
Review comment:
What I meant by make progress was to build other infrastructure, like
the `PayloadSerializerProvider`, that only supports the unambiguous types (for
now).
If we must provide types that have the same semantic meaning as SBE, I do
think it's preferable to define concrete types (as you had before) rather than
using `Row`. `Row` is supposed to be an implementation detail - we aim to
create APIs where users don't need to interact with it directly. I just think
we need to be careful creating these types, as users may accept date/time
library-like functionality. If we're clear from the outset that these are
intended to be simple containers to faithfully represent SBE data, that could
be ok.
However that solution would still have drawback (2) - the types would have
little utility outside of SBE. What if a user wanted to use these types in a
`SqlTransform`, or write them to Avro, or take data from one of those sources
and write it as SBE? Ideally they could do that without boilerplate to convert
between SBE-native date/time types and standard types. This doesn't need to be
a blocker, but it's something to think about.
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 672848)
Time Spent: 12.5h (was: 12h 20m)
> SBE Extension
> -------------
>
> Key: BEAM-12697
> URL: https://issues.apache.org/jira/browse/BEAM-12697
> Project: Beam
> Issue Type: New Feature
> Components: sdk-java-core
> Reporter: Zachary Houfek
> Assignee: Zachary Houfek
> Priority: P2
> Time Spent: 12.5h
> Remaining Estimate: 0h
>
> This is a prerequisite to BEAM-12298.
> The intent is to add an extension for Simple Binary Encoding, similar to what
> exists for Protobuf.
> Design doc:
> [https://docs.google.com/document/d/1YiZR__1EsV9tDFsNUhvbpv2YjeP5cMl1c3Wj7Nb1fWs|https://docs.google.com/document/d/1q2KyBxPQ6V6Gfm50Z74YWofATgVauYu066F0t1JPxRU/edit?usp=sharing]
--
This message was sent by Atlassian Jira
(v8.3.4#803005)