TheNeuralBit commented on a change in pull request #13731:
URL: https://github.com/apache/beam/pull/13731#discussion_r556964310
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java
##########
@@ -86,7 +88,7 @@
})
public class RowJson {
private static final ImmutableSet<TypeName> SUPPORTED_TYPES =
- ImmutableSet.of(BYTE, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN,
STRING, DECIMAL);
+ ImmutableSet.of(BYTE, INT16, INT32, INT64, FLOAT, DOUBLE, BOOLEAN,
STRING, DECIMAL, DATETIME);
Review comment:
Do we need to use the DATETIME primitive type for support in Calcite
SQL? I thought ZetaSQL used the logical MicrosInstant type.
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJson.java
##########
@@ -86,7 +88,7 @@
})
Review comment:
Please update the docstring for the newly supported type. It should
probably also indicate what datetime formats are supported.
##########
File path:
sdks/java/core/src/main/java/org/apache/beam/sdk/util/RowJsonValueExtractors.java
##########
@@ -177,6 +178,18 @@
.build();
}
+ /**
+ * Extracts DateTime from the JsonNode if it is valid.
+ *
+ * <p>Throws {@link UnsupportedRowJsonException} if value is out of bounds.
+ */
+ static ValueExtractor<DateTime> datetimeValueExtractor() {
+ return ValidatingValueExtractor.<DateTime>builder()
+ .setExtractor(jsonNode -> DateTime.parse(jsonNode.textValue()))
Review comment:
What DateTime formats does this support? Is it just ISO-8601? Please
document that in the docstring. Also if other formats are supported we should
test them specifically.
----------------------------------------------------------------
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]