[GitHub] [beam] reuvenlax commented on a change in pull request #11456: [BEAM-7554] Add MillisInstant logical type to replace DATETIME

2020-05-21 Thread GitBox


reuvenlax commented on a change in pull request #11456:
URL: https://github.com/apache/beam/pull/11456#discussion_r428901750



##
File path: 
sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/logicaltypes/MillisInstant.java
##
@@ -0,0 +1,44 @@
+/*
+ * 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 org.joda.time.Instant;
+import org.joda.time.ReadableInstant;
+
+/** A timestamp represented as milliseconds since the epoch. */
+public class MillisInstant extends MillisType {
+  public static final String IDENTIFIER = 
"beam:logical_type:millis_instant:v1";

Review comment:
   A timestamp type seems like it's by definition time-zone agnostic. If we 
want a datetime type, that should be a different type.





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




[GitHub] [beam] reuvenlax commented on a change in pull request #11456: [BEAM-7554] Add MillisInstant logical type to replace DATETIME

2020-05-01 Thread GitBox


reuvenlax commented on a change in pull request #11456:
URL: https://github.com/apache/beam/pull/11456#discussion_r418443258



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamAggregationRel.java
##
@@ -257,10 +257,8 @@ private Transform(
   // Combining over a single field, so extract just that field.
   combined =
   (combined == null)
-  ? byFields.aggregateFieldBaseValue(
-  inputs.get(0), combineFn, fieldAggregation.outputField)
-  : combined.aggregateFieldBaseValue(
-  inputs.get(0), combineFn, fieldAggregation.outputField);
+  ? byFields.aggregateField(inputs.get(0), combineFn, 
fieldAggregation.outputField)
+  : combined.aggregateField(inputs.get(0), combineFn, 
fieldAggregation.outputField);

Review comment:
   I'm not sure I agree with this change. I think it's important that SQL 
work over user logical types by interpreting it as the base value. The user 
writing the SQL statement usually understands the base type of their logical 
type, and can write the SQL statement appropriately. This will break that.

##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/rel/BeamCalcRel.java
##
@@ -416,36 +417,33 @@ private static Expression value(
 
   Expression value =
   Expressions.convert_(
-  Expressions.call(
-  expression,
-  "getBaseValue",
-  Expressions.constant(index),
-  Expressions.constant(convertTo)),
-  convertTo);
+  Expressions.call(expression, "getValue", 
Expressions.constant(index)), convertTo);

Review comment:
   I have the same concern with this change.

##
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/schemas/Schema.java
##
@@ -419,7 +420,6 @@ public int hashCode() {
 FLOAT,
 DOUBLE,
 STRING, // String.
-DATETIME, // Date and time.

Review comment:
   I'm a little worried about this. Empirically many users are using 
schemas. Maybe we should start off by leaving DATETIME around and remove it 
later in another PR?





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