-
Notifications
You must be signed in to change notification settings - Fork 4.5k
Phase 1sh - more yaml integration tests #34692
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
b672c8a
assign_timestamp yaml test
derrickaw dea134f
create yaml test
derrickaw 3f68614
extract window yaml test
derrickaw c86cc0b
ml transform yaml test
derrickaw f3d5e92
validate with schema yaml test
derrickaw 936f292
add extra grandle parameter for ml_test
derrickaw 0a32118
add ml_test package if parameter is present
derrickaw File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,84 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| pipelines: | ||
| # Assign timestamp to beam row element | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| name: CreateVisits | ||
| config: | ||
| elements: | ||
| - user: alice | ||
| new_time_stamp: 1 | ||
| - user: alice | ||
| new_time_stamp: 3 | ||
| - user: bob | ||
| new_time_stamp: 7 | ||
| - type: AssignTimestamps | ||
| config: | ||
| timestamp: new_time_stamp | ||
| - type: ExtractWindowingInfo | ||
| config: | ||
| fields: [timestamp] | ||
| - type: MapToFields | ||
| config: | ||
| language: python | ||
| fields: | ||
| user: user | ||
| timestamp: timestamp | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {user: "alice", timestamp: 1} | ||
| - {user: "alice", timestamp: 3} | ||
| - {user: "bob", timestamp: 7} | ||
|
|
||
| # Assign timestamp to beam row element with error_handling | ||
| - pipeline: | ||
| type: composite | ||
| transforms: | ||
| - type: Create | ||
| name: CreateVisits | ||
| config: | ||
| elements: | ||
| - {user: alice, timestamp: "not-valid"} | ||
| - {user: bob, timestamp: 3} | ||
| - type: AssignTimestamps | ||
| input: CreateVisits | ||
| config: | ||
| timestamp: timestamp | ||
| error_handling: | ||
| output: invalid_rows | ||
| - type: MapToFields | ||
| input: AssignTimestamps.invalid_rows | ||
| config: | ||
| language: python | ||
| fields: | ||
| user: "element.user" | ||
| timestamp: "element.timestamp" | ||
| - type: AssertEqual | ||
| input: MapToFields | ||
| config: | ||
| elements: | ||
| - {user: "alice", timestamp: "not-valid"} | ||
| - type: AssertEqual | ||
| input: AssignTimestamps | ||
| config: | ||
| elements: | ||
| - {user: bob, timestamp: 3} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,66 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| pipelines: | ||
| # Simple Create with element list | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: [1,2,3,4,5] | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {element: 1} | ||
| - {element: 2} | ||
| - {element: 3} | ||
| - {element: 4} | ||
| - {element: 5} | ||
|
|
||
| # Simple Create with more complex beam row | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: | ||
| - {first: 0, second: [1,2,3]} | ||
| - {first: 1, second: [4,5,6]} | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {first: 0, second: [1,2,3]} | ||
| - {first: 1, second: [4,5,6]} | ||
|
|
||
| # Simple Create with reshuffle | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: | ||
| - {first: 0, second: [1,2,3]} | ||
| - {first: 1, second: [4,5,6]} | ||
| - {first: 2, second: [7,8,9]} | ||
| reshuffle: false | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {first: 0, second: [1,2,3]} | ||
| - {first: 1, second: [4,5,6]} | ||
| - {first: 2, second: [7,8,9]} |
131 changes: 131 additions & 0 deletions
131
sdks/python/apache_beam/yaml/tests/extract_windowing_Info.yaml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,131 @@ | ||
| # | ||
| # Licensed to the Apache Software Foundation (ASF) under one or more | ||
| # contributor license agreements. See the NOTICE file distributed with | ||
| # this work for additional information regarding copyright ownership. | ||
| # The ASF licenses this file to You under the Apache License, Version 2.0 | ||
| # (the "License"); you may not use this file except in compliance with | ||
| # the License. You may obtain a copy of the License at | ||
| # | ||
| # http://www.apache.org/licenses/LICENSE-2.0 | ||
| # | ||
| # Unless required by applicable law or agreed to in writing, software | ||
| # distributed under the License is distributed on an "AS IS" BASIS, | ||
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
| # See the License for the specific language governing permissions and | ||
| # limitations under the License. | ||
| # | ||
|
|
||
| pipelines: | ||
| # Simply extract windowing info with no fields resulting in default fields | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0} | ||
| - {label: "37a", rank: 1} | ||
| - {label: "389a", rank: 2} | ||
| - type: ExtractWindowingInfo | ||
| - type: MapToFields | ||
| config: | ||
| language: python | ||
| fields: | ||
| label: | ||
| callable: "lambda x: x.label" | ||
| rank: | ||
| callable: "lambda x: x.rank" | ||
| timestamp: | ||
| callable: "lambda x: str(x.timestamp)" | ||
| window_start: | ||
| callable: "lambda x: str(x.window_start)" | ||
| window_end: | ||
| callable: "lambda x: str(x.window_end)" | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000)} | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Global window is default. The min / max timestamp of global window is also internal implementation detail (?). Consider assign a fixed window then assert (could be follow up) |
||
| - {label: "37a", rank: 1, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000)} | ||
| - {label: "389a", rank: 2, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000)} | ||
|
|
||
|
|
||
| # Simply extract windowing info with all available fields | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0} | ||
| - {label: "37a", rank: 1} | ||
| - {label: "389a", rank: 2} | ||
| - type: ExtractWindowingInfo | ||
| config: | ||
| fields: [timestamp, window_start, window_end, window_string, window_type, window_object, pane_info] | ||
| - type: MapToFields | ||
| config: | ||
| language: python | ||
| fields: | ||
| label: | ||
| callable: "lambda x: x.label" | ||
| rank: | ||
| callable: "lambda x: x.rank" | ||
| timestamp: | ||
| callable: "lambda x: str(x.timestamp)" | ||
| window_start: | ||
| callable: "lambda x: str(x.window_start)" | ||
| window_end: | ||
| callable: "lambda x: str(x.window_end)" | ||
| window_string: | ||
| callable: "lambda x: str(x.window_string)" | ||
| window_type: | ||
| callable: "lambda x: str(x.window_type)" | ||
| window_object: | ||
| callable: "lambda x: str(x.window_object)" | ||
| pane_info: | ||
| callable: "lambda x: str(x.pane_info)" | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000), window_string: 'GlobalWindow', window_type: 'GlobalWindow', window_object: 'GlobalWindow', pane_info: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
| - {label: "37a", rank: 1, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000), window_string: 'GlobalWindow', window_type: 'GlobalWindow', window_object: 'GlobalWindow', pane_info: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
| - {label: "389a", rank: 2, timestamp: Timestamp(-9223372036854.775000), window_start: Timestamp(-9223372036854.775000), window_end: Timestamp(9223371950454.775000), window_string: 'GlobalWindow', window_type: 'GlobalWindow', window_object: 'GlobalWindow', pane_info: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
|
|
||
|
|
||
| # Simply extract windowing info with a few fields renamed | ||
| - pipeline: | ||
| type: chain | ||
| transforms: | ||
| - type: Create | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0} | ||
| - {label: "37a", rank: 1} | ||
| - {label: "389a", rank: 2} | ||
| - type: ExtractWindowingInfo | ||
| config: | ||
| fields: | ||
| ts: timestamp | ||
| ws: window_start | ||
| pane: pane_info | ||
| - type: MapToFields | ||
| config: | ||
| language: python | ||
| fields: | ||
| label: | ||
| callable: "lambda x: x.label" | ||
| rank: | ||
| callable: "lambda x: x.rank" | ||
| ts: | ||
| callable: "lambda x: str(x.ts)" | ||
| ws: | ||
| callable: "lambda x: str(x.ws)" | ||
| pane: | ||
| callable: "lambda x: str(x.pane)" | ||
| - type: AssertEqual | ||
| config: | ||
| elements: | ||
| - {label: "11a", rank: 0, ts: Timestamp(-9223372036854.775000), ws: Timestamp(-9223372036854.775000), pane: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
| - {label: "37a", rank: 1, ts: Timestamp(-9223372036854.775000), ws: Timestamp(-9223372036854.775000), pane: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
| - {label: "389a", rank: 2, ts: Timestamp(-9223372036854.775000), ws: Timestamp(-9223372036854.775000), pane: "PaneInfoTuple(is_first=True, is_last=True, timing='UNKNOWN', index=0, nonspeculative_index=0)"} | ||
|
|
||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As we add more tests, it may worth split out the workflow and create a "PreCommit YAML Xlang" exercises more tests on postsubmit schedule, to keep presubmit run on reasonable time. Could be a follow up