[
https://issues.apache.org/jira/browse/BEAM-2990?focusedWorklogId=89880&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-89880
]
ASF GitHub Bot logged work on BEAM-2990:
----------------------------------------
Author: ASF GitHub Bot
Created on: 11/Apr/18 10:25
Start Date: 11/Apr/18 10:25
Worklog Time Spent: 10m
Work Description: reuvenlax commented on a change in pull request #5079:
[BEAM-2990] support MAP in SQL schema
URL: https://github.com/apache/beam/pull/5079#discussion_r180705566
##########
File path: sdks/java/core/src/main/java/org/apache/beam/sdk/values/Row.java
##########
@@ -417,6 +450,22 @@ public Builder addArray(Object ... values) {
return verifiedList;
}
+ private Map<Object, Object> verifyMap(Object value, FieldType
componentKeyType,
+ FieldType componentValueType, String fieldName) {
+ if (!(value instanceof Map)) {
+ throw new IllegalArgumentException(String.format(
+ "For field name %s and map type expected Map class. Instead " +
"class type was %s.",
+ fieldName, value.getClass()));
+ }
+ Map<Object, Object> valueMap = (Map<Object, Object>) value;
+ Map<Object, Object> verifiedMap =
Maps.newHashMapWithExpectedSize(valueMap.size());
+ for (Entry<Object, Object> kv : valueMap.entrySet()) {
+ verifiedMap.put(verifyPrimitiveType(kv.getKey(),
componentKeyType.getTypeName(), fieldName),
Review comment:
<!--new_thread; commit:7bf9d2048e8d568ee9280629db391775cc490358;
resolved:0-->
This is actually incorrect right now, since as coded the key type might not
be a primitive type. However as I mentioned in Schema.java, I think it would be
better to change the key type to be a TypeName, in which case this logic will
be correct.
----------------------------------------------------------------
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: 89880)
Time Spent: 2h (was: 1h 50m)
> support data type MAP
> ---------------------
>
> Key: BEAM-2990
> URL: https://issues.apache.org/jira/browse/BEAM-2990
> Project: Beam
> Issue Type: New Feature
> Components: dsl-sql
> Reporter: Xu Mingmin
> Assignee: Xu Mingmin
> Priority: Major
> Time Spent: 2h
> Remaining Estimate: 0h
>
> support Non-scalar types:
> MAP Collection of keys mapped to values
> ARRAY Ordered, contiguous collection that may contain duplicates
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)