Skip to content

external_table

Boris Glavic edited this page Mar 27, 2018 · 1 revision

External Table Support

HRDMBS allows data to be queried that is not stored natively in the system through an external table framework. In principle, any external datasource can be accessed as long as its data can be translated as tables.

The general syntax for creating an external table is:

CREATE EXTERNAL TABLE name (table_elements) USING 'external_table_type' WITH PARAMETERS (parameters)

Here table_elements is a list of column definitions and constraints just like for any regular table. external_table_type is the fully qualified name of the Java class implementing the external table type and parameters is a JSON object storing type specific parameters to be passed to external_table_type. For instance, for an external table that reads data from a CSV file you can specify the field delimiter.

Example

Consider the following example using the HTTPCsvExternal type to read data from CSV file that is accessible over http.

CREATE EXTERNAL TABLE employee (name VARCHAR, age INT) 
USING 'com.exascale.optimizer.externalTable.HTTPCsvExternal' 
WITH PARAMETERS ({"source" : "URL", "location" : "http://www.test.com/test.csv"})

Supported External Table Types

HTTPCsvExternal

HDFSCsvExternal

Implementing Your Own External Table Type

Clone this wiki locally