CREATE EXTERNAL DATA SOURCE
Map a foreign data source (such as Hive table) into Jethro external tables.
Syntax
CREATE EXTERNAL DATA SOURCE new_data_source_name TYPE = HIVE LOCATION = [sub-protocol://]<host>:<port>/<db>[;property=value[;...]] CREDENTIALS=<username/password> [<rejects_handling_spec>] [<rejects_threshold_spec>] <rejects_handling_spec> ::= REJECT_POLICY= { FILL_NULL | SKIP_ROW | FAIL } <rejects_thresholds_spec> ::= { REJECT_LIMIT_COUNT=<an integer value specifying max number of allowed rows with reject> }
Description
<rejects_handling_spec> - Specifies a policy for handling rejects at row/columns level. The allowed polices are:
FILL_NULL (default) - Replace the rejected value with a NULL.
SKIP_ROW - Skip the entire row when any value is rejected.
FAIL - Fail the entire request on the first time it encountered with a rejected value (Choosing this policy will ignore the rejects threshold defined under <rejects_thresholds_spec>).<rejects_handling_spec> sets the defaults behavior for all columns of all tables defined on the data source. Data source defaults can be override per table columns and/or per specific column via the command CREATE EXTERNAL TABLE
<rejects_thresholds_spec> - Specifies a rejects threshold policy for handling of multiple rejects at request level. The total number of rows with rejects are counted, and if that number reaches the defined threshold, the request fails (A row with 2 rejects will be counted as 1). The allowed rejects thresholds are:
REJECT_LIMIT_COUNT (default) - An integer value specifying the maximum number of allowed rows with rejects. If the number of rows with rejects reaches the limit, the request will fail. The default value is: 0.
<rejects_thresholds_spec> set defaults behavior for all tables defined on the data source. Data source defaults can be override per table via the command CREATE EXTERNAL TABLE.
Examples
CREATE EXTERNAL DATA SOURCE exds1 TYPE = HIVE LOCATION = 'jdbc:hive2://10.1.1.199:1000/tpcds;UID=admin;PWD=password' CREDENTIALS= ''/'' REJECT_POLICY = FILL_NULL REJECT_LIMIT_COUNT = 500