Halaman ini belum tersedia dalam bahasa lokal Anda. Kami berusaha keras untuk menambahkan lebih banyak versi bahasa. Terima kasih atas dukungan Anda.

Compute
Elastic Cloud Server
Huawei Cloud Flexus
Bare Metal Server
Auto Scaling
Image Management Service
Dedicated Host
FunctionGraph
Cloud Phone Host
Huawei Cloud EulerOS
Networking
Virtual Private Cloud
Elastic IP
Elastic Load Balance
NAT Gateway
Direct Connect
Virtual Private Network
VPC Endpoint
Cloud Connect
Enterprise Router
Enterprise Switch
Global Accelerator
Management & Governance
Cloud Eye
Identity and Access Management
Cloud Trace Service
Resource Formation Service
Tag Management Service
Log Tank Service
Config
OneAccess
Resource Access Manager
Simple Message Notification
Application Performance Management
Application Operations Management
Organizations
Optimization Advisor
IAM Identity Center
Cloud Operations Center
Resource Governance Center
Migration
Server Migration Service
Object Storage Migration Service
Cloud Data Migration
Migration Center
Cloud Ecosystem
KooGallery
Partner Center
User Support
My Account
Billing Center
Cost Center
Resource Center
Enterprise Management
Service Tickets
HUAWEI CLOUD (International) FAQs
ICP Filing
Support Plans
My Credentials
Customer Operation Capabilities
Partner Support Plans
Professional Services
Analytics
MapReduce Service
Data Lake Insight
CloudTable Service
Cloud Search Service
Data Lake Visualization
Data Ingestion Service
GaussDB(DWS)
DataArts Studio
Data Lake Factory
DataArts Lake Formation
IoT
IoT Device Access
Others
Product Pricing Details
System Permissions
Console Quick Start
Common FAQs
Instructions for Associating with a HUAWEI CLOUD Partner
Message Center
Security & Compliance
Security Technologies and Applications
Web Application Firewall
Host Security Service
Cloud Firewall
SecMaster
Anti-DDoS Service
Data Encryption Workshop
Database Security Service
Cloud Bastion Host
Data Security Center
Cloud Certificate Manager
Edge Security
Managed Threat Detection
Blockchain
Blockchain Service
Web3 Node Engine Service
Media Services
Media Processing Center
Video On Demand
Live
SparkRTC
MetaStudio
Storage
Object Storage Service
Elastic Volume Service
Cloud Backup and Recovery
Storage Disaster Recovery Service
Scalable File Service Turbo
Scalable File Service
Volume Backup Service
Cloud Server Backup Service
Data Express Service
Dedicated Distributed Storage Service
Containers
Cloud Container Engine
SoftWare Repository for Container
Application Service Mesh
Ubiquitous Cloud Native Service
Cloud Container Instance
Databases
Relational Database Service
Document Database Service
Data Admin Service
Data Replication Service
GeminiDB
GaussDB
Distributed Database Middleware
Database and Application Migration UGO
TaurusDB
Middleware
Distributed Cache Service
API Gateway
Distributed Message Service for Kafka
Distributed Message Service for RabbitMQ
Distributed Message Service for RocketMQ
Cloud Service Engine
Multi-Site High Availability Service
EventGrid
Dedicated Cloud
Dedicated Computing Cluster
Business Applications
Workspace
ROMA Connect
Message & SMS
Domain Name Service
Edge Data Center Management
Meeting
AI
Face Recognition Service
Graph Engine Service
Content Moderation
Image Recognition
Optical Character Recognition
ModelArts
ImageSearch
Conversational Bot Service
Speech Interaction Service
Huawei HiLens
Video Intelligent Analysis Service
Developer Tools
SDK Developer Guide
API Request Signing Guide
Terraform
Koo Command Line Interface
Content Delivery & Edge Computing
Content Delivery Network
Intelligent EdgeFabric
CloudPond
Intelligent EdgeCloud
Solutions
SAP Cloud
High Performance Computing
Developer Services
ServiceStage
CodeArts
CodeArts PerfTest
CodeArts Req
CodeArts Pipeline
CodeArts Build
CodeArts Deploy
CodeArts Artifact
CodeArts TestPlan
CodeArts Check
CodeArts Repo
Cloud Application Engine
MacroVerse aPaaS
KooMessage
KooPhone
KooDrive
On this page

Show all

Spark Open Source Commands

Updated on 2025-01-22 GMT+08:00

