[ 
https://issues.apache.org/jira/browse/BEAM-3437?focusedWorklogId=86184&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-86184
 ]

ASF GitHub Bot logged work on BEAM-3437:
----------------------------------------

                Author: ASF GitHub Bot
            Created on: 30/Mar/18 21:59
            Start Date: 30/Mar/18 21:59
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #4964: 
[BEAM-3437] Introduce Schema class, and use it in BeamSQL
URL: https://github.com/apache/beam/pull/4964#discussion_r178376529
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/impl/transform/BeamAggregationTransforms.java
 ##########
 @@ -177,21 +171,30 @@ public AggregationAdaptor(List<AggregateCall> 
aggregationCalls, RowType sourceRo
           int refIndexKey = call.getArgList().get(0);
           int refIndexValue = call.getArgList().get(1);
 
+          FieldTypeDescriptor keyDescriptor =
+              sourceSchema.getField(refIndexKey).getTypeDescriptor();
           BeamSqlInputRefExpression sourceExpKey = new 
BeamSqlInputRefExpression(
-                  CalciteUtils.getFieldCalciteType(sourceRowType, 
refIndexKey), refIndexKey);
+              CalciteUtils.toSqlTypeName(keyDescriptor.getType(), 
keyDescriptor.getMetadata()),
+              refIndexKey);
+
+          FieldTypeDescriptor valueDescriptor =
+              sourceSchema.getField(refIndexValue).getTypeDescriptor();
           BeamSqlInputRefExpression sourceExpValue = new 
BeamSqlInputRefExpression(
-                  CalciteUtils.getFieldCalciteType(sourceRowType, 
refIndexValue), refIndexValue);
+              CalciteUtils.toSqlTypeName(valueDescriptor.getType(), 
valueDescriptor.getMetadata()),
+                  refIndexValue);
 
           sourceFieldExps.add(KV.of(sourceExpKey, sourceExpValue));
         } else {
           int refIndex = call.getArgList().size() > 0 ? 
call.getArgList().get(0) : 0;
+          FieldTypeDescriptor typeDescriptor = 
sourceSchema.getField(refIndex).getTypeDescriptor();
 
 Review comment:
   It's unclear where we're supposed to be using `FieldTypeDescriptor` vs 
`FieldType`. Can they be combined? So that, for example, all fields in 
`FieldType` become instances of `FieldTypeDescriptor`. Do we need both?

----------------------------------------------------------------
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: 86184)

> Support schema in PCollections
> ------------------------------
>
>                 Key: BEAM-3437
>                 URL: https://issues.apache.org/jira/browse/BEAM-3437
>             Project: Beam
>          Issue Type: Wish
>          Components: beam-model
>            Reporter: Jean-Baptiste Onofré
>            Assignee: Jean-Baptiste Onofré
>            Priority: Major
>          Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> As discussed with some people in the team, it would be great to add schema 
> support in {{PCollections}}. It will allow us:
> 1. To expect some data type in {{PTransforms}}
> 2. Improve some runners with additional features (I'm thinking about Spark 
> runner with data frames for instance).
> A technical draft document has been created: 
> https://docs.google.com/document/d/1tnG2DPHZYbsomvihIpXruUmQ12pHGK0QIvXS1FOTgRc/edit?disco=AAAABhykQIs&ts=5a203b46&usp=comment_email_document
> I also started a PoC on a branch, I will update this Jira with a "discussion" 
> PR.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

Reply via email to