Usage\ notes

Updated at:

This article describes what you need to know before using SQL statements in the Lindorm compute engine to access various data sources.

Open-source Spark SQL

In open-source Spark SQL, data table naming consists of the following three parts:

  • Catalog: Used to identify different data sources of the user.

  • Namespace: Corresponds to the Database or Schema in a database.

  • Table: Corresponds to a table in a database.

Lindorm Compute Engine SQL

Based on the engine types you have enabled, the Lindorm compute engine adds corresponding Catalogs (used to identify different data sources) by default. You can use the SHOW CATALOGS statement to view the currently available data sources.

The following describes the Catalog information:

Catalog name

Description

Detailed syntax

lindorm_columnar

(alias spark_catalog)

Catalog used to read and write Lindorm columnar storage. This data source is compatible with the open-source SparkSQL spark_catalog.

lindorm_table

Catalog used to read and write the Lindorm wide table engine.

Access data in LindormTable

In the compute engine, you can query different Catalogs in the following two ways.

  • Syntax 1

    Directly specify the data source, target database, and target table for the query.

    SELECT fieldA FROM <data_source>.<target_database>.<target_table>;

    Example 1

    SELECT fieldA FROM lindorm_table.DB1.tableX;
  • Syntax 2

    First specify the data source and target database, and then query the target table.

    USE <data_source>.<target_database>;
    SELECT fieldA FROM <target_table>;

    Example 2

    USE lindorm_table.DB1;
    SELECT fieldA FROM tableX;