This section describes the open source Spark SQL syntax supported by DLI. For details about the syntax, parameters, and examples, see Spark SQL Syntax.

Table 1 DLI Spark open source commands

Function

Syntax Example

DLI Spark 2.4.5

DLI Spark 3.3.1

Creating a database

CREATE DATABASE testDB;

Supported

Supported

Creating a DLI table

create table if not exists testDB.testTable1(

id int,

age int,

money double

);

Supported

Supported

Creating an OBS table

create table if not exists testDB.testTable2(

id int,

age int,

money double

)

LOCATION 'obs://bucketName/filePath'

partitioned by (dt string)

row format delimited fields terminated by ','

STORED as TEXTFILE;

Supported

Supported

Inserting test data

insert into table testDB.testTable2 values

(1, 18, 3.14, "20240101" ),

(2, 18, 3.15, "20240102" );

Supported

Supported

Changing database attributes

ALTER DATABASE testDB SET DBPROPERTIES ('Edited-by' = 'John');

Not supported

Not supported

Changing the path for storing database files on OBS

ALTER DATABASE testDB SET LOCATION 'obs://bucketName/filePath';

Not supported

Not supported

Changing a table name

ALTER TABLE testDB.testTable1 RENAME TO testDB.testTable101;

Supported

Supported

Changing the name of a partition in a table

ALTER TABLE testDB.testTable2 PARTITION ( dt='20240101') RENAME TO PARTITION ( dt='20240103');

It only supports renaming partitions of tables stored in OBS, and the storage path of the table in OBS will not change.

Supported

Supported

Adding a column

ALTER TABLE testDB.testTable1 ADD COLUMNS (name string);

Supported

Supported

Dropping a column

ALTER TABLE testDB.testTable1 DROP columns (money);

Not supported

Not supported

Changing the name of a column

ALTER TABLE testDB.testTable1 RENAME COLUMN age TO years_of_age;

Not supported

Not supported

Modifying column comments

ALTER TABLE testDB.testTable1 ALTER COLUMN age COMMENT "new comment";

Not supported

Supported

Replacing a specified column

ALTER TABLE testDB.testTable1 REPLACE COLUMNS (name string, ID int COMMENT 'new comment');

Not supported

Not supported

Customizing table attributes

ALTER TABLE testDB.testTable1 SET TBLPROPERTIES ('aaa' = 'bbb');

Supported

Supported

Adding or modifying table comments

ALTER TABLE testDB.testTable1 SET TBLPROPERTIES ('comment' = 'test');

Supported

Not supported

Changing the storage format of a table

ALTER TABLE testDB.testTable1 SET fileformat csv;

Not supported

Not supported

Deleting a table attribute

ALTER TABLE testDB.testTable1 UNSET TBLPROPERTIES ('test');

Supported

Supported

Deleting table comments

ALTER TABLE testDB.testTable1 UNSET TBLPROPERTIES ('comment');

Supported

Supported

Displaying column information

DESCRIBE database_name.table_name col_name;

Example: DESCRIBE testDB.testTable1 id;

Supported

Supported

Displaying column information

DESCRIBE table_name table_name.col_name;

Example: DESCRIBE testTable1 testTable1.id;

It only supports viewing the column information for tables in the current database.

Supported

Supported

Returning metadata information of a query statement

DESCRIBE QUERY SELECT age, sum(age) FROM testDB.testTable1 GROUP BY age;

Not supported

Supported

Returning metadata information of inserted data

DESCRIBE QUERY VALUES(100, 10, 10000.20D) AS testTable1(id, age, money);

Not supported

Supported

Returning metadata information of a table

DESCRIBE QUERY TABLE testTable1;

Not supported

Supported

Returning metadata information of a column in a table

DESCRIBE FROM testTable1 SELECT age;

Not supported

Supported

Returning the table creation statements for a table

SHOW CREATE TABLE testDB.testTable1 AS SERDE;

When executing this statement in Spark 3.3.1, it only applies to query the table creation statements for Hive tables.

Not supported

Supported

Returning the table creation statements for a table

SHOW CREATE TABLE testDB.testTable1;

Supported

Supported

Kami menggunakan cookie untuk meningkatkan kualitas situs kami dan pengalaman Anda. Dengan melanjutkan penelusuran di situs kami berarti Anda menerima kebijakan cookie kami. Cari tahu selengkapnya

Feedback

Feedback

Feedback

0/500

Selected Content

Submit selected content with the feedback