Skip to main content

Delta Lake tables

A generic lakehouse catalog can register existing Delta Lake tables: tables whose format property is delta. Gravitino records the columns, location, and properties you give it and never reads or writes the Delta data or its transaction log. Every Delta table is external, so dropping it from Gravitino leaves the data where it is.

Quick start​

The example registers an existing Delta table at s3://{bucket}/delta/orders as orders in the schema sales of the generic lakehouse catalog lakehouse_catalog, set up as in the generic lakehouse catalog Quick start.

  1. Register the table. format, external, and location are all required. Gravitino stores the columns as given and does not read them from the Delta log, so list them as the table defines them.

    Register an external Delta table
    curl -sS -X POST "https://{gravitino_host}/api/metalakes/{metalake}/catalogs/lakehouse_catalog/schemas/sales/tables" \
    -H "Accept: application/vnd.gravitino.v1+json" \
    -H "Content-Type: application/json" \
    -H "Authorization: Bearer $TOKEN" \
    -d '{
    "name": "orders",
    "comment": "Orders Delta table",
    "columns": [
    {"name": "order_id", "type": "long", "nullable": false},
    {"name": "total_amount", "type": "decimal(10,2)", "nullable": true}
    ],
    "properties": {
    "format": "delta",
    "external": "true",
    "location": "s3://{bucket}/delta/orders"
    }
    }'
  2. Load the table.

    Load a Delta table
    curl -sS "https://{gravitino_host}/api/metalakes/{metalake}/catalogs/lakehouse_catalog/schemas/sales/tables/orders" \
    -H "Accept: application/vnd.gravitino.v1+json" \
    -H "Authorization: Bearer $TOKEN"

Dropping the table removes only the registration; the Delta data stays where it is.

Supported operations​

OperationSupportedNotes
RegisterYesThrough create table, with external set to true.
ListYes
LoadYes
AlterNoChange the table with Delta Lake tools, then drop and register it again if its columns changed.
DropYesRemoves the registration only.
PurgeNoDelete the data with Delta Lake tools or on storage.

Partitions can be recorded with identity transforms only, such as Transforms.identity("year"). Gravitino does not check them, or the columns, against the Delta transaction log, so keep them in line with the table. Sort orders, distributions, and indexes are rejected.

Table properties​

PropertyDescriptionDefaultRequired
formatTable format. Must be delta.(none)Yes
externalMust be true.(none)Yes
locationDirectory of the Delta table, the one holding _delta_log, on S3, HDFS, Azure storage, GCS, or another Hadoop-compatible file system. The schema and catalog locations are not used.(none)Yes

Data type mappings​

Delta Lake uses Apache Spark data types. Gravitino types map to them as follows:

Gravitino TypeDelta/Spark TypeNotes
BooleanBooleanType
ByteByteType
ShortShortType
IntegerIntegerType
LongLongType
FloatFloatType
DoubleDoubleType
Decimal(p, s)DecimalType(p, s)
StringStringType
BinaryBinaryType
DateDateType
TimestampTimestampNTZTypeNo timezone, Spark 3.4+
Timestamp_tzTimestampTypeWith timezone
ListArrayType
MapMapType
StructStructType

Troubleshooting​

ErrorFix
Gravitino only supports creating external Delta tablesSet "external": "true" in the table properties.
Property 'location' is required for external Delta tablesSet location to the Delta table directory.
ALTER TABLE operations are not supportedChange the table with Delta Lake tools, then drop and register it again.
Purge operation is not supportedDrop the table instead, and delete the data with Delta Lake tools or on storage.