[SPARK-45145][EXAMPLE] Add JavaSparkSQLCli example#42900
Closed
dongjoon-hyun wants to merge 2 commits intoapache:masterfrom
Closed
[SPARK-45145][EXAMPLE] Add JavaSparkSQLCli example#42900dongjoon-hyun wants to merge 2 commits intoapache:masterfrom
dongjoon-hyun wants to merge 2 commits intoapache:masterfrom
Conversation
Member
Author
|
Hi, @HyukjinKwon . Do you think we can have this additional example? |
HyukjinKwon
approved these changes
Sep 13, 2023
yaooqinn
approved these changes
Sep 13, 2023
Member
Author
|
Thank you, @HyukjinKwon and @yaooqinn . |
Member
Author
|
Merged to master for Apache Spark 4.0. |
viirya
pushed a commit
to viirya/spark-1
that referenced
this pull request
Oct 19, 2023
### What changes were proposed in this pull request? This PR aims to add a simple Java example, `JavaSparkSQLCli.java`. Like SparkPi example, we can take advantage of this minimal example with `bin/run-example` and we can run a simple SQL query as a canary test during RC testing and voting phase. - https://spark.apache.org/docs/3.5.0/ ``` ./bin/run-example SparkPi 10 ``` After this PR, ``` $ bin/run-example sql.JavaSparkSQLCli "SELECT 'Spark SQL' col" +---------+ |col | +---------+ |Spark SQL| +---------+ ``` ### Why are the changes needed? Although there exists `org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver` and `bin/spark-sql` shell environment, it requires `-Phive -Phive-thriftserver` explicitly. ``` $ bin/spark-shell --version Welcome to ____ __ / __/__ ___ _____/ /__ _\ \/ _ \/ _ `/ __/ '_/ /___/ .__/\_,_/_/ /_/\_\ version 3.5.0 /_/ ... $ bin/run-example org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver ... Error: Failed to load class org.apache.spark.examples.org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver. Failed to load main class org.apache.spark.examples.org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriver. You need to build Spark with -Phive and -Phive-thriftserver. 23/09/12 23:06:38 INFO ShutdownHookManager: Shutdown hook called 23/09/12 23:06:38 INFO ShutdownHookManager: Deleting directory /private/var/folders/d4/dr6zxyvd4cl38877bj3fxs_m0000gn/T/spark-2a9ee4a3-64c3-492c-a268-a71b9aa44a2a ``` ### Does this PR introduce _any_ user-facing change? No. ### How was this patch tested? Manually. ``` $ build/sbt test:package $ bin/run-example sql.JavaSparkSQLCli "SELECT 'Spark SQL' col" ``` ### Was this patch authored or co-authored using generative AI tooling? No. Closes apache#42900 from dongjoon-hyun/SPARK-45145. Authored-by: Dongjoon Hyun <dhyun@apple.com> Signed-off-by: Dongjoon Hyun <dhyun@apple.com> (cherry picked from commit 66f42b5) Signed-off-by: Dongjoon Hyun <dongjoon@apache.org>
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
What changes were proposed in this pull request?
This PR aims to add a simple Java example,
JavaSparkSQLCli.java. Like SparkPi example, we can take advantage of this minimal example withbin/run-exampleand we can run a simple SQL query as a canary test during RC testing and voting phase.After this PR,
Why are the changes needed?
Although there exists
org.apache.spark.sql.hive.thriftserver.SparkSQLCLIDriverandbin/spark-sqlshell environment, it requires-Phive -Phive-thriftserverexplicitly.Does this PR introduce any user-facing change?
No.
How was this patch tested?
Manually.
Was this patch authored or co-authored using generative AI tooling?
No.