rangadi commented on code in PR #40691: URL: https://github.com/apache/spark/pull/40691#discussion_r1161970615
########## python/pyspark/sql/tests/streaming/test_streaming_foreach_family.py: ########## @@ -0,0 +1,369 @@ +# +# 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. +# + +import os +import tempfile +import time + +from pyspark.testing.sqlutils import ReusedSQLTestCase + + +class StreamingTestsForeachFamilyMixin: Review Comment: Wondering why 'foreach family'. What are the other foreach() methods tested here? ########## python/pyspark/sql/tests/streaming/test_streaming.py: ########## @@ -26,7 +26,39 @@ from pyspark.testing.sqlutils import ReusedSQLTestCase -class StreamingTests(ReusedSQLTestCase): +class StreamingTestsMixin: + def test_streaming_query_functions_sanity(self): Review Comment: Is this a new test? Could you add brief description? `test... sanity` does not sound good. May be `test_streaming_query_functions_basic()` ? ########## python/pyspark/sql/tests/streaming/test_streaming.py: ########## @@ -77,8 +109,14 @@ def test_stream_read_options_overwrite(self): .schema(bad_schema) .load(path="python/test_support/sql/streaming", schema=schema, format="text") ) - self.assertTrue(df.isStreaming) - self.assertEqual(df.schema.simpleString(), "struct<data:string>") + # TODO: Moving this outside of with block will trigger the following error, Review Comment: It does not need to be a TODO. Testing it inside `with` is the right thing. Calls like `schema` are executed on server with the updated state of the conf. ########## python/pyspark/sql/tests/streaming/test_streaming_foreach_family.py: ########## @@ -0,0 +1,369 @@ +# +# 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. +# + +import os +import tempfile +import time + +from pyspark.testing.sqlutils import ReusedSQLTestCase + + +class StreamingTestsForeachFamilyMixin: + class ForeachWriterTester: Review Comment: When I tried these tests, I got a serialization error after moving this to 'Mixin'. We could handle it when run into it with connect tests. ########## python/pyspark/sql/tests/streaming/test_streaming.py: ########## @@ -295,334 +333,6 @@ def test_query_manager_await_termination(self): q.stop() shutil.rmtree(tmpPath) - class ForeachWriterTester: Review Comment: Moving foreach tests to a different files SGTM. ########## python/pyspark/sql/streaming/query.py: ########## @@ -188,7 +192,7 @@ def awaitTermination(self, timeout: Optional[int] = None) -> Optional[bool]: Return whether the query has terminated or not within 5 seconds - >>> sq.awaitTermination(5) + >>> sq.awaitTermination(5) # doctest: +SKIP Review Comment: Why are these needed? This won't be tested in connect yet, right? ########## python/pyspark/sql/streaming/readwriter.py: ########## @@ -89,8 +92,8 @@ def format(self, source: str) -> "DataStreamReader": Examples -------- - >>> spark.readStream.format("text") - <pyspark.sql.streaming.readwriter.DataStreamReader object ...> + >>> spark.readStream.format("text") # doctest: +ELLIPSIS Review Comment: Is `# doctest: +ELLIPSIS` needed? I didn't add in my PR (#40586) ########## python/pyspark/sql/tests/streaming/test_streaming_foreach_family.py: ########## @@ -0,0 +1,369 @@ +# +# 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. +# + +import os +import tempfile +import time + +from pyspark.testing.sqlutils import ReusedSQLTestCase + + +class StreamingTestsForeachFamilyMixin: Review Comment: Better not to have Mixin class yet. We don't have corresponding '_partity_' tests in connect for this. -- 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] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
