Description:
Execute a SQL command on a Spark table.
Syntax:
spark_shell
(con,sql)
Note:
External library function (See External Library Guide).
The function executes a SQL command on a Spark table.
Parameter:
con |
Database connection string, which can be a Spark connection, a Spark connection using Hudi/Iceberg format, or a Spark connection using Hudi/Iceberg format used with S3. |
sql |
A SQL statement. |
Example:
|
|
|
|
|
Connect to a Spark database. |
|
|
List all tables in the specified database named mytest1. |
|
|
|
|
|
Connect to a Spark database using Hudi format. |
|
|
Query data in table emp1. |
|
|
|
|
|
Connect to a Spark database using Iceberg format. |
|
|
Delete table test1. |
|
|
|
|
|
Connect to a Spark database using Hudi format used with S3. |
|
|
List all databases. |
|
|
|
|
|
Connect to a Spark database using Iceberg format used with S3. |
|
|
Query data in table icetest1. |
|
|
|