CREATE DATABASE myvdb;
USE DATABASE myvdb;
CREATE FOREIGN DATA WRAPPER "hive-delegator" TYPE delegator OPTIONS (delegateName 'hive', supportsOrderBy 'false');
CREATE SERVER source FOREIGN DATA WRAPPER "hive-delegator" OPTIONS ("resource-name" 'java:hive-ds');
CREATE SCHEMA mymodel SERVER source;
SET SCHEMA mymodel;
IMPORT FROM SERVER source INTO mymodel;
Delegator translators
You can use the delegator translator, which is available in the core Teiid installation, to modify the capabilities of a existing translator.
Often times for debugging purposes, or in special situations, you might want to turn certain capabilities of a translator on or off.
For example, say that the latest version of a Hive database supports the ORDER BY
construct, but the current Teiid version of the Hive translator does not.
You could use the delegator translator to enable ORDER BY
compatibility without actually writing any code.
Similarly, you could do the reverse, and turn off certain capabilities to produce a better plan.
To use the delegator translator, you must define it in the DDL.
The following example shows how to override the "hive" translator and turn off the ORDER BY
capability.
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<vdb name="myvdb" version="1">
<model name="mymodel">
<source name="source" translator-name="hive-delegator" connection-jndi-name="java:hive-ds"/>
</model>
<!-- the below it is called translator overriding, where you can set different properties -->
<translator name="hive-delegator" type="delegator" >
<property name="delegateName" value="hive" />
<property name="supportsOrderBy" value="false"/>
</translator>
</vdb>
For more information about the translator capabilities that you can override by using execution properties, see Translator_Capabilities in the Translator Development Guide.
The preceding example shows how you might modify the default ORDER BY
compatibility of the Hive translator.