[
https://issues.apache.org/jira/browse/BEAM-13757?focusedWorklogId=719649&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-719649
]
ASF GitHub Bot logged work on BEAM-13757:
-----------------------------------------
Author: ASF GitHub Bot
Created on: 02/Feb/22 20:13
Start Date: 02/Feb/22 20:13
Worklog Time Spent: 10m
Work Description: lostluck commented on a change in pull request #16629:
URL: https://github.com/apache/beam/pull/16629#discussion_r797973774
##########
File path: sdks/go/pkg/beam/core/funcx/fn_test.go
##########
@@ -291,6 +301,96 @@ func TestEmits(t *testing.T) {
}
}
+func TestPane(t *testing.T) {
+ tests := []struct {
+ Name string
+ Params []FnParamKind
+ Pos int
+ Exists bool
+ }{
+ {
+ Name: "pane input",
+ Params: []FnParamKind{FnContext, FnPane},
+ Pos: 1,
+ Exists: true,
+ },
+ {
+ Name: "no pane input",
+ Params: []FnParamKind{FnContext, FnEventTime},
+ Pos: -1,
+ Exists: false,
+ },
+ }
+
+ for _, test := range tests {
+ test := test
+ t.Run(test.Name, func(t *testing.T) {
+ // Create a Fn with a filled params list.
+ params := make([]FnParam, len(test.Params))
+ for i, kind := range test.Params {
+ params[i].Kind = kind
+ params[i].T = nil
+ }
+ fn := new(Fn)
+ fn.Param = params
Review comment:
It's in very rare circumstances where one calls "new" for idiomatic go,
to get a pointer value.
```suggestion
fn := &Fn{Params: params}
```
##########
File path: sdks/go/test/integration/integration.go
##########
@@ -61,9 +61,10 @@ var directFilters = []string{
// The direct runner does not yet support cross-language.
"TestXLang.*",
"TestKafkaIO.*",
- "TestJDBCIO_BasicReadWrite",
- // Triggers are not yet supported
+ "TestJDBCIO_BasicReadWrite",
Review comment:
We lost the tab here.
##########
File path: sdks/go/pkg/beam/core/funcx/fn_test.go
##########
@@ -291,6 +301,96 @@ func TestEmits(t *testing.T) {
}
}
+func TestPane(t *testing.T) {
+ tests := []struct {
+ Name string
+ Params []FnParamKind
+ Pos int
+ Exists bool
+ }{
+ {
+ Name: "pane input",
+ Params: []FnParamKind{FnContext, FnPane},
+ Pos: 1,
+ Exists: true,
+ },
+ {
+ Name: "no pane input",
+ Params: []FnParamKind{FnContext, FnEventTime},
+ Pos: -1,
+ Exists: false,
+ },
+ }
+
+ for _, test := range tests {
+ test := test
+ t.Run(test.Name, func(t *testing.T) {
+ // Create a Fn with a filled params list.
+ params := make([]FnParam, len(test.Params))
+ for i, kind := range test.Params {
+ params[i].Kind = kind
+ params[i].T = nil
+ }
+ fn := new(Fn)
+ fn.Param = params
+
+ // Validate we get expected results for pane function.
+ pos, exists := fn.Pane()
+ if exists != test.Exists {
+ t.Errorf("Pane(%v) - exists: got %v, want %v",
params, exists, test.Exists)
+ }
+ if pos != test.Pos {
+ t.Errorf("Pane(%v) - pos: got %v, want %v",
params, pos, test.Pos)
+ }
+ })
+ }
+}
+
+func TestWindow(t *testing.T) {
+ tests := []struct {
+ Name string
+ Params []FnParamKind
+ Pos int
+ Exists bool
+ }{
+ {
+ Name: "window input",
+ Params: []FnParamKind{FnContext, FnWindow},
+ Pos: 1,
+ Exists: true,
+ },
+ {
+ Name: "no window input",
+ Params: []FnParamKind{FnContext, FnEventTime},
+ Pos: -1,
+ Exists: false,
+ },
+ }
+
+ for _, test := range tests {
+ test := test
+ t.Run(test.Name, func(t *testing.T) {
+ // Create a Fn with a filled params list.
+ params := make([]FnParam, len(test.Params))
+ for i, kind := range test.Params {
+ params[i].Kind = kind
+ params[i].T = nil
+ }
+ fn := new(Fn)
+ fn.Param = params
Review comment:
Same here,
--
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.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 719649)
Time Spent: 4h 20m (was: 4h 10m)
> Pane observation in user DoFN
> -----------------------------
>
> Key: BEAM-13757
> URL: https://issues.apache.org/jira/browse/BEAM-13757
> Project: Beam
> Issue Type: Bug
> Components: sdk-go
> Reporter: Ritesh Ghorse
> Assignee: Ritesh Ghorse
> Priority: P2
> Time Spent: 4h 20m
> Remaining Estimate: 0h
>
> Handle pane propagation in exec package and pane observation in user DoFns so
> that users can access additional parameter [PaneInfo
> |https://github.com/apache/beam/blob/b0e9f2638cbaca822ee6a58bd8ec0e61db8e799e/sdks/go/pkg/beam/core/typex/special.go#L77]from
> DoFn. This would help in knowing whether the pane is fired on-time, late,
> early or first and last.
--
This message was sent by Atlassian Jira
(v8.20.1#820001)