Updated on 2026-11-06 GMT+08:00

Table Type Description

Comparison Between External Table and Managed Table

AI DataLake Spark SQL endpoints support two table types: external table and managed table.

Feature

External Table

Managed Table

Data Storage Location

External OBS path (specified via LOCATION)

Platform internal storage

Drop Table Behavior

Only metadata is deleted. Data remains in OBS.

Both metadata and data are deleted.

Table Creation Keyword

Does not use the EXTERNAL keyword. Identified by specifying LOCATION.

LOCATION is not specified.

Data Lifecycle

OBS data is managed by the user.

Managed by the platform

Use Cases

Data already exists in OBS and needs to be shared across services.

Temporary data, intermediate results, and platform-managed data

Difference from Open-Source Spark

Open-source Spark uses CREATE EXTERNAL TABLE. The platform does not use the EXTERNAL keyword.

Consistent with open-source Spark

Supported Table Creation Syntax

DataSource syntax and Hive syntax

DataSource syntax and Hive syntax

The external table (OBS table) in AI DataLake is conceptually consistent with the external table in open-source Spark. However, the table creation syntax does not use the EXTERNAL keyword, which is the main difference from open-source Spark. External tables are created by specifying a LOCATION 'obs://...' path.

CREATE TABLE Default Storage Engine Change

In Spark 3.x, when CREATE TABLE does not specify a USING clause, the Hive storage format is used by default.

In Spark 4.0, the default storage format is determined by the spark.sql.sources.default configuration, which is typically parquet.

Table 1 Behavior change comparison

Scenario

Spark 3.x

Spark 4.0

CREATE TABLE t (id INT)

Default Hive format

Default Parquet format

CREATE TABLE t (id INT) USING hive

Hive format

Hive format (explicitly specified)

CREATE TABLE t (id INT) USING parquet

Parquet format

Parquet format (explicitly specified)

  • Usage recommendations:
    • Explicitly specify the storage format in all CREATE TABLE statements to avoid relying on default values. For CREATE TABLE statements without USING, confirm the expected format.
    • AI DataLake recommends that all CREATE TABLE statements explicitly include a USING clause.
    • For managed tables in AI DataLake, USING parquet or USING orc is recommended.
  • Recommended syntax: explicitly specify the format
    -- Create a managed table using the Parquet format.
    CREATE TABLE t1 (id INT, name STRING) USING parquet;
    
    -- Create an OBS table using the Parquet format.
    CREATE TABLE t3 (id INT, name STRING) USING parquet 
    LOCATION 'obs://bucket/path';