Skip to main content
Loading

Specifying Presto Schemas

You can specify the Presto schemas that correspond to the Aerospike sets your client applications will query.

Because it is a SQL engine, Presto requires the schema of the data that you want to query. However, Aerospike is schemaless and provides no native meta-store for storing schemas. There are two ways that the Presto connector provides schemas to Presto for running SQL queries against data in Aerospike:

Inferring schemas

By default, the Presto connector uses heuristics to rapidly infer schemas without the need for you to specify them. Client applications can issue all supported types of SQL statements. However, column ordering is alphabetical only.

Using provided schemas

The Presto connector uses JSON files that you provide.

Procedure

To provide schemas for the Presto connector to use, follow these steps:

Provide the schema for each table

For each table, create a JSON file that provides the name of the schema, which corresponds to the Aerospike namespace, and defines the schema of the table, which corresponds to the Aerospike set. For example, here is a JSON file that defines table1 in schema:

    {
"schemaName": "schema1",
"tableName": "table1",
"columns":[
{
"name": "id",
"type": "varchar",
"hidden": false
},
{
"name": "int",
"type": "bigint",
"hidden": false
},
{
"name": "list",
"type": "json",
"hidden": false
},
{
"name": "map",
"type": "json",
"hidden": false
}
]
}

If you want to include, in one file, multiple schemas for more than one Aerospike set in a single Aerospike namespace, enclose the comma-separated list of the definitions by using square brackets.

Specify the location of the JSON files

If you are setting up a non-Dockerized environment, follow these steps:

  1. Place the JSON files in a single directory.
  2. In the file <Presto_dir>/etc/catalog/aerospike.properties, add the property aerospike.table-desc-dir and set its value to the path of the directory.

If you are setting up a Dockerized environment, place the JSON files in a single directory. When you deploy a Trino cluster, you mount that directory to each container that you create with the docker run command.

caution

Update the corresponding JSON files whenever you change the schema of the data in Aerospike. The Presto connector cannot detect changes to the schema automatically.

What to do next

Return to step 5 in "Deploying Trino Clusters and the Presto Connector in Docker".