[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 22:01
Start Date: 20/May/20 22:01
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit merged pull request #11754:
URL: https://github.com/apache/beam/pull/11754


   



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


Issue Time Tracking
---

Worklog Id: (was: 435723)
Time Spent: 2h 50m  (was: 2h 40m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 2h 50m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 22:01
Start Date: 20/May/20 22:01
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on pull request #11754:
URL: https://github.com/apache/beam/pull/11754#issuecomment-631750861


   I'm going to go ahead and merge since CI failure is unrelated



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


Issue Time Tracking
---

Worklog Id: (was: 435722)
Time Spent: 2h 40m  (was: 2.5h)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 2h 40m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 19:02
Start Date: 20/May/20 19:02
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on pull request #11754:
URL: https://github.com/apache/beam/pull/11754#issuecomment-631665220


   Run Java PreCommit



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


Issue Time Tracking
---

Worklog Id: (was: 435616)
Time Spent: 2.5h  (was: 2h 20m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 2.5h
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 18:43
Start Date: 20/May/20 18:43
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on pull request #11754:
URL: https://github.com/apache/beam/pull/11754#issuecomment-631654862


   Run Java PreCommit



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


Issue Time Tracking
---

Worklog Id: (was: 435595)
Time Spent: 2h 20m  (was: 2h 10m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 2h 20m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-20 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 16:31
Start Date: 20/May/20 16:31
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on pull request #11754:
URL: https://github.com/apache/beam/pull/11754#issuecomment-631585754


   retest this please



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


Issue Time Tracking
---

Worklog Id: (was: 435539)
Time Spent: 2h 10m  (was: 2h)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 2h 10m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 01:16
Start Date: 20/May/20 01:16
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427686703



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   Actually, it is not due to the reduction in the number of field, but the 
order in which the fields are selected in the SELECT statement. Here is the 
order it expects
   
   * Int, String, Double
   
   and the fields that represent those types are: c1, c2, c3
   
   If your results print out of order, it fails due to the 
`ClassCastException`. I tried doing this query and it failed:
   `select  c2, sum(c1), sum(c3) from CASE1_RESULT group by c2`,
   
   but if I do 
   `select  sum(c1),c2, sum(c3) from CASE1_RESULT group by c2` 
   
   it works! You can see that in the one that failed, c1 and c2s positions have 
switched, so the encoder trips out. What's cool is that you can see the results 
correctly calculated in:
   ` System.out.println("CASE1_RESULT: " + input.getValues());`
   
   but it seems that when the result is encoded, the program throws an error 
due to the results being out of order. I guess this is because it sees 
`.setRowSchema(type);`, and as the order of the schema is "Int, String, 
Double", the results have to abide by that rule. That why it fails when we did:
   
   `c2, sum(c3) from CASE1_RESULT group by c2`
   





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


Issue Time Tracking
---

Worklog Id: (was: 435305)
Time Spent: 2h  (was: 1h 50m)

> BeamSqlExample.java fails to build when running ./gradlew command
> 

[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 01:16
Start Date: 20/May/20 01:16
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427686703



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   Actually, it is not due to the reduction in the number of field, but the 
order in which the fields are printed. Here is the order it expects
   
   * Int, String, Double
   
   and the fields that represent those types are: c1, c2, c3
   
   If your results print out of order, it fails due to the 
`ClassCastException`. I tried doing this query and it failed:
   `select  c2, sum(c1), sum(c3) from CASE1_RESULT group by c2`,
   
   but if I do 
   `select  sum(c1),c2, sum(c3) from CASE1_RESULT group by c2` 
   
   it works! You can see that in the one that failed, c1 and c2s positions have 
switched, so the encoder trips out. What's cool is that you can see the results 
correctly calculated in:
   ` System.out.println("CASE1_RESULT: " + input.getValues());`
   
   but it seems that when the result is encoded, the program throws an error 
due to the results being out of order. I guess this is because it sees 
`.setRowSchema(type);`, and as the order of the schema is "Int, String, 
Double", the results have to abide by that rule. That why it fails when we did:
   
   `c2, sum(c3) from CASE1_RESULT group by c2`
   





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


Issue Time Tracking
---

Worklog Id: (was: 435304)
Time Spent: 1h 50m  (was: 1h 40m)

> BeamSqlExample.java fails to build when running ./gradlew command
> 

[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 01:13
Start Date: 20/May/20 01:13
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427686703



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   Actually, it is not due to the reduction in the number of field, but the 
order in which the fields are printed. Here is the order it expects
   
   * Int, String, Double
   
   and the fields that represent those types are: c1, c2, c3
   
   If your results print out of order, it fails due to the 
`ClassCastException`. I tried doing this query and it failed:
   `select  c2, sum(c1), sum(c3) from CASE1_RESULT group by c2`,
   
   but if I do 
   `select  sum(c1),c2, sum(c3) from CASE1_RESULT group by c2` 
   
   it works! You can see that in the one that failed, c1 and c2s positions have 
switched, so the encoder trips out. What's cool is that you can see the results 
correctly calculated in:
   ` System.out.println("CASE1_RESULT: " + input.getValues());`
   
   but it seems that when the result is encoded, the program throws an error 
due to the results being out of order





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


Issue Time Tracking
---

Worklog Id: (was: 435302)
Time Spent: 1h 40m  (was: 1.5h)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
> 

[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:52
Start Date: 20/May/20 00:52
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427681580



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   oh for this call you will need to use
   ```
   Schema.builder()
   .addStringField("stringField")
   .addDoubleField("doubleField")
   .build()
   ```
   like you had in the setCoder call





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


Issue Time Tracking
---

Worklog Id: (was: 435292)
Time Spent: 1.5h  (was: 1h 20m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 1.5h
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:41
Start Date: 20/May/20 00:41
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427678727



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   This is part of the Stack trace that makes me think that
   ```
   Caused by: java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Integer
   at org.apache.beam.sdk.coders.VarIntCoder.encode(VarIntCoder.java:33)
   at 
org.apache.beam.sdk.coders.RowCoderGenerator$EncodeInstruction.encodeDelegate(RowCoderGenerator.java:270)
   at 
org.apache.beam.sdk.coders.Coder$ByteBuddy$E99UrF3W.encode(Unknown Source)
   at 
org.apache.beam.sdk.coders.Coder$ByteBuddy$E99UrF3W.encode(Unknown Source)
   at 
org.apache.beam.sdk.schemas.SchemaCoder.encode(SchemaCoder.java:115)
   ```





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


Issue Time Tracking
---

Worklog Id: (was: 435287)
Time Spent: 1h 20m  (was: 1h 10m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 1h 20m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> 

[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:40
Start Date: 20/May/20 00:40
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427678033



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   I tried `setRowSchema(type)` and it failed with `: 
java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Integer`.
   
   I think it is inferring the schema as 3 fields, but the result only returns 
fields, and that's why it throws the error





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


Issue Time Tracking
---

Worklog Id: (was: 435284)
Time Spent: 1h  (was: 50m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 1h
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:40
Start Date: 20/May/20 00:40
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427678033



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   I tried `setRowSchema(type)` and it failed with `: 
java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Integer`.
   
   I think it is inferring the schema as 3 fields, but the result only returns 
two fields, and that's why it throws the error





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


Issue Time Tracking
---

Worklog Id: (was: 435285)
Time Spent: 1h 10m  (was: 1h)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 1h 10m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:40
Start Date: 20/May/20 00:40
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on pull request #11754:
URL: https://github.com/apache/beam/pull/11754#issuecomment-631165775


   > Thank you @omarismail94!
   > 
   > We should probably be running this continuously to make sure we don't 
break it again. Would you mind adding the gradle task for this to the SQL 
preCommit [here](https://github.com/apache/beam/blob/master/build.gradle#L154)? 
That way it will run before we merge any PR that affects SQL.
   
   I will add both this and runPojoExample to SQL preCommit



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


Issue Time Tracking
---

Worklog Id: (was: 435283)
Time Spent: 50m  (was: 40m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 50m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:39
Start Date: 20/May/20 00:39
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427678033



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   I tried `setRowSchema(type) and it failed with `: 
java.lang.ClassCastException: java.lang.String cannot be cast to 
java.lang.Integer`.
   
   I think it is inferring the schema as 3 fields, but the result only returns 
fields, and that's why it throws the error





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


Issue Time Tracking
---

Worklog Id: (was: 435282)
Time Spent: 40m  (was: 0.5h)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 40m
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:38
Start Date: 20/May/20 00:38
Worklog Time Spent: 10m 
  Work Description: omarismail94 commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427677681



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));

Review comment:
   I can do that. I did `setRowSchema(type)` and it worked!





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


Issue Time Tracking
---

Worklog Id: (was: 435281)
Time Spent: 0.5h  (was: 20m)

> BeamSqlExample.java fails to build when running ./gradlew command
> -
>
> Key: BEAM-10037
> URL: https://issues.apache.org/jira/browse/BEAM-10037
> Project: Beam
>  Issue Type: Improvement
>  Components: dsl-sql
>Reporter: Omar Ismail
>Assignee: Omar Ismail
>Priority: P3
>  Time Spent: 0.5h
>  Remaining Estimate: 0h
>
> In the `BeamSqlExample.java` class, the instructions state that to run the 
> example, use: 
> `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
> I tried this and the build failed due to `java.lang.IllegalStateException: 
> Unable to return a default Coder`
>  
> I will try to fix this!



--
This message was sent by Atlassian Jira
(v8.3.4#803005)


[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:29
Start Date: 20/May/20 00:29
Worklog Time Spent: 10m 
  Work Description: TheNeuralBit commented on a change in pull request 
#11754:
URL: https://github.com/apache/beam/pull/11754#discussion_r427674472



##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));
 
 // Case 2. run the query with SqlTransform.query over result PCollection 
of case 1.
 PCollection outputStream2 =
 PCollectionTuple.of(new TupleTag<>("CASE1_RESULT"), outputStream)
 .apply(SqlTransform.query("select c2, sum(c3) from CASE1_RESULT 
group by c2"));
 
 // print the output record of case 2;
-outputStream2.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  CASE1_RESULT: [row, 5.0]
-System.out.println("CASE1_RESULT: " + input.getValues());
-return input;
-  }
-}));
+outputStream2
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  CASE1_RESULT: [row, 5.0]
+System.out.println("CASE1_RESULT: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(
+RowCoder.of(
+Schema.builder()
+.addStringField("stringField")
+.addDoubleField("doubleField")
+.build()));

Review comment:
   Here as well

##
File path: 
sdks/java/extensions/sql/src/main/java/org/apache/beam/sdk/extensions/sql/example/BeamSqlExample.java
##
@@ -66,38 +68,47 @@ public static void main(String[] args) {
 inputTable.apply(SqlTransform.query("select c1, c2, c3 from 
PCOLLECTION where c1 > 1"));
 
 // print the output record of case 1;
-outputStream.apply(
-"log_result",
-MapElements.via(
-new SimpleFunction() {
-  @Override
-  public Row apply(Row input) {
-// expect output:
-//  PCOLLECTION: [3, row, 3.0]
-//  PCOLLECTION: [2, row, 2.0]
-System.out.println("PCOLLECTION: " + input.getValues());
-return input;
-  }
-}));
+outputStream
+.apply(
+"log_result",
+MapElements.via(
+new SimpleFunction() {
+  @Override
+  public Row apply(Row input) {
+// expect output:
+//  PCOLLECTION: [3, row, 3.0]
+//  PCOLLECTION: [2, row, 2.0]
+System.out.println("PCOLLECTION: " + input.getValues());
+return input;
+  }
+}))
+.setCoder(RowCoder.of(type));

Review comment:
   could you change this to `withRowSchema(type)`? It does the same thing, 
but it's less verbose





This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the

[jira] [Work logged] (BEAM-10037) BeamSqlExample.java fails to build when running ./gradlew command

2020-05-19 Thread ASF GitHub Bot (Jira)


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

ASF GitHub Bot logged work on BEAM-10037:
-

Author: ASF GitHub Bot
Created on: 20/May/20 00:14
Start Date: 20/May/20 00:14
Worklog Time Spent: 10m 
  Work Description: omarismail94 opened a new pull request #11754:
URL: https://github.com/apache/beam/pull/11754


   R: @TheNeuralBit 
   
   In the `BeamSqlExample.java` class, the instructions state that to run the 
example, use: 
   
   `./gradlew :sdks:java:extensions:sql:runBasicExample`. 
   
   I tried this and the build failed due to `java.lang.IllegalStateException: 
Unable to return a default Coder`
   
   I fixed this by setting the Coder for both anon transforms. 
   
   
   
   
   
   Thank you for your contribution! Follow this checklist to help us 
incorporate your contribution quickly and easily:
   
- [ ] [**Choose 
reviewer(s)**](https://beam.apache.org/contribute/#make-your-change) and 
mention them in a comment (`R: @username`).
- [ ] Format the pull request title like `[BEAM-XXX] Fixes bug in 
ApproximateQuantiles`, where you replace `BEAM-XXX` with the appropriate JIRA 
issue, if applicable. This will automatically link the pull request to the 
issue.
- [ ] Update `CHANGES.md` with noteworthy changes.
- [ ] If this contribution is large, please file an Apache [Individual 
Contributor License Agreement](https://www.apache.org/licenses/icla.pdf).
   
   See the [Contributor Guide](https://beam.apache.org/contribute) for more 
tips on [how to make review process 
smoother](https://beam.apache.org/contribute/#make-reviewers-job-easier).
   
   Post-Commit Tests Status (on master branch)
   

   
   Lang | SDK | Apex | Dataflow | Flink | Gearpump | Samza | Spark
   --- | --- | --- | --- | --- | --- | --- | ---
   Go | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go/lastCompletedBuild/)
 | --- | --- | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Flink/lastCompletedBuild/)
 | --- | --- | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Go_VR_Spark/lastCompletedBuild/)
   Java | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Apex/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Dataflow_Java11/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Flink_Java11/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Batch/lastCompletedBuild/)[![Build
 
Status](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_PVR_Flink_Streaming/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Gearpump/lastCompletedBuild/)
 | [![Build 
Status](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/badge/icon)](https://builds.apache.org/job/beam_PostCommit_Java_ValidatesRunner_Samza/lastCompletedBuild/)
 | [![Build