[SPARK-62390][SQL][SS][TEST] Add streaming test coverage for BIN BY ### What changes were proposed in this pull request? This PR adds streaming tests for the BIN BY relation operator. `sql-tests/inputs/streaming/bin-by.sql` has three flows that read `STREAM(source)`: - A stateless BIN BY. The sink gets the same rows as the batch query, which the file also runs. - BIN BY, then `GROUP BY bin_start`, with a watermark on `ts_start`. `REFRESH FLOW` fails with `STREAMING_OUTPUT_MODE.UNSUPPORTED_OPERATION`, because `bin_start` does not carry the watermark. - BIN BY, then `GROUP BY ts_start, bin_start`, with a watermark on `ts_start`. The sink gets a group after a later row moves the watermark past the `ts_start` of that group. `UnsupportedOperationsSuite` gets a case that a `BinBy` node above a streaming relation passes `checkForStreaming`. ### Why are the changes needed? BIN BY has batch tests only. The `SQLQueryTestSuite` class doc asks for a test under `sql-tests/inputs/streaming` for each new SQL syntax. These tests record how BIN BY behaves on a streaming input, including the aggregation that append mode rejects. ### Does this PR introduce _any_ user-facing change? No. This PR changes tests only. ### How was this patch tested? Generated the golden files with `SPARK_GENERATE_GOLDEN_FILES=1 build/sbt "sql/testOnly org.apache.spark.sql.StreamingSQLQueryTestSuite -- -z bin-by.sql"`, then ran the same suite without the variable. Also ran it with `SPARK_ANSI_SQL_MODE=false` and `SPARK_CODEGEN_COMPILER=jdk`. Ran `UnsupportedOperationsSuite`. ### Was this patch authored or co-authored using generative AI tooling? Generated-by: Isaac (Claude Fable 5.2) This pull request and its description were written by Isaac. Closes #60911 from vranes/bin-by-streaming-tests. Authored-by: Nikolina Vraneš <nikolina.vranes@databricks.com> Signed-off-by: Wenchen Fan <wenchen@databricks.com> skip-checks: true
Spark is a unified analytics engine for large-scale data processing. It provides high-level APIs in Scala, Java, and Python, and an optimized engine that supports general computation graphs for data analysis. It also supports a rich set of higher-level tools including Spark SQL for SQL and DataFrames, pandas API on Spark for pandas workloads, MLlib for machine learning, GraphX for graph processing, and Structured Streaming for stream processing.
You can find the latest Spark documentation, including a programming guide, on the project web page. This README file only contains basic setup instructions.
See the Apache CI dashboard for an overview of Spark's CI usage.
| Branch | Status |
|---|---|
| master | |
| branch-4.x | |
| branch-4.4 | |
| branch-4.3 | |
| branch-4.2 | |
| branch-4.1 | |
| branch-4.0 | |
| branch-3.5 | |
Spark is built using Apache Maven. To build Spark and its example programs, run:
./build/mvn -DskipTests clean package
(You do not need to do this if you downloaded a pre-built package.)
More detailed documentation is available from the project site, at “Building Spark”.
For general development tips, including info on developing Spark using an IDE, see “Useful Developer Tools”.
The easiest way to start using Spark is through the Scala shell:
./bin/spark-shell
Try the following command, which should return 1,000,000,000:
scala> spark.range(1000 * 1000 * 1000).count()
Alternatively, if you prefer Python, you can use the Python shell:
./bin/pyspark
And run the following command, which should also return 1,000,000,000:
>>> spark.range(1000 * 1000 * 1000).count()
Spark also comes with several sample programs in the examples directory. To run one of them, use ./bin/run-example <class> [params]. For example:
./bin/run-example SparkPi
will run the Pi example locally.
You can set the MASTER environment variable when running examples to submit examples to a cluster. This can be spark:// URL, “yarn” to run on YARN, and “local” to run locally with one thread, or “local[N]” to run locally with N threads. You can also use an abbreviated class name if the class is in the examples package. For instance:
MASTER=spark://host:7077 ./bin/run-example SparkPi
Many of the example programs print usage help if no params are given.
Testing first requires building Spark. Once Spark is built, tests can be run using:
./dev/run-tests
Please see the guidance on how to run tests for a module, or individual tests.
There is also a Kubernetes integration test, see resource-managers/kubernetes/integration-tests/README.md
Spark uses the Hadoop core library to talk to HDFS and other Hadoop-supported storage systems. Because the protocols have changed in different versions of Hadoop, you must build Spark against the same version that your cluster runs.
Please refer to the build documentation at “Specifying the Hadoop Version and Enabling YARN” for detailed guidance on building for a particular distribution of Hadoop, including building for particular Hive and Hive Thriftserver distributions.
Please refer to the Configuration Guide in the online documentation for an overview on how to configure Spark.
Please review the Contribution to Spark guide for information on how to get started contributing to the project.