chamikaramj commented on a change in pull request #12076:
URL: https://github.com/apache/beam/pull/12076#discussion_r445895416
##########
File path: sdks/python/apache_beam/transforms/sql_test.py
##########
@@ -157,6 +157,21 @@ def test_zetasql_generate_data(self):
dialect="zetasql")
assert_that(out, equal_to([(1, "foo", 3.14)]))
+ def test_windowing_before_sql(self):
Review comment:
Do you think we could come up with a test where PTransforms get assigned
to wrong IDs during pipeline expansion (resulting in an invalid pipeline proto)
?
##########
File path: sdks/python/apache_beam/transforms/sql_test.py
##########
@@ -157,6 +157,21 @@ def test_zetasql_generate_data(self):
dialect="zetasql")
assert_that(out, equal_to([(1, "foo", 3.14)]))
+ def test_windowing_before_sql(self):
+ with TestPipeline() as p:
+ windowed = (
+ p | beam.Create([
+ SimpleRow(5, "foo", 1.),
+ SimpleRow(15, "bar", 2.),
+ SimpleRow(25, "baz", 3.)
+ ])
+ | beam.Map(lambda v: beam.window.TimestampedValue(v, v.id)).
+ with_output_types(SimpleRow)
+ | beam.WindowInto(
+ beam.window.FixedWindows(10)).with_output_types(SimpleRow)
+ | SqlTransform("SELECT COUNT(*) as `count` FROM PCOLLECTION"))
+ assert_that(out, equal_to([(1, ), (1, ), (1, )]))
Review comment:
Just curios, Is this failing before the fix or does it pass with a wrong
pipeline ?
----------------------------------------------------------------
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:
[email protected]