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

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

                Author: ASF GitHub Bot
            Created on: 08/Aug/18 22:03
            Start Date: 08/Aug/18 22:03
    Worklog Time Spent: 10m 
      Work Description: akedin commented on a change in pull request #6175: 
[BEAM-5103][SQL]test aggregation functions at DSL level
URL: https://github.com/apache/beam/pull/6175#discussion_r208750875
 
 

 ##########
 File path: 
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/integrationtest/BeamSqlBuiltinFunctionsIntegrationTestBase.java
 ##########
 @@ -180,13 +264,27 @@ public void buildRunAndCheck() {
 
         PCollection<Row> output =
             inputCollection.apply(testCase.toString(), 
SqlTransform.query(sql));
-
-        PAssert.that(output)
-            
.containsInAnyOrder(TestUtils.RowsBuilder.of(schema).addRows(expectedValue).getRows());
+        if (testCase.isCompareNonExactNumber()) {
+          PAssert.that(output).satisfies(matchesScalar((double) expectedValue, 
PRECISION));
+        } else {
+          PAssert.that(output)
+              .containsInAnyOrder(
+                  
TestUtils.RowsBuilder.of(schema).addRows(expectedValue).getRows());
+        }
       }
 
       inputCollection.getPipeline().run();
     }
+
+    private TypeName getTypeName(Object expectedValue) {
+      // Because of erasure, we can only automatically infer non-parameterized 
types
+      TypeName resultTypeName = 
JAVA_CLASS_TO_TYPENAME.get(expectedValue.getClass());
+      checkArgument(
+          resultTypeName != null,
+          "Could not infer a Beam type for %s."
+              + " Parameterized types must be provided explicitly.");
 
 Review comment:
   Add `expectedValue` to the parameter of `checkArgument`.
   Update the message to something like `"You're calling 'addExpr(String expr, 
Object expected)' for unknown type of the expected object '%s'. Please use 
'addExpr(String expr, Object expected, FieldType type)' overload instead and 
provide the type of the expected object"`. Otherwise it's hard to understand 
what should be done in this case.

----------------------------------------------------------------
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: 132701)
    Time Spent: 2h 20m  (was: 2h 10m)

> Test aggregation functions at DSL levels
> ----------------------------------------
>
>                 Key: BEAM-5103
>                 URL: https://issues.apache.org/jira/browse/BEAM-5103
>             Project: Beam
>          Issue Type: Sub-task
>          Components: dsl-sql
>            Reporter: Rui Wang
>            Assignee: Rui Wang
>            Priority: Major
>          Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> Typical aggregation functions include COUNT, SUM, MAX, MIN, etc.



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

Reply via email to