Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Release 2.07
February 2019
B035-5991-118K
DOCS.TERADATA.COM
Copyright and Trademarks
Copyright © 2016 - 2019 by Teradata. All Rights Reserved.
All copyrights and trademarks used in Teradata documentation are the property of their respective owners. For more information, see
Trademark Information.
Product Safety
Indicates a situation which, if not avoided, could result in damage to property, such as to equipment
NOTICE or data, but not related to personal injury.
Indicates a hazardous situation which, if not avoided, could result in minor or moderate personal
CAUTION injury.
Indicates a hazardous situation which, if not avoided, could result in death or serious personal injury.
WARNING
Warranty Disclaimer
Except as may be provided in a separate written agreement with Teradata or required by applicable law, the information available
from the Teradata Documentation website or contained in Teradata information products is provided on an "as-is" basis, without
warranty of any kind, either express or implied, including the implied warranties of merchantability, fitness for a particular purpose,
or noninfringement.
The information available from the Teradata Documentation website or contained in Teradata information products may contain references
or cross-references to features, functions, products, or services that are not announced or available in your country. Such references do not
imply that Teradata Corporation intends to announce such features, functions, products, or services in your country. Please consult your local
Teradata Corporation representative for those features, functions, products, or services available in your country.
The information available from the Teradata Documentation website or contained in Teradata information products may be changed or
updated by Teradata at any time without notice. Teradata may also make changes in the products or services described in this information
at any time without notice.
Feedback
To maintain the quality of our products and services, e-mail your comments on the accuracy, clarity, organization, and value of this document
to: teradata-books@lists.teradata.com
Any comments or materials (collectively referred to as "Feedback") sent to Teradata Corporation will be deemed nonconfidential. Without
any payment or other obligation of any kind and without any restriction of any kind, Teradata and its affiliates are hereby free to (1) reproduce,
distribute, provide access to, publish, transmit, publicly display, publicly perform, and create derivative works of, the Feedback, (2) use any
ideas, concepts, know-how, and techniques contained in such Feedback for any purpose whatsoever, including developing, manufacturing,
and marketing products and services incorporating the Feedback, and (3) authorize others to do any or all of the above.
Contents
Chapter 9: Using the Spark SQL Connector with Teradata QueryGrid . . . . . . . . . . . . . . . . . . . 171
Completing the Spark SQL Connector Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 171
Using the Spark SQL Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 180
Chapter 10: Using the Oracle Connector with Teradata QueryGrid . . . . . . . . . . . . . . . . . . . . . . 194
Completing the Oracle Connector Configuration . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 194
Using the Oracle Connector . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 204
Chapter 12: Teradata QueryGrid Monitoring, Logging, and Error Handling . . . . . . . . . . . . . . . 218
Fabric Overview . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 218
Issues . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 220
Monitoring User Queries Between Local and Remote Servers . . . . . . . . . . . . . . . . . . . . . . . . . 221
Logging and Error Handling . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 222
Note:
As of Teradata QueryGrid 2.07, only links that involve the Teradata Connector are supported. For
example, links where neither the initiator or target connector are a Teradata connector, such as Hive
to Oracle, are not supported.
Component Description
Teradata Software installed on a dedicated physical machine (TMS or server) or VM that enables
QueryGrid definition, administration, and monitoring of Teradata QueryGrid.
Manager After installing Teradata QueryGrid Manager, configure it in Viewpoint, and then use
the QueryGrid portlet to install and configure the remaining Teradata QueryGrid
components.
Data Center Logical name that represents the physical location of systems (data sources) in
Teradata QueryGrid.
System (Data One or more data source nodes that share the same software platform, such as
Source) Teradata Database nodes, nodes in a Hadoop cluster (CDH or HDP), or nodes in a
Presto cluster.
Component Description
System (Bridge) A subset of data source nodes or non-data source nodes used to perform CPU-
intensive operations such as compression and encryption, and to transfer data.
Fabric One or more data source nodes, in different systems, that run a compatible version of
Teradata QueryGrid software over the same port.
Connector Adapter software for a data source that enables data type mapping, conversion, and
communication with other connectors in the same Teradata QueryGrid fabric.
Link Named configuration that specifies which connectors can communicate with each other
and defines rules of data transfer.
Data Center
A Data Center performs the following functions in Teradata QueryGrid:
• Allows Teradata QueryGrid Manager to determine whether communication between two data sources
(systems) is across a LAN or WAN
• Makes sure communication with Teradata QueryGrid Manager remains LAN-local if a Teradata
QueryGrid Manager is available locally
When you install Teradata QueryGrid Manager software on a physical machine, a default Data Center is
created using the hostname of the TMS, VM, or server. The default Data Center name is displayed in the
QueryGrid portlet.
The default Data Center cannot be deleted. It can be renamed, or you can do one of the following:
• Create a new Data Center in the QueryGrid portlet
• Create a new Data Center during clustering if you have two or more Teradata QueryGrid Manager
instances.
System (Bridge)
Bridge systems represent a subset of data source nodes or a separate set of non-data source nodes that
allow:
• All network traffic to flow through the nodes in the bridge system instead of through all the nodes in
data source systems
• Offloading CPU-intensive operations such as data encryption or compression to the nodes in the bridge
system instead of using all the nodes in data source systems
• Using nodes connected to a public network for data transfer
One or two bridge systems can be included in the data transfer path between data source nodes in initiator
and target systems. The nodes in a bridge system can be:
• A subset of data source nodes running QueryGrid node software. The data source nodes can be in
the initiator system, or target system, or both.
• A set of non-data source nodes running QueryGrid node software. The non-data source nodes do not
need connector software because they do not have local data to process. An example of a non-data
source node is an edge node in a Hadoop system.
A link is used to define the data transfer path. One or two bridges can be included in the data transfer path.
A link can contain one or more hops. The number of hops is based on the number of bridges.
Fabric
A fabric performs the following functions in Teradata QueryGrid:
• Enables communication between paired data source nodes of the same type, such as Teradata
Database and Teradata Database, or a different type, such as Teradata Database and Presto
• Allows a user to initiate a single SQL query that joins data from two or more systems (data sources)
within the fabric
There is no restriction on the size of the data that is transported between data source nodes in a fabric.
Fabric software is installed on data source nodes and does the following:
• Allows the Teradata QueryGrid connectors to:
◦ Communicate with each other in parallel
◦ Run, process, and transport data efficiently
• Monitors fabric usage per query and reports metrics to the Teradata QueryGrid Manager
Connectors and links are associated with a fabric.
Connectors
A connector performs the following functions in Teradata QueryGrid:
• Provides for query processing across data sources (systems)
• Translates query request SQL from one source query format to another
• Transforms data, converting the data from one data type or format to another so that the data can be
exchanged between different systems (data sources).
• Enables data sources to participate in queries. Any connector that joins the fabric can participate in
the queries.
• Enables data sources to initiate queries.
• Enables sending and receiving data to and from the fabric
• Communicates with other connectors in the fabric
• Controls the running of queries on target systems. All connectors can act as a target of queries and
control the queries that are run on a target system (data source) on behalf of the initiator system (data
source)
• Return query results to initiating systems
Connectors are specific to the system type (Teradata Database, Hive, or Presto-configured Hadoop), and
there can be only one connector for each system type. A Teradata Database system hosts a Teradata
connector, but a single Hadoop system can host multiple connectors (Hive and Presto).
Optional connector properties allow you to refine a connector type configuration, or override connector
properties set during configuration.
Connector software connects data sources with the Teradata QueryGrid fabric. The software is installed on
all data source nodes in a system. Fabric software is also installed on all data source nodes in a system.
Fabric software includes a driver. A driver runs on one or more data source nodes called driver nodes. As
part of query processing, a driver node receives requests from the initiator connector and submits the
requests to the target system. The driver loads the connector, reads messages, invokes methods to process
requests, and sends responses.
When you configure a connector, you must specify which nodes in a system (data source) are driver nodes.
Only a subset of the nodes on a large system need to be driver nodes. Use multiple driver nodes for
redundancy and to share the workload required for query initiation.
After a target driver node submits a query, connection caching forms a connection pool that does the
following:
• Reuses physical connections
• Reduces overhead for QueryGrid queries
• Minimizes creating and closing sessions
The connection pool uses the same JDBC connection for all phases of a single query or for subsequent
queries with the same session and user credentials. For more information on configuring tunable connector
pool properties, see the connector and link properties information in the relevant connector topics.
Links
A connector can be both an initiator or a target of a query. A link is a named configuration that defines the
initiator connector and target connector pair.
• Initiating connector: Point from which a QueryGrid query originates. For example, in a Teradata-to-
Presto query, the Teradata connector initiates the query.
• Target connector: Destination point of a QueryGrid query. For example, in a Teradata-to-Presto query,
a Presto connector is the target connector that the initiating connector accesses to either import or
export data.
You can create initiating connector and target connector link pairings only for connector types you have
defined.
• If you have defined only Teradata Database connectors, you can create links only between Teradata
Database systems.
• If you have defined both Teradata and Presto connectors, you can create links between Teradata
Database systems and Presto systems.
• If you have defined Teradata, Presto and Hive connectors, you can create links for all combinations of
these connector types.
Links simplify configuration of foreign server definitions in preparation for running QueryGrid queries.
In a Teradata QueryGrid fabric, each link:
• Specifies an initiating connector and a target connector link pairing to use for querying
When using the Hive, Presto, or Spark target connector without security, user mapping is typically
required. For example, if a query is initiated using a Teradata-to-Hadoop link by user Joe, Teradata
automatically changes the username to all uppercase and sends the query as user JOE by default to
the target system. The following are possible outcomes for this use-case when no security is used with
a Hive target connector:
◦ The user Joe does not exist on the target system. In this scenario, the query must be run with an
existing user on the target system such as hive. In this scenario, user mapping is required where
JOE on the Teradata system is mapped to the user hive on the target Hive system.
◦ The user Joe does exist on the target system, but as joe (all lowercase). In this scenario, user
mapping is required where JOE on the Teradata system is mapped to joe on the target Hive
system.
◦ The user Joe does exist on the target as JOE (all uppercase). This scenario does not require user
mapping.
When a security platform such as Kerberos is used, user mapping is not required when using a Hive,
Presto, or Spark target connector.
Item Description
Active The configuration actively processing production workloads in the production environment. The
configuration has been tested and verified.
If you replace an active version, the formerly active version becomes the previous version and
the former previous version is deleted.
Pending A new or modified configuration that has been pushed to the production environment for testing
(without affecting production workloads).
If you activate a pending version, the formerly active version that you replaced becomes the
previous version.
Item Description
If you activate a previous version, the active version becomes the previous version, and any
pending version remains the pending version.
For more information, see Working with Active, Pending, or Previous Versions.
Note:
The root CA must be registered in Viewpoint during Teradata QueryGrid installation.
The root CA signs SSL certificates for each QueryGrid Manager instance.
SSL Certificates
Each QueryGrid Manager instance generates an SSL certificate for secured communication between itself
and all other clients. Clients include:
• Additional QueryGrid Manager instances in the same cluster
• Data source nodes in a system
• Viewpoint
When a data source node is added to a system (data source) in QueryGrid, a QueryGrid Manager instance
gives the node an SSL certificate during node software installation. The SSL certificate, which is signed by
the root CA, allows the data source node to verify that it is communicating with a trusted QueryGrid Manager
instance.
All communication between the Teradata QueryGrid Manager instances and data source nodes within the
fabric use HTTPS over port 9444.
UUID Acts as the node username when the node authenticates itself to a QueryGrid
Manager instance.
Time-limited access Authenticates the node before the node can be added to a system (data source)
token for the first time.
Generated password for Allows the node to authenticate itself to a QueryGrid Manager instance after the
authentication node joins a system (data source) for the first time.
IP-based authentication, checksum Provides more security than the previous level, but is still
integrity check, no encryption recommended for use only in a trusted environment.
Key-based authentication, secure Provides more security than the previous level and is
integrity check, encryption credentials recommended in non-trusted environments.
Key-based authentication, secure Provides the highest level of security and is recommended in non-
integrity check, encrypt all data trusted environments. The following encryption and integrity
OS Users
Security also depends on the OS user the connector software runs as. You can specify the OS user for
each connector. The user is typically the same user under which the data source runs.
Hive user executing the query (which may be hive), yarn user, and Kerberos principal or
other authorized user
Spark SQL user executing the query (which may be hive), yarn user, and Kerberos principal or
other authorized user
Note:
For information about migrating Teradata Database 1.0x foreign server definitions for use with 2.0x
Teradata connectors, see Migrating 1.0x Teradata Foreign Server Definitions to 2.0x Teradata
Connectors.
Prerequisites
The following minimum requirements must exist before installing Teradata QueryGrid and one or more of
the following licensed connectors:
• Teradata connector for Teradata Database
• Hive connector for CDH and HDP
• Presto connector for Presto, CDH, or HDP
• Spark SQL connector for CDH and HDP
• Oracle connector for Oracle Database
Note:
For more information, log in to https://access.teradata.com and search for KCS001621.
Requirements
Component Requirements
System (Data For supported database and operating system versions, refer to the compatibility matrix.
Source) For more information, log in to https://access.teradata.com and search for KCS001621.
Note:
For the Hive connector, Hive Client must be installed on all driver nodes in the system.
Note:
For QueryGrid versions 2.06 and later, /var/opt/teradata/tdqg/tmp must be
mounted with exec privileges.
Note:
For the Oracle target connector requirements, see Completing the Oracle Connector
Configuration.
Teradata Viewpoint 16.10, 16.20 and later. The QueryGrid portlet package must be installed on
Viewpoint the Viewpoint server.
The Viewpoint 16.10 edition must support multiple-system monitoring. QueryGrid 2.0x
cannot be configured on Viewpoint editions that support only single-system monitoring.
Kerberos For environments secured with Kerberos, the most current version of Kerberos available.
Java The latest version of Java 8 on the driver node or nodes in an initiating system (data
source). A driver node invokes the connector method (for example, Teradata Database)
used for a query on a target system (data source).
To locate Java, the following environment variables are checked (in order): TDWDOG_
JAVA_HOME, OPENJDK_JDK8_64_HOME, OPENJDK_JRE8_64_HOME, JDK8_64_
HOME, JRE8_64_HOME.
Component Requirements
If all of the variables are empty, then the which java command is used to find the Java
path. If Java is not part of the path, you can specify it by using the system property
driverJavaPath and the system-properties.sh script in the QueryGrid Manager bin
directory /opt/teradata/tdqgm/bin. You must run the script as root or as the tdqgm
user. This path includes the Java executable. For example, if Java is located in /usr/
currentJava/bin/ then the path is driverJavaPath=/usr/currentJava/bin/java.
TMS, Server, One or more (separate server for each QueryGrid Manager instance).
or VM for
Important:
QueryGrid
Manager Do not install QueryGrid Manager on existing TMS servers hosting Viewpoint, Data
Mover, Ecosystem Manager, and so forth, unless those products are uninstalled and the
server is re-purposed to be a QueryGrid Manager server.
• Hardware requirements (minimum):
◦ 2 CPUs
◦ 16 GB RAM
◦ 250 GB hard disk space available at /var/opt/teradata/tdqgm
• Operating system:
◦ SLES 11 or 12
◦ Red Hat 6 or 7
• The latest version of Java 8 on any TMS, server, or VM on which Teradata QueryGrid
Manager is being installed.
See QueryGrid Manager planning section below.
Network Network connectivity between the Teradata nodes and Hadoop master node, and all
Hadoop data nodes, through customer LAN, BYNET, or InfiniBand.
Minimum number of QueryGrid One instance for approximately every 200 Teradata QueryGrid-
Manager instances connected nodes
• This approximation is based on moderate query volume on minimum
supported hardware requirements.
• Actual required number varies depending on server specs and query
volume.
• New QueryGrid managers can be added if load is high on existing
instances to reduce overall load.
Number of QueryGrid Manager At least one per Data Center, more if the number of nodes in the Data
instances to keep Center exceed the resource requirements of the single QueryGrid
communication, heartbeats, Manager instance
query metrics, and log data local
to a Data Center
Port Availability
Make sure that network ports are open between QueryGrid-attached systems (data sources) and
QueryGrid Manager. Systems include the Teradata Database nodes, Hadoop master node, all Hadoop
data nodes, and Presto nodes.
The following illustration shows the port numbers used between QueryGrid-attached systems and
QueryGrid Manager in a fabric.
Port Description
Port Description
1025 One-way connection from the target Teradata connector (driver) to the target Teradata
Database systems (JDBC connection).
5000-5001 Two-way connections between all QueryGrid-attached nodes; other available ports can be
used, but ports 5000-5001 are recommended.
8080 One-way connection from the target Presto connector (driver) to the target Presto coordinator.
8443 One-way connection from the target Hive connector (driver) to the Apache Knox Gateway if
Apache Knox Gateway is enabled on Hadoop nodes.
9443 • One-way HTTPS connection from Viewpoint or a browser to Teradata QueryGrid Manager.
• One-way connection from Teradata QueryGrid Manager to another Teradata QueryGrid
Manager; used during cluster creation when using the join token method.
9445 Two-way HTTPS connection between clustered Teradata QueryGrid Managers in a fabric.
10000 One-way connection between the target Hive connector (driver) to target Hiveserver 2.
10016 One-way connection from the target Spark SQL connector (driver) to the target Spark Thrift
Server.
Install the QueryGrid Manager instances, one instance QueryGrid Manager TMS or server login (either
per TMS, server, or VM root or user with sudo privileges)
In Viewpoint, configure QueryGrid Manager From the customer, obtain Viewpoint logon
credentials of a user in the Administrator role.
Upload QueryGrid –-
node, fabric, and
connector software
Add a Data Center to Use a logical name for the Data Center where systems (data sources) are located.
QueryGrid
Add data source You must have root or sudo privileges for all data source nodes in the system.
nodes to the system You must manually enter the IP addresses or hostnames of the following nodes:
• Teradata Database system
• Presto system
For a Hadoop system, you can do one of the following:
• Manually enter the IP addresses or hostnames of the nodes
• Automatically auto-populate the node list if the system is monitored by
Viewpoint
Note:
Before adding data source nodes to the system, Hive Client must be installed
on all the driver nodes in the Hadoop cluster.
Add a bridge system You must have root or sudo privileges for all nodes to be added to the system.
[optional] You can use existing data source nodes in a bridge system, or non-data source
nodes. If using non-data source nodes, you will need the IP addresses or
hostnames of the nodes.
Software Packages
Component Package
Manager tdqg-manager-version.rpm
Note:
Download the Manager package to the server on which you are operating the
Teradata QueryGrid Manager.
Download the remaining packages to a location with browser access to
Viewpoint, which is where you perform the distribution and installation of these
packages using the QueryGrid Portlet.
Component Package
Node tdqg-node-version.tar.gz
Fabric tdqg-fabric-version.tar.gz
Note:
When you install Teradata QueryGrid Manager software on more than one machine, you can cluster
the Teradata QueryGrid Manager instances.
1. Install the latest version of Java 8 on each dedicated physical or virtual machines.
Note:
If the correct version of Java is not automatically detected, you can set the path to the Java home
directory in /etc/opt/teradata/tdqgm/setenv.sh.
For example:
export TDQGM_JAVA_HOME=/usr/java/jdk1.8.0_101
For more information, log in to https://access.teradata.com and search for KAP314E23E.
2. Download the latest Teradata QueryGrid Manager package (file name tdqg-manager-version.rpm).
3. Log on to the TMS, VM, or server.
4. From a console window, install Teradata QueryGrid Manager by typing the following:
rpm -ivh tdqg-manager-version.rpm
Installation takes approximately one minute.
5. Verify the installation.
a. Open a browser.
b. Access the Teradata QueryGrid Manager instance by typing the following:
https://<hostname>:9443
6. If you are unable to access Teradata QueryGrid Manager, do the following:
a. Review the following logs.
/var/opt/teradata/tdqgm/logs/tdqgm-boot.log
/var/opt/teradata/tdqgm/logs/tdqgm-main.log
/var/opt/teradata/tdqgm/logs/init.log
b. Fix all identified problems.
c. From the console window, restart the Teradata QueryGrid Manager by typing the following:
service tdqgm restart
7. If this is the first Teradata QueryGrid Manager instance installed, confirm that the default value for the
publicAddress is appropriate for your environment.
a. Open the /etc/opt/teradata/tdqgm/server.properties file.
b. If the default value is not appropriate, see Modifying the publicAddress, bindAddress, and
clusterAddress for a QueryGrid Manager Instance.
Note:
You can also edit the bindAddress and clusterAddress.
8. If the publicAddress is a hostname (not an IP Address) and cannot be resolved from the data source
nodes using DNS, add the QueryGrid Manager server or servers to the /etc/hosts file of each node
in the data source system.
knyQebO0W+PI1LGVrEZAUzSMi58aRZ5oFDuMhB9uaZqD/
5IochpacvY1Pl9A3xkEHWrtb7hjSqSjARI0CfQdUQ==
3. Copy the token output and use it as input to the join-cluster command that is run from the QueryGrid
Manager instance being added to the cluster.
The generated token is only good for 24 hours.
Join Method
-----------
1. SSH - Provide SSH credentials to access cluster seed files
2. Token - Provide token to access cluster seed files using QGM web service
Option Description
SSH Specify the login credentials for a user granted read permission to /etc/opt/teradata/
tdqgm on that instance.
Token Enter the token generated by the create-join-cluster-token script on one of the other
QueryGrid Manager instances.
Note:
By default, data source nodes communicate with QueryGrid Managers in the same datacenter.
◦ The bindAddress is a locally bound IP address to which Teradata QueryGrid Manager internal
services bind.
Note:
You must have write permission to the files in /etc/opt/teradata/tdqgm.
3. Edit the publicAddress, bindAddress, and clusterAddress properties and save the file.
4. At the command line, restart Teradata QueryGrid Manager by typing the following.
service tdqgm restart
Note:
If there are problems, review the /opt/teradata/tdqgm/logs/tdqgm-boot.log log file, fix
all identified problems, and restart Teradata QueryGrid Manager.
Note:
You must have write permission to the files in /etc/opt/teradata/tdqgm.
aliases=qgm1.teradata.com,qgm2.teradata.com
4. Save the file.
5. At the command line, restart Teradata QueryGrid Manager by typing the following:
service tdqgm restart
Adding QueryGrid
Viewpoint provides a user interface to configure and monitor QueryGrid. When adding QueryGrid to
Viewpoint, only one QueryGrid Manager from a QueryGrid Manager cluster needs to be specified.
Viewpoint automatically discovers and performs failover to the other QueryGrid Managers in the cluster,
if the host manager goes offline. Teradata recommends to enter the QueryGrid Manager host that is
geographically the closest to the active Viewpoint server.
1. From the Teradata Viewpoint portal page, click .
2. Open the Monitored Systems portlet.
3. Click next to Systems and select Add QueryGrid.
4. Under General System Details, enter a system nickname, up to 8 characters.
5. [Optional] Select the Enable system check box.
After it is enabled, the system starts collecting data.
6. Enter the host ID of the Teradata QueryGrid Manager closest to the Viewpoint server.
The host ID is the IP address of Teradata QueryGrid.
7. Under Login, do the following:
a. In Name, type viewpoint.
b. In Password, type teradata.
8. [Optional] Click Test to verify that the login settings are correct.
If the operation is successful, appears. If the operation fails, appears. If you receive an error,
verify that the login credentials are valid and the host can be reached.
9. [Optional] Under Collectors, select the check box to activate QueryGrid data collectors so they can
collect data.
The data collectors can be enabled and configured individually in Data Collectors.
10. Click Apply.
If the operation is successful, appears. If the operation fails, appears. If you receive an error,
verify that the settings are correct and try again.
Adding a Role
You can add a role and configure the settings for users assigned to the role.
1. From the Teradata Viewpoint portal page, click .
2. Open the Roles Manager portlet.
3. From the Roles Manager view, click Add Role.
4. Enter a name for the role, up to 25 characters.
You can use spaces, alphanumeric characters, and underscores (_).
5. [Optional] Select Enable role to activate the role for use in Teradata Viewpoint.
6. Enter a description, up to 255 characters.
7. Click Apply.
8. Specify additional role settings on each of the tabs.
Tabs Description
Systems Enable or disable the systems available to the role and select the metrics to display for
each system
Portlets Enable or disable portlets for a role, select permissions, and configure default settings
for each portlet.
Control whether users in this role can modify their own settings and share customized
versions of the portlet with other users, and configure which portlet features the role
can access.
Note:
Portlets must also be enabled in Portlet Library.
Web Enable or disable access to each web service for this role and select permissions.
Services
9. Click Apply.
Note:
Teradata strongly recommends changing the default passwords for these accounts.
6. Click Apply.
5. Click Save.
Note:
Do not select Bridge only system.
Option Description
Estimate Use the Estimate tool to help you estimate the amount of memory you need.
a. Click Estimate.
b. In Max query concurrency, enter the maximum number of QueryGrid queries
expected to run concurrently for all connectors on the system.
c. In Max link buffer size, do the following:
• Enter the size of the buffers for the communication channels.
• Select the unit of measurement.
Valid values range from 1 to 999. The default is 1 MB.
d. In Max link buffer count, enter the maximum number of buffers that any link or
connector is configured to use per communication channel.
Valid values range from 1 to 999. The default value is 4.
e. In Max workers per node, enter the number of threads that participate in a query on
a given node.
For example, enter the number of AMPs per node on the Teradata Database system.
For more information, refer to KCS008587.
f. Click Set Value.
Option Description
The value that appears in the Max memory per node box is calculated from the values
you entered in the tool.
8. Click Save.
Note:
Data source nodes include TPA, PE, and HSN nodes.
• Presto
When you add Hadoop data source nodes to a system in QueryGrid for the Hive Client connector or Spark
SQL connector, you can do one of the following:
• Manually enter the IP addresses or host names of the nodes in QueryGrid
• Automatically auto-populate the node list if the system is monitored by Viewpoint
Note:
Hive Client is required for running diagnostics and QueryGrid queries. Before adding data source
nodes to the system, install Hive Client on all driver nodes in the Hadoop cluster.
If the QueryGrid Manager publicAddress is not an IP address, or if its host name cannot be resolved
through DNS, before adding data source nodes, verify that the host name or IP address of the QueryGrid
Manager server or servers (if using clustering) have been added to the host files of the nodes in the data
source system.
Option Description
6. In the Install concurrency box, type an integer to set the number of nodes that can install
simultaneously.
Valid values range from 1 to 100. The default value is 10.
7. In the SSH user box, type the name of the SSH user.
The SSH user should have sudo privilege to install the rpm file.
8. Under Authentication Mechanism, select the authentication mechanism you normally use to log
onto the nodes when using SSH and enter the corresponding value:
• Password
• SSH Key
9. Click Save.
10. [Optional] You can click Abort in Node Installation Status.
Note:
You can use virtual IP addresses on data source nodes, bridge nodes, or both. However, to reduce
the number of virtual IP addresses that need to be configured, Teradata recommends using virtual
IP addresses only on bridge nodes.
Option Description
Estimate Use the Estimate tool to help you estimate the amount of memory you need.
a. Click Estimate.
b. In Max query concurrency, enter the maximum number of QueryGrid queries
expected to run concurrently for all connectors on the system.
c. In Max link buffer size, do the following:
• Enter the size of the buffers for the communication channels.
• Select the unit of measurement.
Valid values range from 1 to 999. The default is 1 MB.
d. In Max link buffer count, enter the maximum number of buffers that any link or
connector is configured to use per communication channel.
Valid values range from 1 to 999. The default value is 4.
e. In Max workers per node, enter the number of threads that participate in a query on
a given node.
For example, enter the number of AMPs per node on the Teradata Database system.
For more information, refer to KCS008587.
f. Click Set Value.
The value that appears in the Max memory per node box is calculated from the values
you entered in the tool.
9. Click Save.
The dedicated bridge system is listed under Fabric Components, in Bridges, but you must add non-
data-source nodes to it.
Option Description
6. In the Install concurrency box, type an integer to set the number of nodes that can install
simultaneously.
Valid values range from 1 to 100. The default value is 10.
7. In the SSH user box, type the name of the SSH user.
The SSH user should have sudo privilege to install the rpm file.
8. Under Authentication Mechanism, select the authentication mechanism you normally use to log
onto the nodes when using SSH and enter the corresponding value:
• Password
• SSH Key
9. Click Save.
10. [Optional] You can click Abort in Node Installation Status.
7. Click .
8. Save the file to a location.
9. Click Close.
10. For each node in the system, do the following:
a. Install the tdqg-node-release.rpm software package.
b. Copy the generated configuration file to /etc/opt/teradata/tdqg/node/tdqg-node.json.
Note:
You can use virtual IP addresses on data source nodes, bridge nodes, or both. However, to reduce
the number of virtual IP addresses that need to be configured, Teradata recommends using virtual
IP addresses only on bridge nodes.
Option Description
Note:
In this scenario, Hop 1 uses a bynet network interface as the initiating and target network; Hop 2
uses the customer LAN network.
1. Add a new QueryGrid Manager server in the Teradata network (such as bynet) that is accessible by
all TPA and HSN nodes.
2. Cluster the new server with the target QueryGrid Manager using a customer LAN network.
3. To route PE requests from the Teradata FICON node to a target system, do the following:
a. Set up a QueryGrid link as a single bridge.
b. Make sure the bridge includes all the TPA nodes that have connectivity to all target nodes.
Adding a Fabric
1. Under Fabric Configuration, select Fabrics.
2. Click next to Fabrics.
3. Type a name, up to 256 characters.
4. Type a description, up to 1,000 characters.
5. Type the port number in the Port box.
Valid values range from 1024 to 65535. Select a value that is not currently in use by the systems you
plan to add to the fabric.
Option Description
Select an existing version a. From the Fabric software list, select a version.
b. Click Save.
Adding a Connector
1. Under Fabric Configuration, select Fabrics and click a fabric to which you want to add a connector.
2. Click the Connectors tab.
3. Click the next to Connectors.
4. Type a name, up to 256 characters.
5. Type a description, up to 1,000 characters.
6. In the System list, select a system you want to add this connector to.
7. Next to Allowed OS users, click to add the allowed OS user that this software runs as.
This user is typically the same user under which the database runs:
• For a Teradata Database connector it is the teradata user.
• For a Presto connector it is the presto user.
• For a Hive connector, you must add the user executing the query (which may be hive), yarn user,
and Kerberos principal or other authorized user.
• For a Spark SQL connector, you must add the user executing the query (which may be hive), yarn
user, and Kerberos principal or other authorized user.
8. Do one of the following:
Option Description
Select an existing a. From the Software Name list, select an existing software version.
connector software The list contains the Teradata, Presto, or Hive connector software
version packages you uploaded earlier.
Option Description
Customize a. Select the check box to customize the values for a connector property.
When the check box is cleared, it designates that QueryGrid should use the default
values for a property.
Note:
You can further customize initiator and target connector properties at the link level in
the Links tab.
Overridable a. [Optional] Select the check box to designate that the normal configured values for
the connector property can be overridden when a user executes queries during
individual processing sessions.
Note:
Once you designate a property as overridable at the connector level, it stays in effect
even if you do not designate it as overridable at the link level in the Links tab.
In order to disable the setting for an initiator or target connector, you must clear the
check box at both the link level and connector level.
For these reasons, it might be preferable to designate a property as overridable only at
link level in the Links tab, depending on the requirements specific to the link.
Option Description
15. [Optional] From the Associated Viewpoint system list, select a Viewpoint system to associate with
this connector.
This association is used to link Viewpoint monitored systems to QueryGrid queries in portlets, such
as Query Monitor.
16. Click Save.
Adding a Network
1. Under Fabric Components, select Networks.
2. Click next to Networks.
3. Type a name, up to 256 characters.
4. Type a description, up to 1,000 characters.
5. In the Matching rules list, select one of the following:
Option Description
CIDR notation a. Type the Classless Inter-Domain Routing (CIDR) designation for the physical
network interface.
You can enter up to 500 characters.
Option Description
IP-based authentication, checksum a. Select the extent of the integrity checks to be run.
integrity check, no encryption
Option Description
Key-based authentication, secure a. Select the extent of the integrity checks to be run.
integrity check, encrypt credentials b. Select the size of the authentication key.
By default, QueryGrid uses a 2048-bit authentication key.
c. Select the size of the encryption key.
By default, QueryGrid uses a 2048-bit encryption key.
d. Select the encryption/integrity algorithm.
By default, QueryGrid uses AES-GCM.
Key-based authentication, secure a. Select the extent of the integrity checks to be run.
integrity check, encrypt all data b. Select the size of the authentication key.
By default, QueryGrid uses a 2048-bit authentication key.
c. Select the size of the encryption key.
By default, QueryGrid uses a 2048-bit encryption key.
d. Select the encryption/integrity algorithm.
By default, QueryGrid uses AES-GCM.
8. Click Save.
Adding a Link
1. Under Fabric Configuration, select Fabrics and click a fabric to which you want to add a link.
2. Click the Links tab.
3. Click next to Links.
4. Type a name, up to 256 characters.
5. Type a description, up to 1,000 characters.
6. From Bridge configuration, select one of the following:
Option Description
No bridges A bridge is not used for this link. The hop is between the initiator and target.
Single A single bridge is used for this link. A query is sent from the initiator to the bridge (Hop
bridge 1), and from the bridge to the target (Hop 2). A query is returned in the reverse order.
Dual bridge A dual bridge is used for this link. A query is sent from the initiator to bridge 1 (Hop 1),
from bridge 1 to bridge 2 (Hop 2), and from bridge 2 to the target (Hop 3). The query is
returned in the reverse order.
Option Description
Customize a. Select the check box to customize the values for an initiating connector property.
When the check box is cleared, it designates that QueryGrid should use the default
values for a property
Overridable a. [Optional] Select the check box to designate that the normal configured values for
the initiator connector property can be overridden when a user executes queries
during individual processing sessions.
Once you select the check box, it cannot be cleared.
Option Description
Note:
Once you designate a property as overridable at the connector level (on the
Connectors tab), it stays in effect even if you do not designate it as overridable at
the link level.
In order to disable the setting for an initiator or target connector, you must clear the
check box at both the link level and connector level.
For these reasons, it might be preferable to designate a property as overridable only
at link level, depending on the requirements specific to the link.
Option Description
Add a new a. Click next to Initiating network to add the network you want this link to send
initiating queries over.
network and b. Type a name, up to 256 characters.
select it
c. Type a description, up to 1,000 characters.
d. In the Matching rules list, select one of the following:
• CIDR notation
• Interface name
e. [Optional] Click next to Matching rules to add more rules.
f. [Optional] You can click to remove an existing rule.
g. Click Save.
h. Select the network from the list you just added.
14. For each hop, add a Target network. Do similar steps performed to add an initiating network.
15. For each hop, do one of the following to add a Communication policy:
Option Description
Note:
The minimum required properties for running a link bandwidth test are the port number and hostname
of the target connector.
• Active
• Pending
4. Depending on the direction of the link data flow you want to test, click one of the following:
• Initiating to target
• Target to initiating
5. Set the bandwidth to use to transfer data between nodes.
The default is 100 MB.
6. Click Run.
The test results display in the Link Bandwidth Test window.
For more information, see Link Bandwidth Test Metrics.
Note:
Properties may be available for initiating connectors only, target connectors only, or both.
Overridable? Connector
Name Default Description
Property Name Type
Byte Count 640K Frequency with which byte count is updated in ● Initiator,
Report DBQL. You can adjust this to a larger value if byteCountReportFrequency Target
Frequency the update frequency is too resource intensive.
Connection 30 minutes Frequency of eviction checks. Connection Target
Evict objects from the pool are checked, closed, and
Frequency removed if the idle time (current time - last time
of use) of a connection object is greater than the
Connection Max Idle Time setting.
Overridable? Connector
Name Default Description
Property Name Type
Connection 86400 seconds The maximum idle time for the connection cache Target
Max Idle Time object, after which the object is closed and
removed from the cache. Use this property when
there are multiple concurrent users and queries
running on the system that might lead to
starvation of connection objects.
Valid values are 1–86400 seconds.
Custom Push None Teradata, Presto, or Hive custom push profile ● Initiator
Profile used with the Remote Table Optimization customPushProfile
(RTO) feature
This custom push profile overrides a default
push profile.
Default Push None Teradata, Presto, or Hive default push profile Initiator
Profile used with the Remote Table Optimization
(RTO) feature
This push profile is used if there is no custom
push profile.
Disable False When set to true, disables the pushdown of all ● Initiator
Pushdown query conditions to the target system. disablePushdown
Certain system-level, session-level, and
column-level query attributes, such as
CASESPECIFIC, can affect character string
comparison results. These attributes can cause
some queries to return incorrect results due to
incorrect row filtering on the target system.
To avoid incorrect results caused by condition
pushdown in situations where the settings on the
initiating system do not match the settings on the
target system, you can disable the pushdown of
all conditions to the target system.
If set to Overridable, this property can only be
overridden at the session level from false to true
(indicating you are disabling pushdown), but
cannot be changed from true to false.
Overridable? Connector
Name Default Description
Property Name Type
Link Buffer Size 1048576 Maximum size of the write buffers to allocate for ● Initiator
row handling and message exchange. linkBufferSize
Valid values are 73728– 10485760 bytes.
Response 86400000 Number of milliseconds to wait for the final data ● Initiator,
Timeout exec response when all the data has been responseTimeout Target
transferred.
Valid values are 1800000–172800000.
Role Support False Enable user role support for the target system. ● Target
When set to true, the user role from the initiator roleSupport
or target based on role mapping is applied to
Overridable? Connector
Name Default Description
Property Name Type
Before continuing with the configuration of the Teradata Initiator connector, you must confirm the
QueryGrid initiator and target functions.
1. Check for the existence of the qginitiator and qgremote functions by running the following query on
both the initiator and target (if applicable) systems.
help user td_sysfnlib;
Help information returned. 531 rows.
Total elapsed time was 1 second.
Table/View/Macro name Kind Comment
--------------------- ---- --------
...
QGEXECUTEFOREIGNQUERY L ?
QGEXECUTEFOREIGNQUERYCONTRACT C ?
QGINITIATOREXPORT L ?
QGINITIATOREXPORTCONTRACT C ?
QGINITIATORIMPORT L ?
QGINITIATORIMPORTCONTRACT C ?
QGREMOTEEXPORT L ?
QGREMOTEEXPORTCONTRACT C ?
QGREMOTEIMPORT L ?
QGREMOTEIMPORTCONTRACT C ?
...
2. If the functions do not exist, run the DIP script systems functions using the DIP utility to add these
to the database.
DIPSYSFNC - System Functions
Note:
Before you begin, the following procedure for a Teradata-to-Teradata connector whose
Authentication Mechanism is set to Trusted, verify that a proxy user exists on the target Teradata
Database system. The proxy user is the one that will be used for authentication on the target
system. See Setting Up the Proxy User for a Teradata-to-Teradata Connector when Authentication
Mechanism is Set to Trusted.
Complete the following steps on the initiator system. These apply after initial deployment and when
creating remote servers or access, but not after upgrading versions.
For Teradata connectors, External Name Value Pairs (NVP) are set in the Foreign Server definition.
• The External NVP must be set up so the QueryGrid connector can identify itself with the Teradata
QueryGrid Manager to obtain the configuration NVP.
• External NVP may be set up on Teradata to access specific features like name and role mapping,
but should be used with care to not conflict with values supplied by Teradata QueryGrid Manager.
• The External NVP are called LINK and VERSION. These are configured using SQL commands:
ALTER FOREIGN SERVER or CREATE FOREIGN SERVER. For more information, see Teradata
Connector and Link Properties.
1. Log on as an Administrator, such as dbc, to the initiating Teradata Database system, and create an
authorization object for the target server:
CREATE AUTHORIZATION td_server_db.target_server_auth AS DEFINER TRUSTED USER
'proxyuser' PASSWORD 'password';
An authorization object is created in the td_server_db database. Using the DEFINER clause makes
the authorization available globally to all users.
2. Grant the CREATE SERVER and EXECUTE FUNCTION privileges on the td_server_db database
to the Administrator user, for example:
GRANT CREATE SERVER ON td_server_db TO dbc;
For example, where sdll7100 is the initiating Teradata Database system, and sdll7151 is the target
Teradata Database system:
For example:
Note:
On systems with Viewpoint 16.10, use the following procedure to complete the installation of the
Teradata connector components.
When you add a connector to a fabric, QueryGrid performs the following tasks on the Teradata Database
initiating nodes in the system:
• Creates the directories required for completing the installation
• Installs the Teradata connector package. The Teradata connector package includes a stored
procedure that provides a simple interface for executing basic SQL queries
The procedure includes the following:
• Running an installation script to unpack and distribute the Teradata connector package components
• Additional setup steps
1. Log on to a Teradata QueryGrid Manager TMS, VM, or server.
The QueryGrid Manager TMS, VM, or server can be part of a cluster.
2. Run the following script at the prompt as root or the tdqgm user:
/opt/teradata/tdqgm/bin/tdqg.sh install-connector
3. From Connectors, enter the number for the Teradata connector.
4. From Connector Version, enter the number for the Active or Pending version.
5. From Driver Nodes, enter the number of the driver node you want to use to perform the installation.
6. In Connector Properties, provide the administrator credentials, such as dbc and the password, for
the initiating Teradata Database system.
7. Enter the appropriate number for the mode the Teradata Database system is running in (TERA or
ANSI).
Note:
The mode determines how a stored procedure can be run.
Note:
On systems with Viewpoint 16.20, use the following procedure to complete the installation of the
Teradata connector components.
When you add a connector to a fabric, QueryGrid performs the following tasks on the Teradata Database
initiating nodes in the system:
• Creates the directories required for completing the installation
• Installs the Teradata connector package. The Teradata connector package includes the following:
◦ A stored procedure that provides a simple interface for executing basic SQL queries
◦ Push profile code, associated functions, and macros that allow you to use Teradata Database
Remote Table Optimization (RTO) with QueryGrid
This procedure includes the following:
• Running an installation script to unpack and distribute the Teradata connector package components
• Additional setup steps
1. Make sure the connector package has been downloaded from Teradata's software download site
and uploaded to the QueryGrid portlet, and that the connector has been added to the fabric.
2. Under Fabric Configuration, select Fabrics.
3. Click the fabric containing the Teradata Database initiating nodes.
4. Select Connectors tab.
5. Click next to the Teradata initiating connector for the Teradata Database nodes and select Install.
6. From Connector Installation, select one of the following:
• Active
• Pending
7. In the Select driver node list, select the driver node you want to use to run the installation script.
8. To allow the installation script to run, provide the Username and Password log on for an
Administrator, such as DBC, of the initiating Teradata Database system.
9. In the Transaction Mode list, select one of the following:
Note:
The mode determines how a stored procedure can be executed.
Option Description
The target_end_user is the user who has access to objects from the local system. The
target_end_user should be created with PERM > 0.
1. Add a user mapping where a Presto or a Hive user is the initiating user and a Teradata user is the
target user.
Complete these steps to verify a Teradata-to-TargetConnector link (where TargetConnector is any type
of target connector).
1. Log on to the initiating Teradata Database system as a local user.
2. Validate the foreign server configuration by running the HELP FOREIGN SERVER query:
HELP FOREIGN SERVER foreign_server_name;
3. Set up foreign server objects that match the appropriate access to database and tables needed by
Teradata Database users.
4. Set appropriate privileges to foreign server objects to Teradata Database users.
The Teradata initiator connector has a mechanism in the foreign server definition called an authorization
object, which contains the authenticating username and password for the remote system. This works
for either a one-to-one user mapping or a many-to-one user mapping (used for trusted users or service
accounts).
For more information, see Teradata® Database SQL Data Definition Language - Detailed Topics.
QueryGrid also provides a user mapping mechanism associated with the foreign server definition that
permits the mapping of user names. This permits users to be mapped for data centers that do not use
a common user identification across all systems. You can configure the user mapping table in the
QueryGrid portlet.
User mapping allows users logged on to the initiating system to be mapped to another user on the
remote system.
For user mapping, set up the Teradata initiator connector with DEFINER authorization.
Teradata provides a user configurable mechanism for authenticating to Kerberos. The user and
password is used to obtain a ticket from the KDC when attempting to connect to a remote Kerberized
Teradata or Presto.
Session Settings
Session settings are passed from the initiating Teradata Database system to the target Teradata
Database system.
• ANSI and TERA mode affect transaction semantics.
• QueryBand can be used for workload management to map TASM rules from the local to the target
system or to help associate child queries with the initiating Teradata query for monitoring purposes.
QueryGrid appends the following name-value pairs (NVPs) to the initiating Teradata Database
QueryBand when connecting to the target system. If a query traverses through more than one
Teradata-Teradata link, each system appends its session attributes to these NVPs delimited by a
colon.
◦ QG_UUID
◦ TD_HOSTID
◦ TD_QUERYID
◦ TD_REQUEST
◦ TD_SESSION
The following example shows three systems, A, B, and C, with the query initiated on System A.
Select * from foreign table(select * from tab@systemC)@systemB as dt
[QueryBand] System A session = ‘name1=value;’
[QueryBand] System B session =
‘name1=value;QG_UUID=<uuid1>;TD_HOSTID=<hostA>;TD_QUERYID=<queryidA>;TD_REQU
EST=<requestA>;TD_SESSION=<sessionA>;’
[QueryBand] System C session =
'name1=value;QG_UUID=<uuid1>:<uuid2>;TD_HOSTID=<hostA>:<hostB>;TD_QUERYID=<q
ueryidA>:<queryidB>;TD_REQUEST=<requestA>:<requestB>;TD_SESSION=<sessionA>:<
sessionB>;’
Authorization Objects
You can create an authorization object, which stores the credentials for a user in encrypted form for
Teradata connectors. Authorization object stores the user's credentials and used in foreign servers to
carry these credentials to the remote system for authentication.
If you need one-to-one mapping between a Teradata Database user and a remote user, then you must
have corresponding accounts in Teradata Database and the security system.
• When that user creates the authorization using AS INVOKER TRUSTED, the authorization is
stored by default on the user database.
• The credentials for the security system do not need to be revealed to another person and the
authorization object is accessible only to users with privilege to that database.
You can use many-to-one mapping between multiple Teradata Database users and one user on the
remote system to simplify administration. Only the creator of the authorization need know the
credentials for the user on the remote security system. When the authorization is created using AS
DEFINER TRUSTED, the authorization is stored by default in the TD_SERVER_DB database, which
makes the authorization available globally.
For a Teradata-to-Presto connection, create an authorization object and use it in the USING clause of
the foreign server. Teradata passes the credentials in an authorization object to the Presto connector,
then the Presto connector authenticates the user before sending the query to the data source.
Using INVOKER
This example creates the remote_presto1 authorization object in the user database of the creator. If
the creator is td_user then td_user.remote_presto1 is the fully qualified object name.
This example creates a foreign server object that uses the remote_presto1 authorization object.
The link value of td1_presto1 was created in the QueryGrid portlet. The link defines initiating and
target networks, specifies a communications policy that defines rules for transferring data between
connectors, and other properties.
When a foreign server is configured with the DEFINER keyword and no value is specified for the
database name (dbname), the Teradata connector automatically looks for the authorization in the
TD_SERVER_DB database.
Using DEFINER
This example creates the remote_presto1 authorization object.
This example creates a foreign server object that uses the remote_presto1 authorization object.
The link value of td1_presto1 was created in the QueryGrid portlet. The link defines initiating and
target networks, specifies a communications policy that defines rules for transferring data between
connectors, and other properties.
For more information, see CREATE AUTHORIZATION and REPLACE AUTHORIZATION.
Teradata connectors support Trusted, TD2, LDAP, and Kerberos security mechanisms when acting as
target connectors. The following considerations apply to each of the security mechanisms:
• The username and password assigned and communicated from the initiator connector takes
precedence over the one defined for the Teradata target connector properties.
For example, if the Teradata initiator provides an authorization object, it takes precedence over
security-related connector property settings. Defining these connector properties is optional. If,
however, credentials are not provided by the initiator connector, a username and password must
exist in its connector property settings.
• An Administrator can define user mappings in the QueryGrid portlet if the initiator end user differs
from the remote system end user. This is the user to which you have granted CONNECT THROUGH
on the remote system.
• For user mapping, the local user submitting the query is mapped to the remote user that submits
the query. User mapping applies as follows:
◦ For a Teradata initiator connector, user mapping can be used when it is set up with DEFINER
authorization such that the local user submitting the query is the not the same as the
authenticating user.
◦ For a target connector, user mapping is applicable when it is set up with the TRUSTED
authentication mechanism and the remote user is not the same as the authenticating user.
Trusted
Trusted User or Service Accounts are a proxy user that act on behalf of the local user. You configure
trusted sessions by granting CONNECT THROUGH privileges to proxy user or permanent end user. To
do this perform the following steps on the remote system:
CREATE USER proxyuser AS PERM = 0 PASSWORD = password;
GRANT CONNECT THROUGH proxyuser TO PERMANENT target_end_user without role;
>> this target_end_user is the user that has access to objects that we will
access from local system
The following property settings are required for Teradata target connectors using the Trusted security
model.
Setting Description
TD2
The following property settings are required for Teradata target connectors using the TD2 security model.
Setting Description
LDAP
You can configure Teradata target connectors to use LDAP authentication involving a username and
password. This means that queries with a Teradata target can be submitted using the LDAP security
mechanism to authenticate; for example, the Presto-to-Teradata connection supports LDAP. The
following properties must be configured to use LDAP with Teradata target connectors.
Setting Description
For detailed information about how to configure Teradata target connectors to use LDAP authentication,
refer to the Orange Book: User Authentication and Directory Integration.
Kerberos
Teradata Kerberos set up must be completed before configuring QueryGrid. The following property
settings are required for Teradata target connectors using the Kerberos security model.
Setting Description
• DBC.ServerV[X]
• DBC.ServerInfoV[X]
• DBC.TblSrvV[X]
• DBC.TblSrvInfoV[X]
Purpose
Modifies the parameters of an existing server object.
Syntax
Syntax Elements
server_name
The name given to the foreign server object.
EXTERNAL SECURITY
Associates an authorization object with the foreign server. The authorization stores the
encrypted credentials for a user as a database object. The Teradata connector passes the
credentials in the authorization to the remote platform identified by the foreign server when
the foreign server is accessed.
INVOKER
DEFINER
You can specify either a DEFINER or an INVOKER, but not both. If neither INVOKER nor
DEFINER are specified then INVOKER is used by default.
INVOKER is a keyword that indicates that the associated authorization must be present in
the user database at the time that the foreign server is accessed.
Note:
The user database is the database that was created for the user in the Teradata system
when the user account was created.
DEFINER is a keyword that indicates that the associated authorization must be present in the
database that contains the foreign server when the foreign server is accessed.
Note:
The DEFAULT keyword that can be used with DEFINER in CREATE AUTHORIZATION
and REPLACE AUTHORIZATION statements is not needed in association with a foreign
server.
If you use the DEFINER keyword, the authorization is global for all users who need to query
the foreign server.
You must use either INVOKER TRUSTED or DEFINER TRUSTED if the remote platform uses
an external security system (such as Kerberos, for example) for authentication.
TRUSTED
A keyword that indicates the associated authorization object was created as TRUSTED.
You must use the TRUSTED security type for the Teradata connector.
authorization_name
Specifies the name of the authorization object to be used when the foreign server is accessed.
Modify Options
ADD
Use to:
• Add or replace a global name value pair that is used to define the server object
• Add an IMPORT or EXPORT table operator. If you want to replace a table operator that is already
associated with the foreign server you must first drop the table operator before adding the new
one.
name('value')
The External Name Value pair or pairs (LINK and VERSION) you want to add or modify.
The name value pair or pairs define the properties of the foreign server. The name value
pairs are defined in the QueryGrid portlet. You can create separate named link
configurations for unique sets of properties and you can create different versions (active,
pending, previous) of the links. For more information, see Teradata Connector and Link
Properties.
You can change the External Name Value pairs in ALTER FOREIGN SERVER. If you want
to modify the properties of the named link, use the QueryGrid portlet.
In the description of the name value pairs:
• The label "Server only" indicates that the name value pair must follow the syntax ADD
name('value').
• The label "Import only" indicates that the name value pair must be specified after the
IMPORT keyword.
• The label "Export only" indicates that the name value pair must be specified after the
EXPORT keyword.
• Unlabeled name value pairs may be specified in any part of the ADD syntax. If
specified as ADD name('value'), the name value pair will be applied to the server as
a whole.
IMPORT
Indicates that you are going to act on the operator that is used to import data into Teradata
Database.
EXPORT
Indicates that you are going to act on the operator that is used to export data out of Teradata
Database.
operator_name
The name of the table operator that you want to use.
For more information about the table operators used with the server object, see CREATE
FOREIGN SERVER.
Drop Options
DROP
• Drop a global name value pair that was used to define a server object. You need only specify the
name to drop the pair.
• Drop an IMPORT or EXPORT table operator that was associated with a server definition. When
you drop a table operator all related name value pairs are also dropped.
• Drop a local name value pair that was used with an IMPORT or EXPORT table operator. You
need only specify the name to drop the pair.
name
When used alone, name is the name of the name value pair you want to drop.
IMPORT
Indicates you are going to act on the operator that is used to import data into Teradata
Database.
EXPORT
Indicates you are going to act on the operator that is used to export data out of Teradata
Database.
Required Privileges
You must have DROP SERVER privilege on the TD_SERVER_DB database or on the specified foreign
server to modify the foreign server object. If you are modifying the table operators that are associated
with the server, or adding a table operator, you must also have EXECUTE FUNCTION and SELECT
privileges on the specified table operators.
BEGIN LOGGING
Purpose
Starts the auditing of SQL requests that attempt to access data.
This topic describes only the portions of the BEGIN LOGGING syntax diagram that are specific to this
Teradata QueryGrid connector. For information about the other syntax that you can use with BEGIN
LOGGING, see Teradata® Database SQL Data Definition Language - Syntax and Examples,
B035-1144.
Syntax
BEGIN LOGGING ON A
DENIALS WITH TEXT FIRST
LAST
FIRST AND LAST
EACH
A ALL B
, ,
FOR CONSTRAINT constraint_name
operation BY database_name
GRANT user_name
B
, 20 ;
ON AUTHORIZATION authorization_name
DATABASE database_name
USER database_name
TABLE object_name
VIEW database_name.
MACRO user_name.
PROCEDURE
FUNCTION
TYPE
FOREIGN SERVER
Syntax Element
ON FOREIGN SERVER object_name
Indicates that the database object for which access is to be logged is a foreign server.
You must specify an object name, which is the name of the foreign server. You can optionally
specify the name of the containing database, which must be TD_SERVER_DB. You cannot
use a user_name with FOREIGN SERVER.
Purpose
Creates a user-defined description of a user-defined database object or definition in the data dictionary.
This topic describes only the portions of the COMMENT syntax diagram that are specific to Teradata
QueryGrid. For information about the other syntax elements in COMMENT (Comment Placing Form),
see Teradata® Database SQL Data Definition Language - Syntax and Examples, B035-1144.
Syntax
Syntax Element
object_kind_2
An optional database object kind specification.
You can specify the following database object kinds to retrieve a comment for the kind of
object they represent, but they are optional.
• DATABASE
• FOREIGN SERVER
• TABLE
• USER
If you specify an optional database_name with FOREIGN SERVER, the name must be
TD_SERVER_DB. You cannot use a user_name with FOREIGN SERVER.
All existing rules for COMMENT apply for use with a FOREIGN SERVER object.
The optional comment string is recorded in DBC.TVM.
For more information about using COMMENT (Comment Placing Form), see Teradata® Database SQL
Data Definition Language - Syntax and Examples, B035-1144.
Purpose
Creates or replaces an authorization object in Teradata Database. The authorization stores credentials
for a user account that exists on a remote platform. The credentials need only be valid on the platform
specified in the foreign server object; they do not need to be valid on the Teradata Database or on its
underlying operating system. When you specify TRUSTED in the CREATE or REPLACE
AUTHORIZATION statement, Teradata Database does not validate the credentials.
For Teradata QueryGrid, an authorization object is used by a foreign server object to log into a remote
platform using credentials that are valid on the remote platform. When a Teradata user makes a request
that uses the foreign server, the foreign server object provides the credentials from the authorization
object to the target platform for authentication. This allows any part of the request that runs on the remote
platform to use the context, privileges, and access control granted to the remote platform user account.
For example, if the foreign server connects to a server protected by Kerberos, then the associated
authorization object must contain credentials for the user account on that server.
The syntax table describes only the portions of the CREATE AUTHORIZATION and REPLACE
AUTHORIZATION syntax diagram that are specific to Teradata QueryGrid. For information about the
other syntax that you can use with CREATE AUTHORIZATION and REPLACE AUTHORIZATION,
seeTeradata® Database SQL Data Definition Language - Syntax and Examples, B035-1144.
Syntax
Syntax Elements
database_name.
user_dbname.
Optional name of the location where the authorization is to be stored.
The default location that is used changes based on whether DEFINER or INVOKER is
specified. The following rules apply to specifying DEFINER or INVOKER:
• If you specify DEFINER, the database or user you specify must be the containing
database or user for the foreign server, UDF, table UDF, method, or external SQL
procedure. If no location is specified, the authorization is created in the database that
contains the foreign server objects (TD_SERVER_DB).
• If you specify INVOKER, the database_name or user_dbname you specify must be
associated with the session user who will be sending requests to the foreign server. If no
location is specified, the authorization is placed in the user database of the creator of the
authorization.
authorization_name
Name for the authorization object. This name must be unique within the database in which it
is stored.
INVOKER
DEFINER
• If you specify INVOKER TRUSTED, or if you specify TRUSTED alone, Teradata creates
the authorization object in the database of the user who creates the object. This syntax
makes the authorization available only to those with privilege to the user database.
Note:
If used with the name of the Kerberos realm, the user_name portion cannot also contain
an @ sign.
'fs_password'
The password for the credential on the remote platform to be used by the foreign server.
All existing rules for CREATE AUTHORIZATION and REPLACE AUTHORIZATION apply.
For more information about using CREATE AUTHORIZATION and REPLACE
AUTHORIZATION, see Teradata® Database SQL Data Definition Language - Syntax and
Examples, B035-1144.
Usage Notes
• An authorization is required only if you are using an external security system such as Kerberos
for authentication on the foreign server's target platform.
• You must use either INVOKER TRUSTED or DEFINER TRUSTED when authentication on
Hadoop is performed by an external security system such as Kerberos.
• Use INVOKER TRUSTED when you want to create a one-to-one mapping between the Teradata
user and the user on the foreign server's target platform. For example, using the same user name
for Teradata and Kerberos.
• Use DEFINER TRUSTED when you want to create a many-to-one mapping between Teradata
users and a user on the target platform of the foreign server. For example, when you want multiple
Teradata users who are making requests to the foreign server to use one Kerberos account on
the target platform.
• Username and Password connector properties can be set in the QueryGrid portlet. They are used
for connector diagnostic checks and for end-to-end queries if they were not provided by the initiator
in the authorization object.
• When you create an authorization for another user using INVOKER TRUSTED, user_dbname
must be specified. Specify the username associated with the session user who will be sending
requests to the foreign server. If you fail to specify user_dbname, the authorization will be stored
in your user database.
• The authorization takes up no space in the database used to store it.
• If your credentials change on the target platform of the foreign server, you must remember to
replace the credentials in your authorization object. If you fail to update the invalid information, the
next time that you try to reference the foreign server object, you get an error message.
• If you drop an authorization object, keep in mind that it may be used by multiple foreign server
objects. You should either drop the foreign server objects or alter them so that they specify a valid
authorization object. If you fail to update the invalid information, the next time that you try to
reference the foreign server object, you get an error message.
If you plan to use the authorization to authenticate to Kerberos on a foreign server then you must use
either INVOKER TRUSTED or DEFINER TRUSTED.
The following two examples establish authorization for the user who invokes the object. The credentials
are encrypted and stored as a database object in the user database.
credentials for proxy_1 are stored in the remote_system1 authorization that is created in the
TD_SERVER_DB database.
Purpose
Creates a foreign server object and associates an import table operator and an export table operator
with it.
When you create a server object, you can customize it based on its purpose. You can define multiple
server objects for the same remote database, each with different characteristics needed by different
users.
Syntax
operator option
database_name.
Syntax Elements
server_name
The name given to the foreign server object.
EXTERNAL SECURITY
Associates an authorization object with the foreign server. The authorization stores the
encrypted credentials for a user as a database object. The Teradata connector passes the
credentials in the authorization to the remote platform identified by the foreign server when
the foreign server is accessed.
INVOKER
DEFINER
You can specify either a DEFINER or an INVOKER, but not both. If neither INVOKER nor
DEFINER are specified then INVOKER is used by default.
INVOKER is a keyword that indicates that the associated authorization must be present in
the user database at the time that the foreign server is accessed.
Note:
The user database is the database that was created for the user in the Teradata system
when the user account was created.
DEFINER is a keyword that indicates that the associated authorization must be present in the
database that contains the foreign server when the foreign server is accessed.
Note:
The DEFAULT keyword that can be used with DEFINER in CREATE AUTHORIZATION
and REPLACE AUTHORIZATION statements is not needed in association with a foreign
server.
If you use the DEFINER keyword, the authorization is global for all users who need to query
the foreign server.
You must use either INVOKER TRUSTED or DEFINER TRUSTED if the remote platform uses
an external security system (such as Kerberos, for example) for authentication.
TRUSTED
A keyword that indicates the associated authorization object was created as TRUSTED.
You must use the TRUSTED security type for the Teradata connector.
authorization_name
Specifies the name of the authorization object to be used when the foreign server is accessed.
USING
USING introduces the name value pair that provides server definition information. You can create a
foreign server without a USING clause, but users cannot query a foreign server until you complete
the server definition with an import operator and an export operator.
name('value')
The name value pair or pairs define the properties of the foreign server. The name value pairs are
defined in the QueryGrid portlet. You can create separate named link configurations for unique sets
of properties and you can create different versions of the links. For more information, see Teradata
Connector and Link Properties.
After defining the properties in the QueryGrid portlet, use the External Name Value pairs (LINK and
VERSION) with the USING clause of CREATE FOREIGN SERVER to associate the name value pair
with the foreign server.
The link name value pair is required to create a functioning foreign server object. Version is optional.
Additional optional name value pairs may be required to create a foreign server for a specific
implementation.
link
A named configuration that references an initiating connector, a target connector, a
communication policy, and defines the connector properties to use.
version
The version of the link to use.
You can specify the version of the configuration to use (active or pending) in a Teradata
foreign server definition. When pending is specified, then any pending versions of the link,
the initiating connector, the target connector, the communication policy, and the fabric are
used.
name(scalar_subquery)
You can also specify a subquery that returns a single row. Only one subquery is allowed for each
name. The subquery must return only one row and the WHERE clause of the subquery must reference
a unique primary index or unique secondary index. System variables and Using parameters are
allowed in the WHERE clause of the subquery. The row can have multiple values (columns) but all
values must be the same data type.
name(system_variable)
You can specify a system variable as a value.
name(using_parameter)
You can specify a using parameter as a value.
DO IMPORT WITH
DO EXPORT WITH
Required Privileges
You must have CREATE SERVER privilege on the TD_SERVER_DB database to define a foreign
server object. If you are associating the server with table operators, you must also have EXECUTE
FUNCTION and SELECT privileges on the specified table operators.
Usage Notes
• The target platform of the foreign server object must be running and reachable when creating the
foreign server object for it in Teradata Database.
• You can create multiple named foreign server objects that reference the same server using the
same link.
• Foreign server object names that are stored in TD_SERVER_DB must be unique.
• Name value pairs in the server area of the syntax apply to the connection to the remote platform
and to both of the table operators specified in the IMPORT WITH and EXPORT WITH clauses.
• Server options, names, and name value pairs can appear only once in the CREATE FOREIGN
SERVER syntax.
• The order of the DO IMPORT WITH and DO EXPORT WITH clauses in the CREATE SERVER
syntax does not matter.
• You must grant SELECT, INSERT, and SHOW privileges on foreign server objects to users who
need to query foreign server objects.
The example creates a foreign server using the LINK name value pair. The link and its properties are
defined in the QueryGrid portlet.
The example creates a foreign server using the LINK and VERSION name value pairs. The link and
its properties are defined in the QueryGrid portlet. The state of the link (active, pending, or previous)
is also set in the QueryGrid portlet and referenced in the VERSION clause in the example:
For more information about connector and link properties, see Teradata Connector and Link Properties.
For more information about versions, see Replacing Active Fabrics, Connectors, and Links Versions
with Pending or Previous Versions.
Purpose
Drops a foreign server object from the TD_SERVER_DB database.
In addition to deleting the server object and its associated information from the dictionary tables, all
dependent entries on the associated table operators are deleted.
You must have the DROP SERVER privilege on the TD_SERVER_DB database or on the specified
foreign server to DROP the foreign server.
Syntax
TD_SERVER_DB. ;
Syntax Elements
server_name
TD_SERVER_DB.
The name of the database that stores server objects and their attributes.
END LOGGING
Purpose
Ends the auditing of SQL requests that started with a BEGIN LOGGING request.
This topic describes only the portions of the END LOGGING syntax diagram that are specific to Teradata
QueryGrid. For information about the other syntax that you can use with END LOGGING, see Teradata®
Database SQL Data Definition Language - Syntax and Examples, B035-1144.
Syntax
A B
FOR CONSTRAINT constraint_name ,
BY database_name
user_name
B
, 20 ;
ON AUTHORIZATION authorization_name
DATABASE database_name
USER database_name
TABLE object_name
VIEW database_name.
MACRO user_name.
PROCEDURE
FUNCTION
TYPE
FOREIGN SERVER
Syntax Elements
ON operation
Indicates the operation for which log entries should no longer be made.
ON FOREIGN SERVER object_name
Indicates that the operation for which log entries should no longer be made is access to a
foreign server.
You must specify an object name, which is the name of the foreign server. You can optionally
specify the name of the containing database, which must be TD_SERVER_DB. You cannot
use a user_name with FOREIGN SERVER.
For information about using END LOGGING, see Teradata® Database SQL Data Definition Language
- Syntax and Examples, B035-1144.
EXPLAIN
You can use the Teradata QueryGrid connector to query a remote system to request an EXPLAIN plan
from the remote system.
For a Presto target system specify the kind of EXPLAIN you want, either LOGICAL or DISTRIBUTED.
• A LOGICAL plan executes the EXPLAIN command on a single node.
• A DISTRIBUTED plan executes the EXPLAIN command in fragments on single or multiple nodes.
To specify the kind, use the QueryGrid portlet to configure the target connector with the ExplainKind
connector property. See Teradata Connector and Link Properties.
Result:
Explanation
---------------------------------------------------------------------------
1) First, we do an all-AMPs RETRIEVE step executing table operator
TD_SYSFNLIB.QGINITIATORIMPORT with a condition of ("p100.C1 >= 11").
< BEGIN EXPLAIN FOR REMOTE QUERY -->
Remote Queries:
1. EXPLAIN CREATE TABLE
qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014e_EXEC AS
SELECT c1 ,c2 ,c3 ,c4 ,c5 FROM "default"."p100" WHERE C1 >= 11
[- Output[rows] => [rows:bigint]
-
TableCommit[qgremote:QGRemoteTransactionHandle{uuid=280273f9-403c-4cc7
-b0b5-dc148b36285f}:com.teradata.querygrid.qgc.presto.QGRemoteInsertTa
bleHandle@e32e808] => [rows:bigint]
- Exchange[GATHER] => partialrows:bigint, fragment:varbinary
- TableWriter => [partialrows:bigint, fragment:varbinary]
c1 := c1
c2 := c2
c3 := c3
c4 := c4
c5 := c5
- Exchange[REPARTITION] => c1:bigint, c2:varchar, c3:double,
c4:boolean, c5:varbinary
- ScanFilterAndProject[table = hive:hive:default:p100,
originalConstraint = ("c1" >= 11), filterPredicate = ("c1" >= 11)]
=> [c1:bigint, c2:varchar, c3:double, c4:boolean, c5:varbinary]
LAYOUT: hive
c1 := HiveColumnHandle{clientId=hive, name=c1, hiveType=bigint,
hiveColumnIndex=0, partitionKey=false}
c2 := HiveColumnHandle{clientId=hive, name=c2, hiveType=string,
hiveColumnIndex=1, partitionKey=false}
c3 := HiveColumnHandle{clientId=hive, name=c3, hiveType=double,
hiveColumnIndex=2, partitionKey=false}
c4 := HiveColumnHandle{clientId=hive, name=c4, hiveType=boolean,
hiveColumnIndex=3, partitionKey=false}
c5 := HiveColumnHandle{clientId=hive, name=c5, hiveType=binary,
hiveColumnIndex=4, partitionKey=false}
]
<-- END EXPLAIN FOR REMOTE QUERY >
The size of Spool 1 is estimated with low confidence to be 8 rows
(33,096 bytes). The estimated time for this step is 0.15 seconds.
2) Next, we do an all-AMPs RETRIEVE step from Spool 1 (Last Use) by
way of an all-rows scan with a condition of ("p100.C1 >= 11") into
Spool 2 (group_amps), which is built locally on the AMPs. The
size of Spool 2 is estimated with low confidence to be 8 rows (
98,840 bytes). The estimated time for this step is 0.16 seconds.
3) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> The contents of Spool 2 are sent back to the user as the result of
statement 1. The total estimated time is 0.31 seconds.
Result:
Explanation
---------------------------------------------------------------------------
1) First, we do an INSERT into Spool 4.
2) Next, we do an all-AMPs RETRIEVE step from Spool 4 (Last Use) by
way of an all-rows scan executing table operator
TD_SYSFNLIB.QGINITIATOREXPORT with a condition of ("(1=1)") into
Spool 2 (used to materialize view, derived table, table function
or table operator p100) (all_amps), which is built locally on the
AMPs.
< BEGIN EXPLAIN FOR REMOTE QUERY -->
Remote Queries:
1. CREATE TABLE
qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC AS
SELECT * FROM "p100" WITH NO DATA
2. EXPLAIN INSERT INTO "p100" SELECT * FROM
qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC
3. DROP TABLE IF EXISTS
qgremote.DEFAULT.TEMP_a1cd2570_d4ef_4b38_b3ed_00000000014f_EXEC
[- Output[rows] => [rows:bigint]
- TableCommit[hive:LegacyTransactionHandle{connectorId=hive,
uuid=f15a3b4c-89a8-427d-8dcd-c147334ff2ca}:hive:default.p100] =>
[rows:bigint]
- Exchange[GATHER] => partialrows:bigint, fragment:varbinary
- TableWriter => [partialrows:bigint, fragment:varbinary]
c1 := c1
c2 := c2
c3 := c3
c4 := c4
c5 := c5
- Exchange[REPARTITION] => c1:bigint, c2:varchar, c3:double,
c4:boolean, c5:varbinary
-
TableScan[qgremote:default:temp_a1cd2570_d4ef_4b38_b3ed_00000000014f_e
xec, originalConstraint = true] => [c1:bigint, c2:varchar,
c3:double, c4:boolean, c5:varbinary]
LAYOUT:
com.teradata.querygrid.qgc.presto.QGRemoteTableLayoutHandle@6029ca45
c1 := {name = c1, type = bigint}
c2 := {name = c2, type = varchar}
c3 := {name = c3, type = double}
c4 := {name = c4, type = boolean}
c5 := {name = c5, type = varbinary}
]
<-- END EXPLAIN FOR REMOTE QUERY >
The size of Spool 2 is estimated with high confidence to be 1 row
(29 bytes). The estimated time for this step is 0.03 seconds.
3) We do an all-AMPs RETRIEVE step from Spool 2 (Last Use) by way of
an all-rows scan into Spool 3 (Last Use), which is built locally
on the AMPs. The size of Spool 3 (Last Use) is estimated with
high confidence to be 1 row (41 bytes). The estimated time for
this step is 0.16 seconds.
4) Finally, we send out an END TRANSACTION step to all AMPs involved
in processing the request.
-> No rows are returned to the user as the result of statement 1.
GRANT grants one or more explicit privileges on a database, foreign server, user, proxy logon user,
table, hash index, join index, view, stored procedure, User-Defined Function (UDF), User-Defined
Method (UDM), User-Defined Type (UDT), or macro to a role, group of roles, user, or group of users or
databases. REVOKE revokes privileges on the same objects.
There are no changes to existing syntax for Teradata QueryGrid, except that CREATE SERVER and
DROP SERVER privileges have been added. These privileges should be granted only to a user, not to
a database.
Note:
You are not allowed to GRANT CONNECT THROUGH privilege on the DBC user.
For a syntax diagram and description of the syntax elements that you can use in GRANT and
REVOKE, see Teradata® Database SQL Data Control Language, B035-1149.
HELP FOREIGN
Purpose
Returns the details of the foreign object that you specify.
• A foreign server object name returns the list of databases accessible on the server.
• The name of a database on a foreign server returns the list of tables in the remote database on the
server.
• The name of a table in a remote database on a foreign server returns the list of columns in the
remote table on the server.
• The name of a function in a remote database on a foreign server.
Syntax
Syntax Elements
SERVER server_name
The name of the foreign server. Displays the databases in the foreign server.
DATABASE db_name@server_name
The name of the remote database, qualified with the name of the foreign server. Displays the tables in
the database.
TABLE db_name.table_name@server_name
The name of the remote table, qualified with the name of the foreign server. Displays the column names,
data type, and other attributes.
HELP FOREIGN TABLE can be executed with or without the database or schema name (db_name)
specified. When the database name is not provided in the query, the currently logged on database or
the connector default is used.
FUNCTION db_name.ForeignFunction@server_name
The name of the function on the remote database, qualified with the name of the remote server.
Displays the details of the foreign function available on the remote server. For example, the statement
may return the function parameters, their types, and other attributes.
Result:
Databases
--------------------
default
information_schema
finance
marketing
Result:
Tables
---------------------
buses
ca120453
jing_part_tab1
prama_part_tab1
tbig_1row
web_sales_part1_orc
Note:
HELP FOREIGN TABLE can be run with or without the database or schema name specified.
When the database name is not provided in the query, the currently logged on database or the
connector default is used.
Result:
Result:
Type I
Comment ?
Nullable Y
Format -(10)9
Max Length 4
Decimal Total Digits ?
Decimal Fractional Digits ?
Table/View? F
Char Type ?
Parameter Type I
UDT Name ?
Parameter Dictionary Name SessionNo
Parameter SQL Name SessionNo
Parameter Name UEscape ?
UDT Dictionary Name ?
UDT SQL Name ?
UDT Name UEscape ?
Inline Length ?
Parameter Name RunVProcNo
Type I2
Comment ?
Nullable Y
Format -(5)9
Max Length 2
Decimal Total Digits ?
Decimal Fractional Digits ?
Table/View? F
Char Type ?
Parameter Type I
UDT Name ?
Parameter Dictionary Name RunVProcNo
Parameter SQL Name RunVProcNo
Parameter Name UEscape ?
UDT Dictionary Name ?
UDT SQL Name ?
UDT Name UEscape ?
Inline Length ?
Parameter Name RETURN0
Type CV
Comment ?
Nullable Y
Format X(12304)
Max Length 24,608
Decimal Total Digits ?
Required Privileges
You must have ANY privilege granted on the server object to display the output from HELP FOREIGN.
The ANY privilege is used for a HELP or SHOW statement for which at least one privilege, but no
specific privilege, is required. For more information, see Privilege Dictionary in Teradata® Database
SQL Data Control Language, B035-1149.
You can export data to a remote system by using an INSERT statement to place data into an existing
table. The table can be empty or it can contain data. If the table already contains data, the exported data
is appended to the data in the existing table.
If no database is specified for the remote database, the current session database or the connector
default database is used, depending on the remote connector type and user mapping.
You can use the foreign server grammar in the form of database_name.table_name@server_name in
the SELECT statements of your queries. If you do not specify a database, it defaults to the current
database for Teradata-to-Teradata and is used as the default or overridden database provided in the
connector or link properties for Teradata-to-Presto. You can use this foreign server grammar in joins and
any other place that you reference a normal table, including views, macros, and stored procedures.
Logical expressions such as AND, OR, NOT, >, <, and so on, are supported. Standard Teradata limits,
such as returning up to 2048 columns, apply. Row size must be less than 64K.
For a list of the supported data types, see Data Type Mapping for Teradata QueryGrid Connectors.
Query processing is pushed down to the target system, based on the capabilities of the target system,
and the optimization of the local system. For example, if you query a target Presto system from a
Teradata system, the Teradata optimizer decides the pushdown predicates, which are then evaluated
for final target query pushdown based on what is supported by the target system.
Result:
Result:
make model
------ --------------------
Buick Century
Buick Enclave
Note:
A select from foreign table request can only be initiated by Teradata.
Note:
A select from foreign table request with an export clause can only be initiated by Teradata.
SELECT * FROM
FOREIGN TABLE(SELECT types_numeric.bigint1,temp1.integer1 , temp2.byteint2
FROM types_numeric, temp1,temp2
WHERE types_numeric.bigint1 > 1
AND temp2.bigint2 = types_numeric.bigint1)@td1
EXPORT(
(SELECT 127 as byteint1, 32767 as smallint1, 2147483647 as integer1,
9223372036854775807 as bigint1) as temp1,
localdb.table1 as temp2)
AS ft;
Note:
A select from foreign table request with an export clause can only be initiated by Teradata.
clause helps map these types to CHAR, VARCHAR, or CLOB with a specific length or character set.
BYTE and VARBYTE can also be mapped to a specific length.
When bringing the array type from Hive or Presto target connectors, any JSON-based Hadoop array
format is implicitly converted to the Teradata VARCHAR array format.
CREATE TYPE SUSUDTLIB.STRARRAY AS VARCHAR(2) CHARACTER SET UNICODE ARRACY [3];
SELECT * FROM datatypes1@fs1 RETRUNS (varchar1 STRARRAY)
SELECT * FROM datatypes1@fs1 RETURNS (varchar1 VARCHAR(5) CHARACTER SET LATIN)
WHERE bigint1 >10000 AND double1 < 10000;
Purpose
Displays the SQL text most recently used to create, drop, or modify the server object.
A SHOW FOREIGN SERVER statement allows you to see a server object definition that contains the
name value pairs that the associated table operators use to connect to the foreign server.
Syntax
Syntax Elements
IN XML
TD_SERVER_DB.
The name of the database that stores foreign server objects and their parameters.
server_name
Required Privileges
SHOW FOREIGN SERVER requires SHOW privilege or ANY privilege on the server object to display
the output.
This example demonstrates the SHOW FOREIGN SERVER that returns XML output.
Option Description
4. Use the following syntax when running Teradata Database 16.00 and later to override the Teradata
connector property during a session:
set foreign server attr = ‘servername=<fs1>;<prop1>=<overrideVal1>;
…;servername=<fs2>
<prop1>=<overrideVal1>;…;’ for session volatile;
For example:
Set foreign server attr =
‘servername=fs1;readtimeout=500000;writetimeout=200000;servername=fs2;
responsetimeout=250000;’ for session volatile;
5. [Optional] To clear Teradata connector property overrides without closing a session, use the following
syntax.
Set foreign server attr = NONE for session volatile;
Note:
Make sure that the RTO feature is enabled in the Teradata Database.
• Default Push Profile. The default is recommended for queries with a specific target connector or link.
Query performance depends on how the remote system executes the pushed operation and is based
on the network interfaces and bandwidth. If the remote system performance is slow and causes
undesirable impacts, the default push profile can be replaced with a custom push profile.
• Custom Push Profile. Custom push profiles can be created for site-specific queries that need to be
configured based on data transfer thresholds and transfer speeds. Custom push profiles override
default push profiles.
Note:
Using a push profile does not require changes to the foreign server.
RTO Process
When a query is sent from the Teradata Database to a remote data source, and a push profile is used,
the following occurs:
1. The operation is sent to the remote data source.
Note:
Statistics are collected. The statistics and push profile settings determine whether the
operation is performed on the remote data source.
2. A temporary table is created on the remote data source and the following scenarios apply:
• If delayed fetch is enabled and chosen based on static statistics, dynamic statistics are collected
for the temporary table. The statistics determine whether a remote join or local join is performed
on the temporary table.
• If a remote join is chosen (with or without delayed fetch), the temporary table is exported for a
local join.
3. Statistics about the row count and byte count of the temporary table are collected and sent to the
Teradata Database optimizer for analysis.
4. If the counts are at or below the delayed fetch threshold specified in the push profile, the query result
(the temporary table) is sent to the Teradata Database.
5. If the byte count is greater than the delayed fetch threshold, the dynamic statistics that were collected
are sent to the optimizer. The optimizer then decides whether a local join or remote join is performed.
• If a local join is chosen, the temporary table is brought back in a separate execution phase.
• If a remote join is chosen, the local table is exported, joined with the temporary table on the
remote system, then brought back to the local system.
"ColOp": [
{
"default":true,
"array":false,
"CompareOp": {
"default": true,
"overlap":false
},
"ArithOp": {
"default": true,
"mod":false
},
"LogicalOp": {
"default": true
}
}
],
"JoinOp": {
"inner": true
},
"AggrOp": {
"count":true,
"sum":true
},
"ServerSettings":{
"importCostAdj": 1.00,
"exportCostAdj": 1.50,
"delayedFetchThresh": 0,
"doCluster": true,
"doRemoteJoin": true,
"remJoinTransAdj": 0,
"doMultiTblClustering": true,
"doSingleTblDelayedFetch": false
}
}
'));
"char":true,
"varchar":true,
"byteint":true,
"smallint":true,
"int":true,
"bigint":true,
"decimal":true,
"real":true,
"varbyte":true,
"timestamp":true,
"CompareOp": {
"default":true,
"overlap":false
},
"ArithOp": {
"default": true,
"mod":false
},
"LogicalOp": {
"default":true
}
}
],
"JoinOp": {
"inner":true
},
"AggrOp": {
"count":true,
"sum":true
},
"ServerSettings": {
"importCostAdj": 1.00,
"exportCostAdj": 1.50,
"delayedFetchThresh": 0,
"doCluster": true,
"doRemoteJoin": true,
"remJoinTransAdj": 0,
"doMultiTblClustering": true,
"doSingleTblDelayedFetch": false
}
}
'));
}
}
'));
The attributes of a push profile are described in the following sections. Except where noted, the attributes
are used in default push profiles and custom push profiles. Create custom push profiles and overrides
with the help of a Teradata Customer Support Representative.
<SourceProfile: SourceProfileName,>
<SourceProfile: SourceProfileName,> is the PushProfileID of the default push profile. A default
push profile does not contain this attribute. A custom push profile always points to the PushProfileID
of the default push profile used to create the custom profile.
ColOp
Note:
Changing ColOp is not recommended. Always use the default data type lists provided for Teradata
Database, Presto, Hive, and Spark.
ColOp is an array of data types and the operations that can be pushed to the remote database for a
specified data type. For a disabled data type, none of the expressions/operations are pushed. When a
default is used in ColOp, the expressions/operations are pushed to the remote system for all supported
data types.
The data types and operations that are supported by a corresponding Teradata Database version are
listed using true/false. True means an operation on a data type can be pushed to a remote database.
You can override the default for a data type if a data type is specified.
In the following example, operations/conditions on all data types that can be pushed to the target
connector are supported, except array.
"default":true,
"array":false,
In the following example, only operations/conditions on the following data types are pushed. No other
data types are supported for the link.
"date":true,
"char":true,
"varchar":true,
Attribute Setting
Data type TRUE: When a data type has a true flag, the operation on the data type is pushed to the
remote system.
FALSE: No operation on this data type is pushed to the remote system.
Operation TRUE: When an operation on any data type has a true flag, the operation is pushed to the
remote system.
FALSE: The operation on any data type is not pushed to the remote system for any data
type.
Example operations are:
• CompareOp operations (EQ, NE, LT, and so forth)
• LogicalOp operations (AND, OR, NOT, and so forth)
Note:
All ColOp attributes are subject to the limitations of the target connector. If a target connector does
not support the operation, the operation is not pushed to the remote system.
"default" : true,
"date" : false,
],
GroupOp
Note:
Changing GroupOp from the default provided for the target connector is not recommended. For
example, if the default custom push profile states that an inner join is true and an outer join is false,
do not change it.
GroupOp is the name of a group that contains similar operations. When a default is used, it implies that
the default applies to all operations in the group. The value is either TRUE or FALSE.
When a group of similar operations like JoinOp or AggrOp are listed under GroupOp, and the value is
set to TRUE or FALSE:
TRUE: The operation will be pushed to the remote system.
FALSE: The operation will not be pushed to the remote system.
Example of GroupOp operations and settings:
"JoinOp" : { "inner" : true, "outer" : false },
ServerSettings
Server-level settings impact the performance of the query. The cost factors for import and export can
be set for a specific link. In addition, flags can be set to turn on the cluster phase and remote joins for
an operation.
Attribute Setting
doSingleTblDelayedFetch Enables and disables delayed fetch processing for single remote table
clustered query. The default value is FALSE.
FALSE: Delayed fetch is disabled for single table clustering and only
static planning applies.
TRUE: Delayed fetch is enabled for single table clustered query.
Changing the default is not recommended.
doMultiTblClustering Controls whether multiple remote tables should be joined at the remote
system or if they should be imported to the local system and joined at
the local system. The default value is TRUE.
TRUE: Enable remote join for clustered remote tables.
FALSE: Disable remote join for clustered remote tables. This implies
that tables are imported to the local system and joined at the local
system.
If the processing power of the remote system is not optimal, the
recommendation is to set this to FALSE. Custom push profiles and
Attribute Setting
doRemoteJoin Controls whether remote join is enabled or not; i.e., exporting of a local
table and join with remote table on the target system is allowed or not.
Default value is TRUE.
TRUE: Enables exporting a table from a local system and performing a
join with a table on the remote system.
FALSE: Disables remote join. A table will not be exported to a remote
system for a remote join. Joins are performed on the local system.
If the processing power of the remote system is not optimal, and the cost
of an export to the remote system and a join on the remote system is
higher, it is recommended to update the cost adjustments of import and
export.
Note:
The following attributes are applicable only when doRemoteJoin is set
to TRUE:
• importCostAdj
• exportCostAdj
• remJoinTransAdj
• delayedFetchThresh
remJoinTransAdj Specifies the cost of performing a remote join and importing the result.
The default is 0 and should not be changed. This factor is accounted for
in exportCostAdj.
Attribute Setting
Note:
If the value is set to zero, delayed fetch is disabled and the temporary
(result) table is exported to the local system to perform the remote join.
TableProfile
TableProfile allows you to override a custom push profile at the table level. It is useful when a set of
operations for a few tables on a remote system are not performing according to expectations. Custom
push profiles and overrides should be done with the help of a Teradata Customer Support
Representative.
The following defaults are supported for RTO data types and operations for Teradata Database 16.20
and later.
CompareOP
BETWEEN
EQ
GE
GT
IN
LE
LIKE
LT
NE
NOTIN
OVERLAP
LogicalOP
AND
OR
NOT
ISNULL
ArithOp
ABS
ADD
DIV
LOG10
LOGE
MOD
MUL
SQRT
SUB
AggrOp
AVG
COUNT
MAXIMUM
MINIMUM
SUM
MiscOp
CASE
CAST
CONCAT
DTI
EXTRACT
LOWER
OCTET
SUBSTR
TRIM
UPPER
Server Setting
delayedFetchThresh
doCluster
doMultiTblClustering
doRemoteJoin
doSingleTblDelayedFetch
exportCostAdj
importCostAdj
remJoinTransAdj
The following macros are found in TD_SERVER_DB and are available to display, modify, and drop push
profiles recorded in the table.
• TD_CONN_REGISTER_PUSHPROFILE
• TD_SHOW_PUSHPROFILE
• TD_SHOW_EXPANDED_PUSHPROFILE
• TD_OVERWRITE_PUSHPROFILE
• TD_DROP_PUSHPROFILE
• TD_COPY_PUSHPROFILE
Information on the macros is found at HELP DATABASE TD_SERVER_DB.
The macros installed with the RTO dip script allow you to create and name custom push profiles for use
with Teradata QueryGrid. A custom push profile can be used to:
• Enable or disable any operation available in the default push profile
• Tune (calibrate) the server settings available in a default push profile
Custom push profiles override default push profiles.
NOTICE
The settings in custom push profiles should be based on workload and the recommendations of
your Teradata Customer Support Representative.
NOTICE
Base the settings in custom push profiles on workload and the recommendations of your Teradata
Customer Support Representative.
This procedure shows how to use the following macros to create custom push profiles.
• Copy macro (TD_COPY_PUSHPROFILE).
• Overwrite macro (TD_OVERWRITE_PUSHPROFILE).
Hive is used as an example. Use the same steps to create custom push profiles for Teradata and
Presto.
1. Create a custom push profile.
Option Steps
Copy and a. Copy the default push profile and rename it.
Overwrite In the example below, the default push profile HIVE_V1 is copied and renamed
the push Hive_Custom1.
profile EXECUTE TD_COPY_PUSHPROFILE(‘HIVE_V1’, ‘Hive_Custom1’);
b. Update the push profile.
The following example uses the overwrite macro to overwrite an entire existing
custom push profile (Hive_Custom1) with a new JSON specification.
EXECUTE TD_OVERWRITE_PUSHPROFILE('Hive_Custom1', new
JSON(‘{"SourceProfile":"Hive_V1",
"ColOp":[{"timestamp":false,"varbyte":false,"byte":false,
"CompareOp":{"default":true,"GT":false,"LT":false}
"CastOp":{"default":false}}],
"AggrOp":{"count":false}}’))
For information about TASM throttle rules, see Teradata® Database Workload Management User
Guide, B035-1197.
For more detailed information about using Viewpoint Workload Designer, see Teradata® Viewpoint User
Guide, B035-2206.
Note:
If you are using the MONITOR SESSION request, set the mon_ver_id to 11, where mon_ver_id
is the monitor software version ID field for the current release.
ReqTblOpBytesIn Total number of bytes transferred into Teradata Database from a foreign
server for the current request through one or more table operators.
Note:
The request may involve one or multiple table operator executions. The
ReqTblOpBytesIn output parameter shows bytes transferred across all
invocations within the request.
ReqTblOpBytesOut Total number of bytes transferred out of Teradata Database and into a foreign
server for the current request through one or more table operators.
Note:
The request may involve one or multiple table operator executions. The
ReqTblOpBytesOut output parameter shows bytes transferred across all
invocations within the request.
ExecuteForeignSQL is a stored procedure that provides a simple interface for the users to execute basic
SQL queries. ExecuteForeignSQL and an install script are provided as part of the Teradata QueryGrid
connector package.
ExecuteForeignSQL
Purpose
The ExecuteForeignSQL stored procedure provides an interface for executing basic SQL queries on
the foreign server. For example, you can use ExecuteForeignSQL to create or drop a table in a database
on the foreign server.
ExecuteForeignSQL passes all SQL queries through, but it does not return results sets, so if you use it
to execute a SELECT or HELP statement, you do not see any results.
ExecuteForeignSQL and an install script are provided as part of the Teradata QueryGrid connector
package. The DBA manually executes the script to install ExecuteForeignSQL and then grants the
appropriate privileges. Before you use ExecuteForeignSQL you create a foreign server using the
QGExecuteForeignQuery table operator in the DO IMPORT WITH clause.
Syntax
Syntax Elements
SYSLIB.
The name of the database where the stored procedure is located.
query_expression
A valid Teradata SQL expression.
The query is passed through unparsed to the foreign server.
server_name
The name of the foreign server.
Usage Notes
ExecuteForeignSQL provides secure execution by using an embedded table operator along with Trusted
Sessions to handle logon credential verification.
A DBA can selectively GRANT the privilege to use ExecuteForeignSQL.
To call ExecuteForeignSQL, you must first create a foreign server object that specifies the use of the
TD_SYSFNLIB.QGExecuteForeignQuery table operator:
DO IMPORT WITH TD_SYSFNLIB.QGExecuteForeignQuery;
You can only associate one import and one export operator at a time with a foreign server, so to run
ExecuteForeignSQL on an existing foreign server that is being used for queries, you can create a
separate foreign server object with a different name to use for running ExecuteForeignSQL. You must
have EXECUTE FUNCTION and SELECT privileges on this operator.
If you reference a table name, you must prepend it with the schema name.
SQL queries that return result sets, such as SELECT or HELP, are executed on the remote system, but
the resultant rows are not displayed. The query may continue to use CPU, memory and I/O resources
on the remote system.
ExecuteForeignSQL uses a proxyuser, so the execution of commands on behalf of DBC is not
supported.
ExecuteForeignSQL can be used with Kerberized clusters.
CALL SYSLIB.ExecuteForeignSQL(
'create table tab1(c1 int, c2 string)',
'QG_Presto1');
);
Note:
This example works similarly for remote Teradata, Presto, or Hive. Simply create a foreign server
object (for example, TD_SERVER_DB.HIVE_EFSSP) and call SYSLIB.ExecuteForeignSQL.
QGInitiatorImport
QGInitiatorImport is the initiator import function that is invoked when the query is initiated from Teradata
and needs to access metadata and fetch data from a remote host. This initiator import connector function
is used to import data from any remote host.
QGInitiatorExport
QGInitiatorExport is the initiator export function that is invoked when the query is initiated from Teradata
to access metadata and export data to a remote host. This initiator export connector function is used to
export data to any remote host.
QGRemoteImport
QGRemoteImport is the remote import function that is invoked when the query is initiated by a remote
host to transfer data to the local Teradata system. This remote import function is used for data transfer
from any remote data source.
QGRemoteExport
QGRemoteExport is the remote export function that is invoked when the query is initiated by a remote
host to access data from the local Teradata system. This remote import function is used to export data
to any remote host.
QGExecuteForeignQuery
QGExecuteForeignQuery is the function that is invoked when a stored procedure is invoked to execute
a DDL or DML request on the remote system. This allows you to execute CREATE TABLE, DROP
TABLE, GRANTs, and so on, from a local Teradata system on the remote host.
When you query a remote system that runs a target connector that is a different platform from the local
system (initiator) connector, data is converted to satisfy the target database requirements. Even when
the initiator and target connectors are the same, the data is still transformed because the host formats
might be different from each other.
It is important to note the following information about data types:
• The mapping for some data types may not preserve the data in all cases, so be aware that with
some queries, data loss can occur.
As an example, the import of data from Presto with an unlimited VARCHAR size into a limited
Teradata VARCHAR column requires truncation and thus, data loss.
As another example, if you export a Teradata byteint data type as a Boolean and then import it
again, the data may not be the same. This can occur because the Boolean zero or one is imported
while the byteint may have contained other values beyond zero or one.
• If a data type is unsupported on the remote system, and the metadata information retrieved contains
a global type that is not supported on the initiator system, an error is returned from the initiator. For
SELECT * queries with a column containing an unsupported data type, the unsupported column
causes the entire query to return an error. In this case the query must include only the supported
columns in the select list.
• All time-related data types are in UTC.
Note:
Teradata data types denoted with an asterisk (*) are only available with Teradata Database 16.20
Feature Update 1 and later.
G_Bigint Bigint
G_Blob Blob
G_Boolean Byteint
G_Byte Byte
G_ByteInt Byteint
G_Date Date
G_Decimal Decimal
G_Float Float
G_Integer Integer
G_MBB MBB *
G_MBR MBR *
G_Number Number
G_Period Period *
G_SmallInt Smallint
G_STGeometry ST_Geometry *
G_Time Time
G_Timestamp Timestamp
G_Varbyte Varbyte
G_XML XML *
Note:
Teradata data types denoted with an asterisk (*) are only available with Teradata Database 16.20
Feature Update 1 and later.
Bigint G_BigInt
Blob G_Blob
Byte G_Byte
Byteint G_Byteint
Clob G_Clob_UTF16/Latin
Date G_Date
Decimal G_Decimal
Float G_Float
Integer G_Integer
MBB * G_MBB
MBR * G_MBR
Number G_Number
Smallint G_SmallInt
ST_Geometry * G_STGeometry
Timestamp G_TimeStamp
Varbyte G_Varbyte
XML * G_XML
The following procedure preserves the FOREIGN SERVER grants and access rights for users.
1. Stop all queries running on the QueryGrid 1.0x foreign server.
2. For the FOREIGN SERVER used on QueryGrid 1.0x, type the following to display the FOREIGN
SERVER description, the list of custom clauses, and the import and export functions used for the
FOREIGN SERVER:
SHOW FOREIGN SERVER bock_classic2;
CREATE FOREIGN SERVER TD_SERVER_DB.bock_classic2
EXTERNAL SECURITY INVOKER TRUSTED UT1PROXY3 USING
Hosttype ('Teradata')
remotehost ('bock1.labs.teradata.com')
ip_device ('byn1')
port ('5000')
read_timeout (200 )
listen_timeout (60 )
concurrentstreams (1 )
DO IMPORT WITH SYSLIB.LOAD_FROM_TD ,
DO EXPORT WITH SYSLIB.LOAD_TO_TD ;
3. Drop all old NVPs from the QueryGrid 1.0x foreign server.
ALTER FOREIGN SERVER TD_SERVER_DB.bock_classic2 DROP hosttype, drop remotehost,
drop ip_device, drop port, drop read_timeout, drop listen_timeout, drop
concurrentstreams, drop IMPORT, drop EXPORT;
4. Add the new NVPs to the QueryGrid 1.0x foreign server.
AALTER FOREIGN SERVER TD_SERVER_DB.bock_classic2 ADD link(‘bock_ng’), add
IMPORT WITH TD_SYSFNLIB.QGINITIATORIMPORT, add export with
TD_SYSFNLIB.QGINITIATOREXPORT;
5. Show the new 2.0x FOREIGN SERVER.
SHOW FOREIGN SERVER bock_classic2;
CREATE FOREIGN SERVER TD_SERVER_DB.bock_classic2
EXTERNAL SECURITY INVOKER TRUSTED UT1PROXY3 USING
LINK(‘bock_ng’)
DO IMPORT WITH TD_SYSFNLIB.QGINITIATORIMPORT,
DO EXPORT WITH TD_SYSFNLIB.QGINITIATOREXPORT;
For more information about configuring the 2.0x foreign server with QueryGrid 2.0x name value pairs,
see:
• Configuring a Foreign Server and Granting Privileges for a Teradata-to-TargetConnector
• Teradata Connector and Link Properties
Note:
Properties may be available for initiating connectors only, target connectors only, or both.
Overridable? Connector
Name Default Description
Property Name Type
16.20+ LOB True On Teradata Databases version 16.20 and later, ● Target
Support the STRING and BINARY columns on Presto are lobSupport
mapped to CLOB and BLOB by default. Unselect
this option to map the STRING and BINARY
columns to VARCHAR and VARBYTE,
respectively.
Authentication None Indicates the authentication mechanism used on Target
Mechanism the target data source.
Valid values are None, Kerberos, and LDAP.
This is a required setting.
Catalog Name hive Name of the catalog for the Presto connector. ● Target
catalogName
Overridable? Connector
Name Default Description
Property Name Type
Connection 86400 The maximum idle time for the connection cache Target
Max Idle Time seconds object, after which the object is closed and
removed from the cache. Use this property when
there are multiple concurrent users and queries
running on the system that might lead to starvation
of connection objects.
Valid values are 1–86400 seconds.
Default Binary 64000 The default truncation size for the VARBINARY ● Target
Size bytes types. defaultBinarySize
Valid values are 1–2097088000 bytes.
This is for a Teradata-to-Presto link and is used by
the target Presto connector and is applicable
when the initiating Teradata Database does not
support BLOB data types with QueryGrid. With
BLOB support, the default binary size is not used.
Disable False When set to true, disables the pushdown of all ● Initiator
Pushdown query conditions to the target system. disablePushdown
Certain system-level, session-level, and column-
level query attributes, such as CASESPECIFIC,
can affect character string comparison results.
These attributes can cause some queries to return
incorrect results due to incorrect row filtering on
the target system.
To avoid incorrect results caused by condition
pushdown in situations where the settings on the
Overridable? Connector
Name Default Description
Property Name Type
Enable INFO Logging level for the connector or link properties. Initiator,
Logging User level log settings can be explicitly set Target
through the add or edit link page in the
QueryGrid portlet.
This setting applies to both the initiating and target
connector. The logging level for the initiator
connector in the link, however, takes precedence
if set differently.
Valid values are NONE, WARN, INFO, and
DEBUG.
Explain Kind None Defines the flavor of the explain for the EXPLAIN ● Target
SQL statement for a remote Presto query. explainKind
Valid values are logical or distributed.
Link Buffer Size 1048576 Maximum size of the write buffers to allocate for ● Initiator
row handling and message exchange. linkBufferSize
Valid values are 73728–10485760 bytes.
Overridable? Connector
Name Default Description
Property Name Type
Role Support False Enable user role support for the target system. ● Target
This feature is only available when Presto with roleSupport
Sentry is being used.
When set to true, the user role from the initiator or
target is applied to the target system based on role
mapping, if any. If the cluster is configured to
support roles, errors are returned back to the user.
If the cluster is not configured to support roles,
the user role is not applied.
When set to false, roles are not applied to the
target system.
Schema Name default Name of the schema used for the Presto ● Target
connector. schemaName
If you are upgrading QueryGrid and are using Viewpoint 16.10, use the following procedure to complete
the Presto connector installation.
• Run an installation script that uses presto-admin to unpack and distribute the loader-factory-
version.jar file to the worker nodes
Note:
After the JAR file is successfully installed, Presto restarts.
Properties
When you add a connector to a fabric, QueryGrid performs the following tasks on the initiating node
where Presto (presto-admin) is installed:
• Creates the directories required for completing the installation.
• Installs the Presto connector package. The Presto connector package includes a loader-factory
JAR file.
Use the following procedure to complete the installation and configuration of the Presto connector on
systems with Viewpoint 16.20. During the procedure, you must provide SSH credentials.
Note:
The SSH credentials are not stored in the QueryGrid portlet and are used only to complete the
installation and configuration of the Presto connector.
Note:
After the JAR files are successfully installed, Presto restarts.
• Active
• Pending
7. In the Select driver node list, select the driver node you want to use to run the installation script.
8. To allow the installation script to run, provide the following information:
Option Description
Host: Type the host name of the master node where Presto is installed (the initiator
master node where you want to install the JAR files).
Note:
Do not use the IP address.
Presto Admin Type the name of the directory where Presto (presto-admin) is installed on the
Location Master Node. The default installation directory is:
/opt/prestoadmin/
Presto Install Type the name of the directory to install the JAR files. The default is:
Location /usr/lib/presto/
9. Click Run.
10. Verify successful installation by checking that the driver node specified in the Select driver node
list is represented in the Success field.
If the installation is successful, the JAR files are distributed to the worker nodes. When installation
is complete, Presto restarts.
Note:
If an error halts the installation, Presto does not restart.
11. [Optional] Log on as an Administrator on the worker nodes and verify that the loader-factory-
version.jar file is installed to applicable directories:
tdh234m1:~ # ls /usr/lib/presto/lib/plugin/qgplugin/loader-factory-version.jar
When completing the Presto connector installation on systems with Viewpoint 16.20, if you do not want
to provide SSH credentials in the QueryGrid portlet, use the following procedure to:
• Run an installation script that uses presto-admin to unpack and distribute the loader-factor-
version.jar file to the worker nodes.
Note:
After the JAR files are successfully installed, Presto restarts.
Note:
As of QueryGrid 2.06, the presto qgremote and qginitiator JAR files are combined in the
loaderfactory JAR file.
For example:
tdh234m1:~ # cd /opt/teradata/tdqg/connector/tdqg-presto-connector/
02.07.00.00/bin
3. Run ./install.sh.
The script deploys the .jar files to the /usr/lib/presto/lib/plugin directory and invokes the
presto-admin utility to restart Presto.
4. Verify successful execution of the install.sh script as indicated by lack of displayed errors.
5. [Optional] Verify that the loader-factory-version.jar file is installed to applicable directories:
tdh234m1:~ # ls /usr/lib/presto/lib/plugin/qgplugin/loader-factory-version.jar
You define catalog properties for the Presto connector in a properties file that is manually created and
edited. This is different than the Teradata connector properties, which are defined using the QueryGrid
portlet.
The Presto catalog properties file references a data source and maintains the set of properties
associated with that data source connector. You can have one or more catalogs per connector. The
Presto connector can have multiple initiator catalogs, one for each link and version pair. The catalog
properties file is analogous to the CREATE FOREIGN SERVER statement for the Teradata connector.
After manually editing the file, you must restart the Presto server for the new configuration to take effect.
Do the following to configure the Presto catalog properties file:
1. Log on as an Administrator to the master node of the Hadoop cluster where Presto is installed.
2. Create and edit an initiator catalog properties file: ~/.prestoadmin/catalog/name.properties.
For example, create and edit a file named tdh234m1sdld0461_active.properties. Add the
following content to the file:
connector.name=qginitiator
qginitiator.linkName=tdh234m1sdld0461
qginitiator.version=active
3. Run presto-admin catalog add name to deploy the properties file on all nodes.
For example:
presto-admin catalog add tdh234m1sdld0461_active
4. Restart the Presto cluster.
Run:
presto-admin server restart
5. From Presto CLI use the SHOW CATALOGS command to verify the newly created properties file
exists.
Run:
tdh234m1:~ # presto-cli --server localhost:8090
presto:testuser> show catalogs;
Result:
Catalog
-------------------------
hive
qginitiator
qgremote
system
tdh234m1sdld0461_active
tpch
Complete these steps to verify a Presto-to-TargetConnector link (where TargetConnector is any type of
target connector). For example, for a Presto-to-Teradata link:
1. Log on as the Presto user to the Hadoop master node on which the Presto connector is installed.
2. Confirm setup of the Presto-to-TargetConnector link properties file by invoking the Presto CLI,
then running SHOW CATALOGS. For example, for a Presto-to-Teradata connector link:
tdh234m1:~ # presto-cli --server localhost:8090
presto> use hive.testuser;
presto:testuser> show catalogs;
The following output indicates that the Presto-to-Teradata link properties file
tdh234m1sdld0461_active is set up and recognized as a catalog by Presto:
Catalog
-------------------------
hive
qginitiator
qgremote
system
tdh234m1sdld0461_active
tpch
3. Retrieve all databases on a Teradata system by running SHOW SCHEMAS FROM <catalog_name>.
For example:
presto:testuser> show schemas from tdh234m1sdld0461_active;
The following output indicates retrieval of all databases including system databases that reside on
the target Teradata system:
Schema
-------------------------
PUBLIC
SQLJ
SYSBAR
…
testuser
…
Each type of Teradata QueryGrid connector uses different mechanisms for authenticating the local user
on the remote system.
Presto supports Kerberos authentication and LDAP. Presto user credentials are stored in the Username
and Password properties in the connector or link settings in Teradata QueryGrid. For information about
setting Username and Password in the QueryGrid portlet, see Presto Connector and Link Properties
and Adding a Connector.
Apache Sentry support has been added starting with Presto 208t. For information on setting up Presto
with Sentry, see https://docs.starburstdata.com/latest/security/sentry.html.
LDAP
A Presto target connector can be configured to use LDAP authentication.
For more information about setting up the Presto LDAP configuration, see Teradata Presto
Documentation available from http://www.info.teradata.com: Teradata for Hadoop > Teradata
Distribution of Presto > Teradata Distribution of Presto.
Currently, QueryGrid only supports simple LDAP authentication mechanism involving username and
password. The Presto target connector sends a username and password to the internal coordinator
code, and it validates these credentials using an external LDAP service. Both Active Directory and Open
LDAP are supported. Presto requires Secure LDAP (LDAPS), so make sure you have TLS enabled on
your LDAP server. Presto documentation on how to configure Presto to enable LDAP authentication
over HTTPs can be found at http://teradata.github.io/presto/docs/current/security/ldap.html.
The following property settings are required for Presto target connectors using the LDAP security model.
Setting Description
Port Set to the HTTPS server port, or to the value of the http-server.https.
port value in the presto config.properties file.
SSL Trust or Key Store Set to the Java trust store or Key Store absolute path.
Path
SSL Trust or Key Store Set to the password for the Java trust store or Key Store file you entered
Password into the SSL Trust or Key Store Path property.
Kerberos
You can set up QueryGrid to use Kerberos authentication with the Presto target connector; it uses two
forms of authentication with Kerberos:
Username/Password
The Presto target connector authenticates the username and password against Kerberos
before sending the query to the data source.
Kerberos Keytab
Presto can be configured to enable Kerberos Keytab authentication.
When using Kerberos authentication, a principal can be authenticated using a username and password
or a Keytab file. Presto Kerberos setup instructions can be found at http://teradata.github.io/presto/
docs/current/security/server.html. The driver node on the remote server establishes Kerberos
authentication; the Presto connector is configured with the location of the needed file.
The following property settings are required for Presto target connectors using the Kerberos security
model.
Setting Description
Port Set to the HTTPS server port, or to the value of the http-server.https.
port value in the presto config.properties file.
Password Set only if the Kerberos principal should be authenticated using a password.
Setting Description
Realm Set to the Kerberos realm if the Kerberos principal in the username property
does not already contain the realm.
Keytab Set to absolute path of Keytab file only if the Kerberos principal should be
authenticated using Keytab.
Note:
If both the Password and Keytab connector properties contain values,
then the Password setting takes precedence.
SSL Trust or Key Set to the Java trust store or Key Store absolute path.
Store Path
SSL Trust or Key Set to the password for the Java trust store or Key Store file you entered
Store Password into the SSL Trust or Key Store Path property.
For more information about setting up the Presto Kerberos configuration, see Teradata Presto
Documentation available from http://www.info.teradata.com: Teradata for Hadoop > Teradata
Distribution of Presto > Teradata Distribution of Presto.
HTTPs must be configured for LDAP or Kerberos enabled Presto clusters. See https://
teradata.github.io/presto/docs/current/security/tls.html.
Kerberos Maintenance
You must update the configuration of Teradata QueryGrid if the name or location of the default Kerberos
realm or the location of the host for your KDC (Key Distribution Center) or administration server
changes.
For Presto queries, QueryGrid creates tables with no data under the temporary database. Users require
CREATE TABLE and DROP TABLE access to the temporary database when running Teradata initiator
FOREIGN TABLE or EXPLAIN queries.
For detailed information about configuring the Teradata Distribution of Presto, see the related
documentation available from http://www.info.teradata.com: Select Teradata for Hadoop > Teradata
Distribution of Presto > Teradata Distribution of Presto.
make model
------ --------------------
Buick Century
Buick Enclave
Where QG_TD1 is the catalog used to reference the Presto-to-Teradata link. DB1 is the database or
schema name on the remote system, and TD_CARDATA is the table on the remote system.
You can use Presto to export data to a remote system by using an INSERT statement to place data into
an existing table. The remote table can be empty or it can contain data. If the remote table already
contains data, the exported data is appended to the existing table.
QG_TD1 is the catalog used to reference the Presto-to-Teradata link, DB1 is the Teradata Database, and
TD_CARDATA is the table to insert to on Teradata Database.
The Presto SHOW statement provides the details of schemas/databases, tables, and table columns on
local or remote systems. The SHOW CATALOGS statement lists the contents of the Presto catalog. The
following statements are available:
• SHOW SCHEMAS FROM <catalog_name>;
• SHOW TABLES FROM <catalog_name>.<schemaname>;
• SHOW COLUMNS FROM <catalog_name>.<schemaname>.<tablename>;
• SHOW CATALOGS;
• DESCRIBE <catalog_name>.<schema_name>.<tablename>;
The Presto DESCRIBE statement is an alias for the Presto SHOW COLUMNS statement and returns
the same information.
The Presto SHOW statement is equivalent to the HELP FOREIGN statement used when Teradata is
the initiator. For more information, see Examples of Using HELP FOREIGN.
Note:
The Presto DESCRIBE <catalog_name>.<schema_name>.<tablename> statement can be used
instead of SHOW COLUMNS.
Result:
Catalog
----------------
hive
qginitiator
qgremote
system
QG_TD1
tpch
Note:
The Presto-to-Teradata catalog called QG_TD1 is listed as well as the rest of the registered
catalogs.
Option Description
4. To override the Presto connector property during a Presto session, use the syntax in the following
example.
set session p2p_active.override =
‘<prop1>=<overrideVal1>;<prop2>=<overrideVal2>;…’;
For example:
SET SESSION p2p_active.override='responsetimeout =
3000000;linkBufferCount=3;';
presto:default> show session;
Name | Value |Default
--------------------+---------------------------------------------+-------
p2p_active.override| responsetimeout = 3000000;linkBufferCount=3; |
| Type |
+-----------------------------------------------------------------------
|varchar|Properties to override for QG connector. Of form [name]=[value];
---------------
[name]=[value];
5. [Optional] To clear Presto connector property overrides without closing a Presto session, use the
syntax in the following example.
reset session p2p_active.override;
When you query a remote system that runs a target connector that is a different platform from the local
system (initiator) connector, data is converted to satisfy the target database requirements. Even when
the initiator and target connectors are the same, the data is still transformed because the host formats
might be different from each other.
It is important to note the following information about data types:
• The mapping for some data types may not preserve the data in all cases, so be aware that with
some queries, data loss can occur.
As an example, the import of data from Presto with an unlimited VARCHAR size into a limited
Teradata VARCHAR column requires truncation and thus, data loss.
As another example, if you export a Teradata byteint data type as a Boolean and then import it
again, the data may not be the same. This can occur because the Boolean zero or one is imported
while the byteint may have contained other values beyond zero or one.
• If a data type is unsupported on the remote system, and the metadata information retrieved contains
a global type that is not supported on the initiator system, an error is returned from the initiator. For
SELECT * queries with a column containing an unsupported data type, the unsupported column
causes the entire query to return an error. In this case the query must include only the supported
columns in the select list.
• All time-related data types are in UTC.
Note:
Global Data Types denoted with an asterisk (*) are only available with Teradata Database 16.20
Feature Update 1 and later.
G_Array Array
G_Bigint Bigint
G_Blob Varbinary
G_Boolean Boolean
G_Byte Varbinary
G_ByteInt Tinyint
G_Char_UTF8 Char(n)
G_Char_UTF16 Char(n)
G_Clob_UTF16/Latin Varchar
G_Date Date
G_Decimal Decimal
G_Double Double
G_Float Real
G_Integer Integer
G_Longvargraphic Varchar(n)
G_Number Decimal
G_Row Row
G_SmallInt Smallint
G_STGeometry * Varchar
G_Time Time
G_Timestamp Timestamp
G_Varchar_Latin Varchar(n)
G_Varchar_UTF8 Varchar(n)
G_Varchar_UTF16 Varchar(n)
G_Varchargraphic Varchar(n)
G_XML * Varchar
Array G_Array
Bigint G_BigInt
Boolean Boolean
Char(n) G_Char_UTF16
Date G_Date
Decimal G_Decimal
Double G_Double
Integer G_Integer
Json G_Json
Map G_Map
Row G_Row
Smallint G_SmallInt
Time G_Time
Timestamp G_TimeStamp
Tinyint G_Tinyint
Varbinary G_Blob
Varchar G_Clob_UTF16/Latin
Varchar(n) G_Varchar_UTF16
Note:
Teradata testing has found that Presto contains the exchange.http-client.max-content-length
property which needs to be set high enough for Presto to transfer a large data page. There is a
known limit in current Presto release which limit CLOB and BLOB data to 1.7GB.
After data has been exported and committed to a remote system, any subsequent errors or aborts
on the local system do not roll back the remote request.
• Presto does not support roles and access control unless Sentry is enabled.
• Teradata QueryGrid does not support TimeWithTimeZone and TimestampWithTimeZone data types
with Presto connectors.
• When using the Explain command with a Presto initiator connector, remote query and execution plan
data is not returned.
• The default for Timestamp precision is three (3); Teradata QueryGrid truncates data with more than
three decimal places.
• When using Predicate pushdowns, Array, Time, TimeWithTimeZone, Timestamp, and
TimestampWithTimeZone data types are not pushed down.
Note:
Properties may be available for initiating connectors only, target connectors only, or both.
Overridable? Connector
Name Default Description
Property Name Type
Overridable? Connector
Name Default Description
Property Name Type
Connection 86400 The maximum idle time for the connection Target
Max Idle Time seconds cache object, after which the object is closed
and removed from the cache. Use this
property when there are multiple concurrent
users and queries running on the system
that might lead to starvation of connection
objects.
Valid values are 1–86400 seconds.
Custom JAR None Specifies the path or paths to use for .jar Target
Path files not listed in Hadoop JAR Files. Enter
paths in a comma-separated list. See
Configuring the Hive Connector for Use with
a Custom Hadoop Library Path or Custom
JAR Path.
Overridable? Connector
Name Default Description
Property Name Type
Default Binary 64000 The default truncation size for the ● Target
Size bytes VARBINARY types. defaultBinarySize
Valid values are 1–2097088000 bytes.
This is for a Teradata-to-Hive link and is used
by the target Hive connector and is
applicable when the initiating Teradata
Database does not support BLOB data types
with QueryGrid. With BLOB support, the
default binary size is not used.
Overridable? Connector
Name Default Description
Property Name Type
Knox Context None Knox context path for HS2, for example, Target
Path gateway/mycluster/hive
Required only if Knox is used.
Overridable? Connector
Name Default Description
Property Name Type
Knox Gateway None Knox gateway host. The use of this property Target
Host indicates that Knox is enabled.
Required only if Knox is used.
Overridable? Connector
Name Default Description
Property Name Type
Queue Name None Name of the queue that submits the MR, ● Initiator,
Tez (HDP only), or Spark (CDH only) job. queueName Target
Role Support False Enable user role support for the target ● Target
system. roleSupport
When set to true, the user role from the
initiator or target is applied to the target
system based on role mapping, if any. If the
cluster is configured to support roles, errors
are returned back to the user. If the cluster
is not configured to support roles, the user
role is not applied.
When set to false, roles are not applied to
the target system.
Spool File Path /var/opt/ Local path to use for spool files if the fabric Both
teradata/ is enabled to support Hive Task Retries.
tdqg/fabric
/data/
Overridable? Connector
Name Default Description
Property Name Type
Note:
When a custom path is specified, the
specified directory must be present on all
Hadoop data nodes configured in a
QueryGrid cluster. The directory must have
read, write, and execute permissions to
create, read, and write files and sub
directories for the querygrid OS group and
the tdqg OS user.
SSL Key Store None Specifies the SSL password when SSL is Target
Password enabled for hiveserver2.
• For CDH, you must provide the SSL
password.
• For HDP, the Hive connector loads the SSL
password from hive-site.xml. You can
use this property to specify a different
password.
SSL Key Store None Used to specify the key store path where Target
Path the SSL username and password are
stored when SSL is enabled for
hiveserver2.
• For CDH, you must provide the SSL path.
• For HDP, the Hive connector loads the SSL
path from hive-site.xml. You can use
this property to specify a different path.
Support Hive False When set to true, the fabric is enabled to Both
Task Retries support Hive Task Retries. When enabled,
the fabric does not fail on the query when
Hive tasks are retried. Instead, it discards
the data received from a failed task attempt
and continues to process task data from the
retried attempt.
Note:
This feature is only supported when Hive is
the data source, where Hive is importing
data as a target or exporting data as an
initiator, and the execution engine is mr or
tez.
Overridable? Connector
Name Default Description
Property Name Type
If you are using a Hive connector on a Cloudera implementation of Hadoop and want to enable logging,
you must change the primary group for Hive users to make sure QueryGrid infrastructure logging
functions work properly on CDH clusters.
If you are using a Hive connector on any Kerberized Hadoop cluster and want to enable logging, each
user corresponding to a Kerberos principal must also have the primary group of ‘hadoop’.
Note:
This task is only required if you want to enable logging.
The Hive Storage Handlers framework is used for the Teradata QueryGrid Hive initiator connector.
Storage handlers allow Hive to access data stored on other systems. A Hive table created using a
storage handler is referred to as a non-native table.
Hive storage handlers operate at the table level, so one non-native table must be created for each remote
table, unlike Teradata Foreign Servers and Presto Catalogs that operate at the database level.
The following steps provide an example of configuring a non-native table in order to use it with a Hive-
to-TargetConnector (where TargetConnector is any type of target connector).
1. Set the link properties for the Hive-to-Teradata link in the QueryGrid portlet.
See Hive Connector and Link Properties.
2. Log on to a Hive client such as Beeline and add hive-loaderfactory JAR to the class path:
Note:
The last approach typically requires a Hive restart. If you are using a Cloudera implementation
of Hadoop and Sentry is enabled, this may be the only option available for use because Sentry
does not allow use of ADD JAR commands.
3. Use a Hive storage handler to create the non-native table. For example:
CREATE EXTERNAL TABLE cardata_remote
ROW FORMAT SERDE 'com.teradata.querygrid.qgc.hive.QGSerDe'
STORED BY'com.teradata.querygrid.qgc.hive.QGStorageHandler'
TBLPROPERTIES (
"link"="hive_to_td_link",
"version"="active",
"table"="ut1.cardata");
There is no column definition in the CREATE TABLE statement because the column definition is
inferred dynamically by the Serializer and Deserializer (SerDe).
The table property clause contains the fully-qualified name of the remote table; for example,
database.schema.table, schema.table, and table. If any part is omitted, default values (specified in
connector properties) are used.
Note:
There is no connector installation option as of QueryGrid 2.05.
If you are using a Hive connector on a Cloudera Distribution for Hadoop (CDH) implementation, there
is a reported bug on CDH 5.7.
Note:
If you are using any CDH implementation with Sentry enabled, you must also perform this task
because Sentry does not allow use of ADD JAR commands.
1. To resolve the bug, add the following to the class path for the Hive connector:
/opt/teradata/tdqg/connector/tdqg-hive-connector/version/lib/hive-
loaderfactory-version.jar
You can add the syntax in multiple ways, such as modifying HIVE_AUX_JARS_PATH.
2. If required, restart Hive.
Configuring the Hive Connector for Use with a Custom Hadoop Library
Path or Custom JAR Path
If you installed Hadoop with a custom library path or stored any Hadoop .jar files listed in Hadoop JAR
Files outside of the default Hadoop library, you must manually configure the Hive connector with the
custom path for any files that do not reside in the default Hadoop library path.
If you need to add .jar files not listed in Hadoop JAR Files, you can manually configure the Hive
connector to specify which path to use to find the .jar files.
Note:
This only affects the target Hive connector configuration and any files outside the default Hadoop
path.
1. Use the procedures in Editing a Connector or Editing a Link to enable either the Hadoop Library
Path property or Custom JAR Path property, or both properties.
2. Do one or both of the following:
• In the Hadoop Library Path NVP, use comma-separated values to enter the custom library
path or paths for all required .jar files not in the default Hadoop library path. If a custom path
is provided, the default path is not used.
/usr/hdp/2.6.5.0-292/hive-hcatalog/share/hcatalog/,/usr/hdp/2.6.5.0-292/
hadoop-hdfs/,/usr/hdp/2.6.5.0-292/hadoop-mapreduce
• In the Custom JAR Path NVP, use comma-separated values to enter the paths for additional,
custom JARs not listed in Hadoop JAR Files reside.
/lib, /user/lib
Name
commons-cli.jar
commons-collections.jar
commons-configuration.jar
commons-io.jar
commons-logging.jar
curator-client.jar
curator-framework.jar
gson.jar
hadoop-auth.jar
hadoop-common.jar
hadoop-mapreduce-client-common.jar
hadoop-mapreduce-client-core.jar
hive-exec.jar
hive-jdbc-.*-standalone.jar
log4j.jar
slf4j-api.jar
xerceslmpl.jar
zookeeper.jar
To access the application ID of a Hadoop job in the Hive connector log or exception message, you
must enable operation log in your Hadoop cluster. This is not a required Hive target connector task.
1. Set hive.server2.logging.operation.enabled = true in the Hive configuration.
2. Confirm the operation log path provided in hive.server2.logging.operation.log.location
exists on all nodes where hiveserver2 is running.
Complete these steps to verify a Hive-to-TargetConnector link (where TargetConnector is any type of
target connector).
1. Make sure you have completed all steps described in Configuring a Non-Native Table for a Hive-to-
Target Connector.
2. Run DESCRIBE <table>, where <table> is the non-native table you created and configured.
3. Verify the result.
For example:
General
When setting parameters for Hive target connectors in NVP link pairings, make sure the setting of the
Conf File Paths property has the correct pathname correct value. QueryGrid heavily depends on this
setting when processing data transfers. See Hive Connector and Link Properties.
Kerberos
You can set up QueryGrid to use Kerberos authentication with a Hive target connector. It uses two forms
of authentication with Kerberos:
Username/Password
The Hive target connector authenticates the username and password against Kerberos before
sending the query to the data source.
Username/Keytab
Hive can be configured to enable Kerberos Keytab authentication.
If you are using a Hive target connector in an NVP link pairing to access a Kerberized Hadoop cluster:
• Select Kerberos for the Authentication Mechanism property.
• Set it to HS2 Only if only the HiveServer2 is secured (for example, LDAP/CUSTOM/PAM). This is
not a common setup.
• Verify that the Teradata QueryGrid (tdqg) user has permission to run kinit. See Verifying
Permission to Run kinit.
Setting Description
Setting Description
To retrieve metadata from the Hive metastore during a session, a temporary view must be created in
the default or temporary database specified in the Hive connector property Temporary Database Name
(tempdb). Temporary views are created with limit 0 so no one can use the temporary views to access
data during the short period of time the temporary view exists. Users require CREATE VIEW and DROP
VIEW access to the default or temporary database.
If you are using a Hive target connector to access a Kerberized Hadoop cluster, verify that the Teradata
QueryGrid user has permission to run kinit.
1. Log in to a master node.
2. Type the following:
su tdqg
3. Type the following:
kinit <username>
4. Log in to beeline with the same Hive principal.
Note:
Failure to replace the old .jar files can render the upgraded Hive connector unusable.
The example shows the Hive initiator connector using the DESCRIBE statement to fetch and display
metadata from a non-native remote table.
Result:
+-----------+----------------+--------------------+--+
| col_name | data_type | comment |
+-----------+----------------+--------------------+--+
| price | double | from deserializer |
| mileage | bigint | from deserializer |
| make | varchar(2048) | from deserializer |
| model | varchar(2048) | from deserializer |
| trim1 | varchar(2048) | from deserializer |
| type1 | varchar(2048) | from deserializer |
| cylinder | int | from deserializer |
| liter | double | from deserializer |
| doors | int | from deserializer |
| cruise | tinyint | from deserializer |
| sound | tinyint | from deserializer |
| leather | tinyint | from deserializer |
| dt | varchar(2048) | from deserializer |
| country | varchar(2048) | from deserializer |
+-----------+----------------+--------------------+--+
14 rows selected (0.877 seconds)
The example shows Hive initiating an EXPLAIN request to a Teradata target connector.
Result:
+--------------------------------------------------------------------------------
------+--+
| STAGE DEPENDENCIES:
| Stage-1 is a root stage
| Stage-0 depends on stages: Stage-1
|
| STAGE PLANS:
| Stage: Stage-1
| Map Reduce
| Map Operator Tree:
| TableScan
| alias: cardata_remote
| Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column
stats: NONE
| Select Operator
| expressions: price (type: double), mileage (type: bigint),
| make (type: varchar(2048)), model (type: varchar(2048)),
| trim1 (type: varchar(2048)),
| type1 (type: varchar(2048)),
| cylinder (type: int),
| liter (type: double),
| doors (type: int),
| cruise (type: tinyint),
| sound (type: tinyint),
| leather (type: tinyint),
| dt (type: varchar(2048)),
| country (type: varchar(2048))
| outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6,
| _col7, _col8, _col9, _col10, _col11, _col12, _col13
| Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column
stats: NONE
| File Output Operator
| compressed: false
| Statistics: Num rows: 1 Data size: 0 Basic stats: PARTIAL Column
stats: NONE
| table:
| input format: org.apache.hadoop.mapred.TextInputFormat
| output format:
org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
| serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
|
| Stage: Stage-0
| Fetch Operator
| limit: -1
| Processor Tree:
| ListSink
|
+--------------------------------------------------------------------------------
------+--+
You can export data to a remote system by using an INSERT statement to place data into an existing
table. The table can be empty or it can contain data. If the table already contains data, the exported data
is appended to the existing table.
Result:
Hive SELECT queries with Hive as the initiator are used to import data from a target data source into
Hive. Teradata QueryGrid supports Beeline to use for Hive initiator queries.
The Hive connector supports predicate pushdown by default. Predicate pushdown can be disabled by
setting the disablePushdown property to TRUE.
jdbc:hive2://localhost:10000> SELECT
cardata_target.price,cardata_target.mileage,
cardata_target.make, cardata_target.model FROM cardata_target WHERE price <
10000;
Result:
+----------------------+------------------------+---------------------
+--------------+
|cardata_target.price|cardata_target.mileage|cardata_target.make|
cardata_target.model|
+----------------------+------------------------+---------------------
+--------------+
| 8638.930895 | 25216 | Chevrolet | AVEO |
| 9482.219404 | 24842 | Chevrolet | AVEO |
| 8768.998585 | 35299 | Chevrolet | AVEO |
| 9665.84886 | 19565 | Chevrolet | AVEO |
| 9563.789309 | 19273 | Chevrolet | AVEO |
| 9720.97889 | 20836 | Chevrolet | AVEO |
| 9954.054174 | 37345 | Chevrolet | AVEO |
| 9654.060142 | 19183 | Chevrolet | AVEO |
| 9919.048185 | 34621 | Chevrolet | AVEO |
The following SHOW statements are available when Hive is the initiating connector:
• SHOW CREATE TABLE <table>; Display the complete CREATE TABLE statement of the
specified table.
• SHOW COLUMNS FROM|IN <table>; Describes the column information for the specified remote
table.
The Hive SHOW statement is equivalent to the HELP FOREIGN statement that is used when Teradata
is the initiator. See Examples of Using HELP FOREIGN.
Result:
+----------------------------------------------------------+--+
| createtab_stmt |
+----------------------------------------------------------+--+
| CREATE EXTERNAL TABLE `cardata_remote`( |
| `price` double COMMENT 'from deserializer', |
| `mileage` bigint COMMENT 'from deserializer', |
| `make` varchar(2048) COMMENT 'from deserializer', |
| `model` varchar(2048) COMMENT 'from deserializer', |
| `trim1` varchar(2048) COMMENT 'from deserializer', |
| `type1` varchar(2048) COMMENT 'from deserializer', |
| `cylinder` int COMMENT 'from deserializer', |
| `liter` double COMMENT 'from deserializer', |
| `doors` int COMMENT 'from deserializer', |
| `cruise` tinyint COMMENT 'from deserializer', |
| `sound` tinyint COMMENT 'from deserializer', |
| `leather` tinyint COMMENT 'from deserializer', |
| `dt` varchar(2048) COMMENT 'from deserializer', |
| `country` varchar(2048) COMMENT 'from deserializer') |
Option Description
Option Description
e. Find the Hive link property you want to override and click the
Overridable check box.
f. Click OK.
g. Click Save.
4. To override the Hive connector property during a Hive session, use the syntax in the following
example.
SET <databaseName>.<nonNativeTableName>.override = responsetimeout = 3000000,
linkBufferCount=3;
5. [Optional] To override hadoopProperties when using the Hive connector and it is designated as
overridable in the QueryGrid portlet, use the pipe (|) symbol to split Hadoop properties and a colon
(:) to split name value pairs.
The following example is used to override hadoopProperties during either a Hive or Presto session
targeting a Hive connector:
SET <databaseName>.<nonNativeTableName>.override = linkbuffersize=100000,
DEFAULTSTRINGSIZE=32000, hadoopProperties=name1:value1 | name2:value2 ;
The following example is used to override hadoopProperties during a Teradata Session targeting a
Hive connector:
SET FOREIGN SERVER ATTR = 'servername= hiveserver1;
hadoopproperties=name1:value1|name2:value2;' FOR SESSION VOLATILE
6. [Optional] To clear Hive connector property overrides without closing a Hive session, use the syntax
in the following example.
SET <databaseName>.<nonNativeTableName>.override = ;
When you query a remote system that runs a connector that is a different platform from the local system
connector, data is converted to satisfy the target database requirements. Even when the initiator and
target connectors are the same, the data is still transformed because the host formats might be different
from each other.
It is important to note the following information about data types:
• The mapping for some data types may not preserve the data in all cases, so be aware that with
some queries, data loss can occur.
As an example, the import of data from Presto with an unlimited VARCHAR size into a limited
Teradata VARCHAR column requires truncation and thus, data loss.
As another example, if you export a Teradata byteint data type as a Boolean on Hive and then
import it again, the data may not be the same. This can occur because the Boolean zero or one is
imported while the byteint may have contained other values beyond zero or one.
• If a data type is unsupported on the remote system, and the metadata information retrieved contains
a global type that is not supported on the initiator system, an error is returned from the initiator. For
SELECT * queries with a column containing an unsupported data type, the unsupported column
causes the entire query to return an error. In this case the query must include only the supported
columns in the select list.
• All time-related data types are in UTC.
Note:
Global Data Types denoted with an asterisk (*) are only available with Teradata Database 16.20
Feature Update 1 and later.
G_Array Array
G_BigInt Bigint
G_Blob Binary
G_Boolean Boolean
G_Byte Binary
G_ByteInt Tinyint
G_Char_Latin Char
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Char_UTF16 Char
G_Clob_Latin String
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Clob_UTF16 String
G_Date Date
G_Decimal Decimal
G_Double Double
G_Float Float
G_Integer Integer
G_Map Map
G_Number Decimal
G_Row Struct
G_STGeometry * String/Varchar
G_SmallInt Smallint
G_TimeStamp Timestamp
G_Varbyte Binary
G_Varchar_Latin Varchar
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Varchar_UTF16 Varchar
G_XML * String/Varchar
array G_Array
bigint G_BigInt
binary G_Blob
boolean G_Boolean
char G_Char_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
char G_Char_UTF16
date G_Date
decimal G_Decimal
double G_Double
float G_Float
integer G_Integer
map G_Map
smallint G_SmallInt
string G_Clob_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
string G_Clob_UTF16
struct G_Row
timestamp G_TimeStamp
tinyint G_ByteInt
varchar G_Varchar_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
varchar G_Varchar_UTF16
Note:
Properties may be available for initiating connectors only, target connectors only, or both.
16.20+ LOB Support True On Teradata Databases version 16.20 and later, the STRING and BINARY columns on Spark SQL are mapped to CLOB and BLOB ● Target
by default. Unselect this option to map the STRING and BINARY columns to VARCHAR and VARBYTE, respectively. lobSupport
Compression Codec System Default Compression type to use when exporting to a Spark target table. Valid values are System Default, Deflate, BZip2, GZip, LZ4, and ● Target
Snappy. compressionCodec
Conf File Paths /etc/hadoop/ Paths to core-site.xml , hdfs-site.xml , and hive-site.xml (if available) in a comma-separated list. Target
conf/,
/etc/spark2/
conf
Connection Evict 30 minutes Frequency of eviction checks. Connection objects from the pool are checked, closed, and removed if the idle time (current time - last time of Target
Frequency use) of a connection object is greater than the Connection Max Idle Time setting.
Reduce the time between checks if there are multiple concurrent users running queries to clear the connections more frequently.
Valid values are 1–1440 minutes.
Connection Max Idle 86400 seconds The maximum idle time for the connection cache object, after which the object is closed and removed from the cache. Use this property when Target
Time there are multiple concurrent users and queries running on the system that might lead to starvation of connection objects.
Valid values are 1–86400 seconds.
Connection Pool Size 100 Maximum number of connection objects that can be stored in a connection pool. When acquiring a new connection, the connector checks Target
for an available space in the pool. If no space is available in the connection pool, the connection fails after 5 minutes. Only one connection
pool and username per connector configuration is allowed.
Valid values are 1–10000.
Database Name Default Name of the database for the connector, if not provided in the user query. ● Target
Maximum name length is 255 characters. databaseName
Default Binary Size 64000 bytes The default truncation size for the VARBINARY types. ● Target
Valid values are 1–2097088000 bytes. defaultBinarySize
This is for a Teradata-to-Spark link and is used by the target Spark connector and is applicable when the initiating Teradata Database does
not support BLOB data types with QueryGrid. With BLOB support, the default binary size is not used.
Default String Size 32000 The VARCHAR truncation size. This is the size at which data imported from or exported to string columns is truncated. The value ● Target
characters represents the maximum number of Unicode characters to import, and defaults to 32000 characters. Teradata QueryGrid truncates defaultStringSize
the string columns at the default value set in defaultStringSize.
Valid values are 1–1048544000 characters.
This is for a Teradata-to-Spark link and is used by the target Spark connector and is applicable when the initiating Teradata Database does
not support CLOB data types with QueryGrid. With CLOB support, the default string size is not used.
Disable Pushdown False When set to true, disables the pushdown of all query conditions to the target system. ● Initiator
disablePushdown
Certain system-level, session-level, and column-level query attributes, such as CASESPECIFIC, can affect character string comparison
results. These attributes can cause some queries to return incorrect results due to incorrect row filtering on the target system.
To avoid incorrect results caused by condition pushdown in situations where the settings on the initiating system do not match the settings
on the target system, you can disable the pushdown of all conditions to the target system.
If designated as Overridable, this property can only be overridden at the session level from false to true (indicating you are disabling
pushdown), but cannot be changed from true to false.
Enable Logging INFO Runs queries with debugging mode enabled. Initiator, Target
Valid values are NONE, WARN, INFO, and DEBUG.
Hadoop Properties None Specifies Hadoop environment properties for a user session. Properties are provided in a list. Use = between each property and its ● Target
value (name=value, name=value, name=value), and a comma as a separator between properties, with or without a space after the hadoopProperties
comma.
For example:
mapred.job.queue.name=abcdef,mapreduce.task.timeout=3600000,mapreduce.map.speculative=false
If Hadoop Properties is not selected, the default Hadoop environment properties are used.
Keytab None Absolute path to the Kerberos keytab file. QueryGrid only uses the keytab file for authentication if a username and password is not Target
provided.
Link Buffer Count 4 Maximum number of write buffers available on a single channel at one time. ● Initiator, Target
Note: linkBufferCount
Link Buffer Count overrides the default internal fabric property shmDefaultNumMemoryBuffers.
Link Buffer Size 1048576 Maximum size of the write buffers to allocate for row handling and message exchange. ● Initiator, Target
Valid values are 73728–10485760 bytes. linkBufferSize
Link Handshake 30000 Handshake and ACK timeout in milliseconds for the shared memory channel setup. Initiator, Target
Timeout Valid values are 60000–86400000.
Link Heartbeat 3600000 Maximum interval in milliseconds for the heartbeat signal on a channel between the connector and the fabric instance, used for health Initiator, Target
Interval check status. Tunable for diagnostic purposes only.
Note:
This interval should be greater than Link Handshake Timeout.
Number Executors None Unit of parallelism when data is exported or imported into Spark SQL. ● Initiator, Target
numExecutors
Response Timeout 86400000 Number of milliseconds to wait for the final data exec response when all the data has been transferred. ● Initiator, Target
Valid values are 1800000–172800000. responseTimeout
Server None Used to connect to the target database as part of the JDBC connection string. This is the IP address or DNS name of the target host. Target
Spark Resource YARN Resource Manager used by the Spark platform. Possible values are YARN and standalone. Both
Manager
Spark Monitoring localhost:8080 One or more Host/IP:Port combinations for the Spark Monitoring REST Servers. Initiator
REST Servers
Spark Home Path /usr/hdp/current/ Filepath to the Spark home directory where the /jars sub-directory resides containing all the Spark library .jar files. Target
spark2-client/
Spark Execution Spark Thrift Mechanism used by the target connector to submit queries to Spark. Possible values are Spark Thrift Server and Spark Application. Target
Mechanism Server
Temporary Database Default Temporary database name for storing temporary tables and views. ● Target
Name tempDbName
Username Hive Name of the user. A username added for a connector or target connector link must be included in Allowed OS users. Target
Maximum length is 255 characters.
This NVP is saved in the Teradata QueryGrid Manager configuration and is required when the initiator does not support a mechanism to
provide user credentials. The username is also used for connectivity diagnostic checks.
Write Timeout 3600000 Number of milliseconds to wait to write between data packets when exporting data messages. ● Initiator, Target
Valid values are 300000–86400000. writeTimeout
Note:
The permission 777 is an example, actual permissions are determined by the Hadoop
administrator if the requirements to create the directory are met.
The supported client for interacting with the Spark SQL initiator is the Scala Read-Eval-Print-Loop
(REPL), referred to as the spark-shell. In order to use the Spark SQL initiator, spark-shell must be started
using the following JAR file:
• spark-loaderfactory
1. Log on to the node you want to start spark-shell.
Note:
On CDH clusters, only Spark 2.1 and later are supported. When using CDH clusters, use the
spark2-shell command name instead of spark-shell.
To enable logging for Spark SQL connector (initiator or target) users, the users must belong to the
'hadoop' group. In the case of a Kerberized Hadoop cluster, the same requirement applies to users
corresponding to Kerberos principals.
Note:
This task is only required if you want to enable logging.
The Data Sources API framework is used for the Teradata QueryGrid Spark SQL initiator connector.
Data Sources API allows Spark SQL to access data stored on other systems. A Spark SQL table created
using a Data Source API framework is referred to as a non-native table.
The Data Sources API operates at the table level by default, so one non-native table must be created
for each remote table, unlike Teradata Foreign Servers and Presto Catalogs that operate at the database
level. However, a Foreign Server Library has been included as part of the Spark SQL connector, which
addresses some of the limitations and inconveniences when working with non-native tables. Teradata
recommends that the Foreign Server Library be used to interact with the Spark SQL initiator and all
Spark SQL initiator examples in this section are based on the Foreign Server Library. For complete
details on the foreign server library, see Foreign Server Library API Reference for the Spark SQL Initiator
Connector.
The following steps provide an example of configuring a foreign server in order to use it with a Spark
SQL-to-TargetConnector (where TargetConnector is any type of target connector):
1. Set the link properties for the Spark SQL-to-Teradata link in the QueryGrid portlet.
See Spark SQL Connector and Link Properties.
2. Log on to Scala REPL, see Starting Scala REPL for more information.
3. Import the Foreign Server Library and create a foreign server object, for example:
scala> import tdqg.ForeignServer
import tdqg.ForeignServer
Spark Target
Description
Configuration
YARN using the Spark To enable user impersonation, the tdqg user must be able to impersonate
application other users. Add the following entry in core-site.xml to enable
impersonation:
<property>
<name>hadoop.proxyuser.tdqg.hosts</name>
<value>*</value>
</property>
<property>
<name>hadoop.proxyuser.tdqg.groups</name>
<value>*</value>
</property>
Spark Target
Description
Configuration
Standalone using the The target user, specified by user mapping, must be the same user who
Spark Thrift Server started the Spark Thrift Server.
Complete these steps to verify a Spark SQL-to-TargetConnector link (where TargetConnector is any
type of target connector).
1. Make sure you have completed all steps described in Configuring a Foreign Server for a Spark SQL-
to-TargetConnector.
2. Load the previously created foreign server if the spark-shell session is no longer active.
For example:
scala> s1.describe("test_nn_table")
+--------+---------+-------+
|col_name|data_type|comment|
+--------+---------+-------+
|number |int |null |
Note:
When a non-native table is created without specifying a database name (as in the above
example), the table is assumed to be temporary and automatically disappears once the current
session ends. In order to create a permanent non-native table, you must specify a database
name.
General
When setting parameters for Spark SQL target connectors in NVP link pairings, make sure the setting
of the Conf File Paths property has the correct pathname correct value. QueryGrid heavily depends
on this setting when processing data transfers. See Spark SQL Connector and Link Properties.
Kerberos
You can set up QueryGrid to use Kerberos authentication with a Spark SQL target connector. It uses
two forms of authentication with Kerberos:
Username/Password
The Spark SQL target connector authenticates the username and password against Kerberos
before sending the query to the data source.
Kerberos Keytab
Spark SQL can be configured to enable Kerberos Keytab authentication.
If you are using a Spark SQL target connector in an NVP link pairing to access a Kerberized Hadoop
cluster:
• Select Kerberos for the Authentication Mechanism property.
• Verify that the Teradata QueryGrid user has permission to run kinit. See Verifying Permission to
Run kinit.
If you are using a Spark SQL target connector to access a Kerberized Hadoop cluster, verify that the
Teradata QueryGrid user has permission to run kinit.
1. Log in to a master node.
2. Type the following:
su tdqg
3. Type the following:
kinit <username>
4. Log in to beeline with the same Hive principal.
Note:
Failure to restart the Spark Thrift Server can render the upgraded Spark connector unusable.
Note:
Before any part of the Foreign Server Library can be used, you must run the import
tdqg.ForeignServer statement.
Constructors
ForeignServer String Link Construct a new Foreign Server object using a QueryGrid link.
String
Version
String Name
Static Methods
dropForeignServer String Name Drop a specified Foreign Server as well as all its non-native
tables.
Instance Methods
showColumns String Table Display the schema of a target table specified by a fully-qualified
name (such as, schema.table or catalog.schema.table).
show String Name Display the CREATE TABLE statement of a non-native table
under this Foreign Server.
Note:
This only works for permanent non-native tables, and the
database must be part of the name.
create String Table Create a non-native table representing a target table (fully-
String Name qualified name) under this Foreign Server.
Note:
In order to create a permanent non-native table, the database
must be part of the name.
drop String Name Drop a non-native table under this Foreign Server.
Note:
For permanent non-native tables, the database must be part of
the name.
describe String Name Display the details of a non-native table under this Foreign Server.
Note:
For permanent non-native tables, the database must be part of
the name.
setSessionOverride String Set the connector properties to be overridden for the session.
Values Properties are case-insensitive and non-overridable properties
are ignored.
Example: setSessionOverride("linkbuffersize=100000,
numMappers=4")
Constructor
1. Create a new Foreign Server object with a unique name, such as:
Static Methods
Use the static methods to view or drop Foreign Servers as well as run SQL (SELECT/INSERT/EXPLAIN)
statements.
dropForeignServer
getDatasetFromSql
Use the getDataSetFromSql() method to perform a lazy execution of a SELECT query involving non-
native tables. For example:
The query result DataSet (res0 in the above example) is used like any other Spark SQL DataSet object
and is only evaluated when an action is called.
showForeignServers
scala> ForeignServer.showForeignServers
Listing all Foreign Servers
fs1
sql
Use the sql method to run SELECT, INSERT, and EXPLAIN SQL statements involving non-native
tables.
The following example shows Spark SQL initiating an EXPLAIN request to a Teradata target
connector.
scala> ForeignServer.sql("explain select name from default.nn1 where number =
10")
+------------------------------------------------------------------------------
------+
|plan
+------------------------------------------------------------------------------
------+
|== Physical Plan ==
*Project [name#25]
+- *Filter (isnotnull(number#24) && (number#24 = 10))
+- *Scan com.teradata.querygrid.qgc.spark.QGRelation@4ec78008
default.nn1[name#25,number#24] PushedFilters: [IsNotNull(number),
EqualTo(number,10)], ReadSchema: struct<name:string>|
+------------------------------------------------------------------------------
------+
scala> ForeignServer.sql("explain insert into default.nn1 select * from
players2")
+------------------------------------------------------------------------------
------+
|plan
+------------------------------------------------------------------------------
------+
|== Physical Plan ==
ExecutedCommand
+- InsertIntoDataSourceCommand Relation[number#24,name#25]
com.teradata.querygrid.qgc.spark.QGRelation@4ec78008,
OverwriteOptions(false,Map())
+- MetastoreRelation default, players2
+------------------------------------------------------------------------------
------+
You can export data to a remote system by using an INSERT statement to place data into an existing
table. The table can be empty or can contain data. If the table already contains data, the exported
data is appended to the existing table.
Spark SQL SELECT queries with Spark SQL as the initiator are used to import data from a target data
source into Spark SQL.
The Spark SQL connector supports predicate pushdown.
Instance Methods
Use the instance methods to discover remote metadata and manage non-native tables (permanent or
temporary) for a Foreign Server.
create
You can use the create method to create non-native tables (permanent or temporary) to represent
target tables. If the non-native table name is in the form of db.tb1 (default.nn1 in the example), a
permanent non-native table is created. If the database is not part of the non-native name, a temporary
non-native table is created (nn2 in the example). Temporary tables in Spark SQL only exist during the
current session and cannot be associated with a database.
The following example shows the Spark SQL initiator using the CREATE statement to create non-native
tables:
scala> s1.create("default.nn1","user1.players")
scala> s1.create("nn2","default.test")
describe
|col_name|data_type|comment|
+--------+---------+-------+
|c1 |string |null |
+--------+---------+-------+
drop
The drop method is used to drop a permanent non-native table from a foreign server. Note that
temporary non-native tables are dropped automatically once the current session ends.
scala> s1.drop("default.nn2")
show
The show() method can be called to view a catalog of all non-native table (permanent or temporary)
created under the current Foreign Server object (does not require connection to remote). If a permanent
non-native table name is passed to the show() method, then the complete CREATE TABLE statement
for that non-native table is displayed.
scala> s1.show
LINK: s2h.active
+-----------+--------------+------------+
|local_table|remote_table |is_temporary|
+-----------+--------------+------------+
|nn2 |default.test |true |
|default.nn1|user1.players |false |
+-----------+--------------+------------+
scala> s1.show("default.nn1")
+----------------------------------------------------------+
|createtab_stmt |
+----------------------------------------------------------+
|CREATE TABLE `default`.`nn1` (`number` INT, `name` STRING)
USING com.teradata.querygrid.qgc.spark
OPTIONS (
`serialization.format` '1',
`version` 'active',
`link` 's2h',
`table` 'user1.players'
) |
+----------------------------------------------------------+
showColumns
The show*() methods can be used for schema and metadata discovery queries and are equivalent to
HELP FOREIGN SERVER/DATABASE/TABLE queries on the Teradata Database. The showColumns
method displays the schema of a target table specified by a fully-qualified name (For example:
schema.table or database.schema.table).
scala> s1.showColumns("user1.players")
+--------+--------+-------+
|COL_NAME|COL_TYPE|COMMENT|
+--------+--------+-------+
|number |int | |
|name |string | |
+--------+--------+-------+
showSchemas
The show*() methods can be used for schema and metadata discovery queries and are equivalent to
HELP FOREIGN SERVER/DATABASE/TABLE queries on the Teradata Database. This method lists all
target schemas.
scala> s1.showSchemas
+-------------+
|DATABASE_NAME|
+-------------+
|default |
|user1 |
+-------------+
showTables
The show*() methods can be used for schema and metadata discovery queries and are equivalent to
HELP FOREIGN SERVER/DATABASE/TABLE queries on the Teradata Database. This method lists all
tables under a target schema.
scala> s1.showTables("user1")
+---------+
|TAB_NAME |
+---------+
|dummy |
|players |
+---------+
Option Description
4. [Optional] To override the Spark SQL connector property during a Spark SQL session for Foreign
Server s1, use the syntax in the following example.
s1.setSessionOverride("linkBufferSize=100000, numExecutors=4",
hadoopProperties=name1:value1 | name2:value2")
Note:
When overriding hadoopProperties, you must use the pipe (|) symbol to split Hadoop
properties and a colon (:) to split name value pairs, as shown in these examples.
The following example is used to override hadoopProperties during a Teradata Session targeting a
Hive connector:
When you query a remote system that runs a connector that is a different platform from the local system
connector, data is converted to satisfy the target database requirements. Even when the initiator and
target connectors are the same, the data is still transformed because the host formats might be different
from each other.
It is important to note the following information about data types:
• The mapping for some data types may not preserve the data in all cases, so be aware that with
some queries, data loss can occur.
As an example, the import of data from Spark SQL with an unlimited VARCHAR size into a limited
Teradata VARCHAR column requires truncation and thus, data loss.
As another example, if you export a Teradata byteint data type as a Boolean on Spark SQL and
then import it again, the data may not be the same. This can occur because the Boolean zero or
one is imported while the byteint may have contained other values beyond zero or one.
• If a data type is unsupported on the remote system, and the metadata information retrieved contains
a global type that is not supported on the initiator system, an error is returned from the initiator. For
SELECT * queries with a column containing an unsupported data type, the unsupported column
causes the entire query to return an error. In this case the query must include only the supported
columns in the select list.
• All time-related data types are in UTC.
Note:
Global Data Types denoted with an asterisk (*) are only available with Teradata Database 16.20
Feature Update 1 and later.
G_Array array
G_BigInt bigint
G_Blob binary
G_Boolean boolean
G_Byte binary
G_ByteInt tinyint
G_Char_Latin string
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Char_UTF16 string
G_Clob_Latin string
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Clob_UTF16 string
G_Date date
G_Decimal decimal
G_Double double
G_Float float
G_Integer integer
G_Map map
G_Number decimal
G_Row struct
G_SmallInt smallint
G_STGeometry * string
G_TimeStamp timestamp
G_Varbyte binary
G_Varchar_Latin string
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_
ASCII encoding.
G_Varchar_UTF16 string
G_XML * string
array G_Array
bigint G_BigInt
binary G_Blob
boolean G_Boolean
char G_Char_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
char G_Char_UTF16
date G_Date
decimal G_Decimal
double G_Double
float G_Float
integer G_Integer
map G_Map
smallint G_SmallInt
string G_Clob_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
string G_Clob_UTF16
struct G_Row
timestamp G_TimeStamp
tinyint G_ByteInt
varchar G_Varchar_Latin
Note:
Latin data type mapping is only for data types using ISO_8859_1 or US_ASCII
encoding.
varchar G_Varchar_UTF16
Important:
• The Oracle connector is a target connector only and cannot be used as an initiating connector.
• All Oracle target connector nodes must be driver nodes for communication and data transfer to
the Oracle system.
• Install the Oracle target connector on an edge or additional node and not on Oracle system
nodes.
The following are the minimum requirements for an Oracle target connector node to install the QueryGrid
2.0 software:
• 2 GB RAM
• SLES 11 / Redhat 6 or 7
• Memory requirements as defined in the fabric/connector setup
• CPU and JVM configuration for large dataset processing
• JAVA 8
Important:
The Oracle connector is only available as a target connector.
Overridable?
Name Default Description
Property Name
Collect Metrics False Collect query metrics from the Oracle Resource ●
Manager for QueryGrid metadata and run collectMetrics
queries.
Connection 86400 The maximum idle time for the connection cache
Max Idle Time seconds object, after which the object is closed and
removed from the cache. Use this property when
there are multiple concurrent users and queries
running on the system that might lead to
starvation of connection objects.
Valid values are 1–86400 seconds.
Overridable?
Name Default Description
Property Name
Enable Logging INFO Logging level for the connector or link properties.
User level log settings can be explicitly set
through the add or edit link page in the QueryGrid
portlet.
Valid values are NONE, WARN, INFO, and
DEBUG.
Fetch Size 1000 Number of rows JDBC can pull from a database ●
at a time. fetchSize
Valid values are 1–10000.
Overridable?
Name Default Description
Property Name
NNE Integrity Accepted Checksum level for data integrity (for NNE).
Level Valid values are Accepted, Rejected, Requested,
and Required.
NNE Integrity sha1, md5, Checksum algorithm for data integrity validation
Types SHA256, (for NNE).
SHA384,
SHA512
Overridable?
Name Default Description
Property Name
Role Support False Enable user role support for the target system. ●
When set to true, the user role from the initiator or roleSupport
target based on role mapping is applied to the
target system and any errors are returned back to
the user. When set to false, roles are not applied
to the target system.
Overridable?
Name Default Description
Property Name
1. Add user mapping when the Oracle database is using the OS user authentication on a local system.
For more information, see Adding a User Mapping.
2. Edit the following Teradata-to-Oracle link settings.
Settings Description
The Oracle connector supports role mapping with Teradata Database 16.20 Feature Update 1 and later.
Note:
The following role support features are not supported with the Teradata Oracle connector:
• Authenticating roles with passwords
• Comma-separated role lists in SET ROLE
• Except clause
Oracle connectors support authentication for database (DB Password), operating system (OS Auth),
encryption (SSL or NNE), and Kerberos security mechanisms when acting as target connectors. The
following considerations apply to each of the security mechanisms:
• The username and password assigned and communicated from the initiator connector takes
precedence over the one defined for the Oracle target connector properties.
For example, if the Teradata initiator provides an authorization object, the Teradata initiator settings
take precedence over security-related Oracle connector property settings. Defining these connector
properties is optional. However, if credentials are not provided by the initiator connector, a username
and password must exist in the connector property settings.
• An Administrator can define user mappings in the QueryGrid portlet if using the OS Auth
authorization.
• For user mapping, the local user submitting the query is mapped to the target user that submits the
query. User mapping is applicable when the Oracle database is set up with the OS Auth mechanism
and the target user is not the same as the authenticating user.
Authentication
Database
Oracle stores encrypted credential information and user passwords in the data dictionary to
authenticate users attempting to connect to the database.
The following property settings are required for Oracle target connectors using the DB
Password authentication.
Setting Description
Operating System
The operating system authentication option is only available with on-premises systems.
The following property settings are required for Oracle target connectors using the OS Auth
authentication. The Teradata Connector username takes precedent over the username and
password set in the Oracle connector properties.
Setting Description
Kerberos
Teradata Kerberos set up must be completed before configuring QueryGrid. The following
property settings are required for Teradata target connectors using the Kerberos security
model. The Teradata Connector username takes precedent over the username and password
set in the Oracle connector properties. Both password and keytab can be selected for
authentication, if both are provided, password takes precedence over keytab authentication.
Setting Description
Password [Optional] Set to the password for the Kerberos principal name.
QueryGrid authenticates a principal using a password.
SSL
SSL can be used to authenticate any client to any oracle database server that is configured to
communicate over SSL. SSL authentication can be used in conjunction with other
authentication methods like DB Password, Kerberos, and so on. The following connector
properties must be configured when setting up SSL.
Setting Description
SSL Authentication Set the type of authentication to use between the active and standby
servers using one of the following options:
• Server – only the server authenticates to the client
• Server and Client – both authenticate to each other
• Neither – only encryption is used, no authentication
Truststore Path Set the truststore certificate path sent by the server for verification.
Only available when SSL authentication is set to Server or Both.
Keystore Path Set the keystore certificate path sent by the client for verification. Only
available when SSL authentication is set to Server or Both.
Encryption
Oracle databases can be configured to support either secure sockets layer (SSL) or native network
encryption (NNE), but not both. For more information, refer to your Oracle user manuals.
SSL
SSL encrypted communication occurs between the Oracle client and the Teradata Database
instance. The following connector properties must be configured when setting up SSL.
Setting Description
SSL Authentication Set the type of authentication to use between the active and standby
servers using one of the following options:
• Server – only the server authenticates to the client
• Server and Client – both authenticate to each other
• Neither – only encryption is used, no authentication
Setting Description
SSL Server DN The Server Distinguished Name to match. When SSL authentication is
set to server or both , you can optionally choose to match the
distinguished name in addition to the server authentication.
Truststore Path Set the truststore certificate path sent by the server for verification. Only
available when SSL authentication is set to Server or Both.
Keystore Path Set the keystore certificate path sent by the client for verification. Only
available when SSL authentication is set to Server or Both.
NNE
NNE encryption allows data to be encrypted as the data moves back and forth from a database
instance.
Setting Description
NNE Encryption Set to the level of encryption behavior when a client, or server acting
Level as a client, connects to the database instance.
NNE Encryption List of encryption algorithms used by the database instance. The
Types algorithms are used in the listed order for decryption until one succeeds
or the end of the list is reached.
NNE Integrity Level Set to the level of data integrity when a client, or server acting as a
client, connects to the database instance.
When running schema discovery (Teradata-initiated help foreign) queries, the target information must
be retrieved from the Oracle data dictionary views. You must have access to the views in order to
successfully receive the results. When collect metrics is enabled, you must have access to the
Oracle performance view, V$SQL, to collect resource utilization data. To access tables with Varray type,
the user must have the SELECT_CATALOG_ROLE or SELECT ANY DICTIONARY grant to run the
query if Varray is not already defined in the accessible schema.
Select
The following examples use different SELECT commands on the Teradata system that are supported
by the Oracle target connector.
Select
SELECT CAST(Price AS DECIMAL (8,2))
, mileage
, CAST(make AS VARCHAR(20))
, CAST(model AS VARCHAR(20))
FROM cardata@oraclefs_active WHERE make=’Buick’;
price mileage make model
-------- ------- ------ --------------------
17314.10 8221 Buick Century
17542.04 9135 Buick Enclave
c1 c2
-------------------- ---------------------------------------- -------------
abc aaaaxxxxxx
Insert
The following example uses the INSERT command on the Teradata system that is supported by the
Oracle target connector.
INSERT INTO new_cardata@oraclefs_active SELECT * FROM td_cardata;
Explain
The following examples use the EXPLAIN SELECT and EXPLAIN INSERT commands on the Teradata
system that are supported by the Oracle target connector.
Explain Select
explain select * from SIMBATERADATA.T_BASIC@oraclefs_active;
Explanation
---------------------------------------------------------------------------
1) First, we do an all-AMPs RETRIEVE step executing table operator
TD_SYSFNLIB.QGINITIATORIMPORT in TD_MAP1 with a condition of (
"(1=1)").
< BEGIN EXPLAIN FOR REMOTE QUERY -->
Remote Queries:
1. EXPLAIN PLAN SET STATEMENT_ID = '00000000006b' FOR SELECT id
,c1 FROM SIMBATERADATA.T_BASIC
Explain Insert
EXPLAIN INSERT INTO SIMBATERADATA.T_BASIC@oraclefs_active(100, 'againthruQG');
Explanation
---------------------------------------------------------------------------
1) First, we do an INSERT step into Spool 5.
2) Next, we do a single-AMP RETRIEVE step from Spool 5 (Last Use) by
way of an all-rows scan executing table operator
TD_SYSFNLIB.QGINITIATOREXPORT in TD_MAP1 with a condition of (
"(1=1)") into Spool 3 (used to materialize view, derived table,
Show or Describe
The following examples use different HELP commands on the Teradata system to show or describe
queries for schema discovery requests that are supported by the Oracle target connector.
USERNAME PRAMA_USR
USER_ID 597
CREATED 2018-04-05 07:54:50.000000
COMMON NO
ORACLE_MAINTAINED N
OWNER SIMBATERADATA
TABLE_NAME ORACLETYPET
TABLESPACE_NAME USERS
CLUSTER_NAME ?
IOT_NAME ?
STATUS VALID
PCT_FREE 10
PCT_USED ?
INI_TRANS 1
MAX_TRANS 255
INITIAL_EXTENT 65536
NEXT_EXTENT 1048576
MIN_EXTENTS 1
MAX_EXTENTS 2147483645
PCT_INCREASE ?
FREELISTS ?
FREELIST_GROUPS ?
LOGGING YES
BACKED_UP N
NUM_ROWS 1
BLOCKS 5
EMPTY_BLOCKS 0
AVG_SPACE 0
CHAIN_CNT 0
AVG_ROW_LEN 89
AVG_SPACE_FREELIST_BLOCKS 0
NUM_FREELIST_BLOCKS 0
DEGREE 1
INSTANCES 1
CACHE N
TABLE_LOCK ENABLED
SAMPLE_SIZE 1
LAST_ANALYZED 2018-02-01 03:00:22.000000
PARTITIONED NO
IOT_TYPE ?
TEMPORARY N
SECONDARY N
NESTED NO
BUFFER_POOL DEFAULT
FLASH_CACHE DEFAULT
CELL_FLASH_CACHE DEFAULT
ROW_MOVEMENT DISABLED
GLOBAL_STATS YES
USER_STATS NO
DURATION ?
SKIP_CORRUPT DISABLED
MONITORING YES
CLUSTER_OWNER ?
DEPENDENCIES DISABLED
COMPRESSION DISABLED
COMPRESS_FOR ?
DROPPED NO
READ_ONLY NO
SEGMENT_CREATED YES
RESULT_CACHE DEFAULT
CLUSTERING NO
ACTIVITY_TRACKING ?
DML_TIMESTAMP ?
HAS_IDENTITY NO
CONTAINER_DATA NO
INMEMORY DISABLED
INMEMORY_PRIORITY ?
INMEMORY_DISTRIBUTE ?
INMEMORY_COMPRESSION ?
INMEMORY_DUPLICATE ?
OWNER SIMBATERADATA
TABLE_NAME t1
COLUMN_NAME A
DATA_TYPE DATE
DATA_TYPE_MOD ?
DATA_TYPE_OWNER ?
DATA_LENGTH 7
DATA_PRECISION ?
DATA_SCALE ?
NULLABLE Y
COLUMN_ID 1
DEFAULT_LENGTH ?
DATA_DEFAULT ?
NUM_DISTINCT ?
LOW_VALUE ?
HIGH_VALUE ?
DENSITY ?
NUM_NULLS ?
NUM_BUCKETS ?
LAST_ANALYZED ?
SAMPLE_SIZE ?
CHARACTER_SET_NAME ?
CHAR_COL_DECL_LENGTH ?
GLOBAL_STATS NO
USER_STATS NO
AVG_COL_LEN ?
CHAR_LENGTH 0
CHAR_USED ?
V80_FMT_IMAGE NO
DATA_UPGRADED YES
HISTOGRAM NONE
DEFAULT_ON_NULL NO
IDENTITY_COLUMN NO
EVALUATION_EDITION ?
UNUSABLE_BEFORE ?
UNUSABLE_BEGINNING ?
Pass Through
The following example uses the PASS THROUGH operation on the Teradata system to allow DDL and
DCL queries to be run on Oracle, as supported by the Oracle target connector.
call syslib.executeforeignsql('CREATE TABLE rowid1(a rowid)','oraclefs_active');
G_Bigint Bigint
G_Blob Blob
G_Boolean Byteint
G_Byte Byte
G_ByteInt Byteint
G_Date Date
G_Decimal Decimal
G_Float Float
G_Integer Integer
G_Number Number
G_SmallInt Smallint
G_Time Time
G_Timestamp Timestamp
G_XML NVarchar2
Others Varchar2
Binary_Double G_Double
Binary_Float G_Float
Blob G_Blob
Clob G_Clob_UTF16
Date G_Date
IntervalDS G_IntervalDayToSecond
IntervalYM G_IntervalYearToMonth
Long G_Clob_UTF16
NChar G_Char_UTF16
NClob G_Clob_UTF16
Number G_Number
NVarchar G_Varchar_UTF16
RAW G_Byte
Timestamp G_TimeStamp
Varray G_Array
Note:
User must have access to SELECT_CATALOG_ROLE.
Option Description
Fabrics a. Click next to the pending or previous version that you want to make the active
version and select Activate.
Editing a Fabric
Edit a fabric if or when you need to change the name or description of the fabric.
1. Under Fabric Configuration, select Fabrics.
2. Click next to the fabric row that you want to edit and select Edit.
Only Fabric name and Description can be edited.
Editing a Connector
1. Under Fabric Configuration, select Fabrics.
2. Click the Connectors tab.
3. Select a connector, click next to the connector that you want to edit, and select Edit.
4. Modify the attributes of the connector that you want to change.
5. Click Save.
Editing a Link
You can edit any of the link properties. You cannot edit a previous version of a link.
1. Under Fabric Configuration, select Fabrics.
2. Click the Links tab.
3. Click next to a link and click Edit.
When selecting initiating and target connectors, only active connections are available from each list.
Editing a System
You can edit any of the system properties as needed.
1. Under Fabric Components, select Systems.
2. Click next to a system and click Edit.
Editing a Network
Edit a network when you need to change its name, description, or its rules.
1. Under Fabric Components, select Networks.
2. Click next to a network and click Edit.
Item Description
Fabric Name The fabric name is displayed in the upper left corner of the overview.
Data Center and The systems, connectors, and links in the data center are bounded by a circle. The data
Data Center center name is displayed outside the circumference of the circle.
Name
Systems and Systems are displayed within the circle of the data center. The system name is displayed
System Names next to the system icon.
Icon State
Connectors and Connectors are displayed as semi-circles within the circle of the data center, next to the
Connector system they are associated with. The connector name is displayed next to the connector
Names icon.
Within the semi-circle of the icon:
• The filled circle represents the initiating connector.
• The unfilled circle represents the target connector.
Icon State
Connector has one or more critical issues, and may also have one or more
issues resulting in a warning or warnings.
Links Directional arrows ( ) show the data transfer path between initiating connectors and
target connectors of systems within the data center.
Item Description
• For an initiating connector, the arrow starts at the filled circle and points to the unfilled
circle representing the target connector.
• For a target connector, the arrow starts at the unfilled circle and points to the filled
circle representing the initiating connector.
Component Details
Component Description
System Hovering your mouse over a system icon displays a balloon containing the system name,
a summary of warnings (if present), and a summary of critical issues (if present). If the
system has both warnings and critical issues, summaries of both are displayed in the
balloon.
Selecting a system icon displays the Component Details panel. The information
displayed in the panel depends on the system status:
• If the system status is normal, the following details are displayed in the panel:
◦ System name
◦ System description
◦ Node software version installed
• If the system status has one or more warnings or critical issues, the following additional
details are displayed in the panel:
◦ Summary of each issue
◦ The time each issue was reported
◦ Duration of each issue
◦ Details about each issue
Connector Hovering your mouse over a connector icon displays a balloon containing the connector
name, a summary of warnings (if present), and a summary of critical issues (if present).
If the connector has both warnings and critical issues, summaries of both are displayed
in the balloon.
Component Description
Selecting a connector icon displays the Component Details panel. The information
displayed in the panel depends on the connector status:
• If the connector status is normal, the following details are displayed in the panel:
◦ Connector name
◦ Connector description
◦ Connector software name
◦ Connector software version installed
• If the connector status has one or more warnings or critical issues, the following
additional details are displayed in the panel:
◦ Summary of each issue
◦ The time each issue was reported
◦ Duration of each issue
◦ Details about each issue
Link Hovering your mouse over an arrow displays a balloon containing the name of a link. If
more than one link is configured, the number of links and their names are displayed in
the balloon.
Selecting an arrow displays the following in the Component Details panel.
• Link name
• Link description
• The link properties configured for each link associated with the connector (bridges, if
any, initiating and target connector properties, hops, and so forth)
Issues
Use Issues to review possible problems with QueryGrid. Some of these issues might require you to take
action. The following types of issues are reported:
• Teradata QueryGrid component has gone offline.
• Teradata QueryGrid Manager has failed.
• Teradata QueryGrid Manager backup failed.
• Teradata QueryGrid Manager is running out of disk space.
• One or more Teradata QueryGrid Managers are running different versions of the Teradata QueryGrid
Manager package.
• One or more nodes on the system are missing the connector package.
• System time is incorrect on a node or a Teradata QueryGrid Manager.
Issues Details
Issues details consists of a read-only text box that displays the entire error message that was returned
for this issue. Select the issue to view the entire message.
Allowed OS user is QGInitiatorExportContract: 2689: (NO UUID YET) Update allowed OS user on
not correctly ExportMeta : Connection not allowed for OS user initiator connector. For more
configured on id 14 information, see Teradata
initiator system. QueryGrid Security.
System memory not QGInitiatorExport: 10201: (7031532d-f2a4-4a7e- Increase system memory for
sufficient on initiator a983-000000000001) InitiatorDataExportReq : initiator system.
system. shm alloc failed. requested 4198400b + existing
4198400b > max 5mb, linkbuffer size:count
1048576b:4
System memory not qginitiatorimport: 9134: (4bb2afaf- Increase system memory for
sufficient on target e428-45f1-90e8-000000000001) target system.
system. initiatordataimportreq : [error 9134]
qgremoteexport: 10201: remotedataexportreq :
shm alloc failed. requested 4198400b + existing
4198400b > max 5mb, linkbuffer size:count
1048576b:4
The (link buffer size qginitiatorexportcontract: 2001: (no uuid yet) Decrease link buffer size and
* link buffer) count is exportmeta : requested segment size for reader link buffer count on initiator
higher than the 1000000000b is larger than max allowed connector.
allowed value. 16777216b
Problem
Error Message Solution
Description
Driver not started/ QGInitiatorExportContract: 24585: Check driver status for target
offline on target (06592ddf-84cb-460b-afcd-000000000003) connector. If driver is offline,
system or incorrect ExportMeta : Driver TDdriver unreachable by restart tdqg-node service on
java path set. fabric on node sdt11134 the node.
Table does not exist QGInitiatorExportContract: 3706: Confirm that the table exists
on the target (9c7d074e-4529-4a54-a664-000000000004) and the query has the correct
system. ExportMeta : [Error 3807] Object 'testuser.temp_ reference.
table_non_exist' does not exist.
Syntax error for EXECUTEFOREIGNSQL:Error: 3707 (50081586- Check the query submitted in
foreignSQL pass bd87-4516-9285-000 ExecuteForeignSQL SP and
through. 000000017) ForeignFunctionDataExec : [Error if there is a valid syntax on the
3707] Syntax error, expected some target system.
thing like ‘(’ between the word ‘xx’ and ‘;’.
QueryGrid fastpath QGInitiatorImport: 3706: (9c7d074e-4529-4a54- Run the DIP script System
function, a664-000000000004) InitiatorDataImportReq : Functions if the fastpath
QGRemoteExport, [Error 3706] Syntax error, expected something like functions do not exists under
does not exist on ';' between the word 'QGRemoteExport' TD_SYSFNLIB on the target
the target system. Teradata system.
QueryGrid fastpath QGInitiatorExport: 3706: (9c7d074e-4529-4a54- Run the DIP script System
function, a664-000000000004) InitiatorDataExportReq : Functions if the fastpath
QGRemoteImport [Error 3706] Syntax error, expected something like functions do not exists under
does not exist on ';' between the word 'QGRemoteImport' TD_SYSFNLIB on the target
the target system. Teradata system.
Problem
Error Message Solution
Description
Out of spool space QGInitiatorExport: 2646: (a18b6bce- Increase the spool space for
on target system ce8a-4ea0-97b3-000000000008) the user on the target system
during data transfer. InitiatorDataExportReq : [Error 2646] No more or reduce data set for the
spool space in testuser. query.
Problem
Error Message Solution
Description
Note:
Increasing the fabric system
property should be done with
the help of a Teradata
Customer Support
Representative.
Managers
Teradata QueryGrid Managers provide centralized management and monitoring of QueryGrid. Managers
are used to install and upgrade software on Teradata QueryGrid systems. You can configure settings for
managers, such as the length of time to retain log data and the session timeout.
Managers Tab
Setting Description
3. Click Apply.
Service Accounts are used by Viewpoint and Teradata Support to access Teradata QueryGrid Manager.
Use a command line tool reset-password.sh to reset a service account password on the Teradata
QueryGrid Manager system.
1. From the command line of the Teradata QueryGrid Manager system, run: /opt/teradata/tdqgm/
bin/reset-password.sh
You must run the command as root or the tdqgm user.
Settings Tab
Modifiable settings include query and log data retention time frame, query summary frequency, and
session timeout.
Restarting a Fabric
Use the command line utility fabric-restart.sh to restart a fabric.
Note:
You can run this command as the root or tdqgm user.
Fabrics
-------
1. Production (ACTIVE)
2. Production (PENDING)
Systems
-------
1. ALL SYSTEMS
2. HdpProd
3. TD1
Are you sure you want to restart Production (PENDING) on ALL SYSTEMS? [y/n]: y
Note:
You must run this command as the root or tdqgm user.
4. Click the Managers tab, and select Delete for the manager you want to delete.
Note:
You must run the command as the root or tdqgm user.
Each manager instance automatically generates a backup file once a day located in /var/opt/teradata/
tdqgm/backups. Up to 7 days of backups are maintained.
Backup
The backup command is located at /opt/teradata/tdqgm/bin/backup.sh and must be run as the root
or tdqgm user. By default , backups are placed in the /var/opt/teradata/tdqgm/backups directory
and are named tdqgm-backup-YYYY-MM-DD.zip where YYYY-MM-DD is the current date. The backup
file includes all the configuration details and software packages that were uploaded to the Teradata
QueryGrid Manager.
Usage
To get help for the backup command, use the --help option:
/opt/teradata/tdqgm/bin/backup.sh --help
Result:
options:
-f,--file <file> The path to the backup file to create.
/opt/teradata/tdqgm/bin/backup.sh
Result:
Starting backup...
Backup completed:
/var/opt/teradata/tdqgm/backups/tdqgm-backup-2016-06-16.zip
Restore
The restore command is located at /opt/teradata/tdqgm/bin/restore.sh and must be run as the
root or tdqgm user. The name of the backup file to restore as an argument is required.
Usage
To get help for the backup command, use the --help option:
/opt/teradata/tdqgm/bin/restore.sh --help
Result:
Restores the QueryGrid manager configuration from a backup file in the event of
a catastrophic failure.
options:
/opt/teradata/tdqgm/bin/restore.sh <backup_file>
Enter public address for this manager instance [<public_address>]:
where <backup_file> is the path name of the backup ZIP file, similar to ~/tdqgm-
backup-2016-06-16.zip and <public_address> is the hostname or IP address of the Teradata
QueryGrid Manager system; for example: test.mydomain.com or 198.51.100.20.
Result (note, enter y at the prompt):
A restore from backup removes all data previously saved on this manager instance
and
all local manager services are restarted. This manager instance becomes a
standalone cluster.
Other managers can join this instance using the join-cluster command.
Data Centers
------------
1. San Diego
2. Las Vegas
3. Atlanta
4. Richmond
Restoring tdqg-node-16.00.00.00.DEV-30.tar.gz...
Restoring tdqg-teradata-connector-1.0-224-SNAPSHOT.tar.gz...
Restoring tdqg-fabric-1.00.00.00.tar.gz...
Restoring tdqg-teradata-connector-1.0-12-SNAPSHOT.zip...
Note:
You can also update links, networks, and communication policies. Like connector and fabric
upgrades, such updates are considered configuration changes and are subject to the same version
and deployment protocol.
The upgrade process for QueryGrid node software differs somewhat from the installation process, with
the final deployment steps being handled automatically by the pre-existing version of the software.
Upgrade Considerations
The following considerations apply when upgrading QueryGrid Manager from QueryGrid 2.04 and earlier
to QueryGrid 2.05 and later:
• Previously collected log data and query metrics are reset.
QueryGrid metrics that display in Viewpoint are maintained and not reset.
• Query summarization and system health checks are suspended during the rolling upgrade until all
Managers are upgraded to the new version. Teradata recommends you perform rolling upgrades in
quick succession to minimize the amount of time different versions are running simultaneously, while
still making sure each instance is upgraded successfully and comes online before starting the next
upgrade.
• Wait to perform diagnostic checks and node install operations until after the rolling upgrade completes
to avoid timeouts or failure.
The following considerations apply when upgrading QueryGrid connectors from QueryGrid 2.04 and earlier
to QueryGrid 2.05 and later:
Connector
Description
Type
Teradata • Installation step is not required when upgrading from 02.04 and earlier versions.
• Proceed to run the connector installation step if it was not run on a previous version of
QueryGrid. Refer to Teradata Initiator Connector Tasks for more information.
Presto • Installation step is not required when upgrading from 02.04 and earlier versions on
Presto 189t.
• If installing or upgrading a Presto server to 189t, 195t, 203t, or 208t, complete the
connector installation steps through the connector install (using Viewpoint 16.20) or
QueryGrid Manager connector-install command line script (using Viewpoint 16.10).
Refer to Presto Initiator Connector Tasks for more information.
Hive • Installation step and target import and export of UDFs are not required as of QueryGrid
version 02.05.
• If the ADD JAR command is not allowed on Hive (for example, CDH with Sentry), the
Hive class path must be configured. Refer to Hive Target Connector Tasks for more
information.
4. Repeat the previous step for each system on which the prior version of the node software is deployed.
Note:
The install script should be re-run when Presto is upgraded, unless there are no QueryGrid changes
to incorporate.
1. Download the latest software packages and then upload the packages to Teradata QueryGrid
Manager.
2. Browse to the QueryGrid portlet view or tab for the component you are upgrading:
Fabric Fabrics
3. Next to the component you want to upgrade, click , select Add Pending Version, then complete the
applicable procedure for adding the component.
The component is available for testing on production deployments without affecting production
workloads.
Note:
Recommended areas of testing include QueryGrid diagnostics, bandwidth, and SQL.
./cleanup-software.sh --help
usage: cleanup-software [-d <days>] [-h] [-m <host>] [-n]
options:
-d,--days <days> The number of days old the software should be
before considering it for removal. Defaults to 7.
-h,--help Print this message
-m,--manager <host> The hostname of the QueryGrid manager to connect
to. Defaults to localhost.
-n,--no-ssl Use HTTP instead of HTTPS to connect to the manager.
1. Log on to the system where the Teradata QueryGrid Manager is running.
2. From /opt/teradata/tdqgm/bin, run: ./cleanup-software.sh
Note:
You must run this command as the root or tdqgm user.
Last Modified Creation date or the last time this communication policy was edited
Error Message Text of the error message that was returned, if a problem was detected
Package Date Date that the connector software package was built
Connectors Metrics
Metric Description
Nodes Online Number of nodes on which the connector software is installed and both the node and fabric
are available
Nodes Offline Number of nodes on which the connector software is installed and not currently active
Drivers Online Number of nodes on which the connector is installed and the driver is running
Drivers Offline Number of nodes on which the connector driver is installed and not currently active but is
supposed to be active
Last Modified Creation date or the last time this connector was edited
Package Date Date that the fabric software package was built
Fabrics Metrics
Metric Description
Nodes Online Number of nodes that are online for the fabric
Nodes Offline Number of nodes that are supposed to be online for the fabric but are not
Last Modified Creation date, or the last time this fabric was edited
Time Time the issue was created, updated, or resolved depending on the state
Issues Metrics
Metric Description
Component Name of the manager or system from which the issue originated
Metric Description
Error Message Text of the error message that was returned, if a problem was detected
Links Metrics
Metric Description
Initiating Connector Connector that initiates and sends a query to a target system
Target Connector Connector that receives and processes a query from the initiating system or
accepts data from the initiating system, and may return results to the initiating
system
Last Modified Creation date or the last time this connector was edited
Managers Metrics
Metric Description
Metric Description
Public Address Public-facing host name or IP address that is used to communicate with this manager
Cluster Address The IP address that other Teradata QueryGrid Managers in the cluster use to access a
specific QueryGrid Manager.
Bind Address A locally bound IP address to which Teradata QueryGrid Manager internal services bind.
Networks Metrics
Metric Description
Last Modified Creation time or last time this network was edited
Network Interfaces
Metric Description
Fabrics
Metric Description
Connectors
Metric Description
Success You can filter to see the number of nodes in the following states:
• Success: Number of node installations that have succeeded
• Failed: Number of node installations that have failed
• Installing: Number of nodes that are currently installing
• Pending: Number of nodes that are currently pending
• Aborted: Number of node installations that have aborted
Metric Description
Roles Metrics
Metric Description
Initiating Role Name of the role on the system where the query originates
Target Role Name of the role on the system where the query is targeted
System Metrics
Metric Description
Node Software Version of node software that the nodes in the system run
Nodes Online Number of nodes that are currently active on the system
Nodes Offline Number of nodes that are not currently active on the system
Group Name Name of the mapping group that the user or role belongs to
Mapping Count Number of mapping relationships created for this mapping group
Last Modified Time that the mapping group was last changed
Users Metrics
Metric Description
Initiating User Name of the user on the system where the query originates
Target User Name of the user on the system where the query is targeted
Table Actions
The following table lists the QueryGrid portlet table actions, the components from which each action is
available, and the description for each action.
Clear Filters Communication Policies Remove any content in the filter boxes
Connector Software Tab
Fabrics
Issues
Networks
Systems
Configure Communication Policies Choose the columns to display and set thresholds
Columns Connector Software Tab
Data Centers
Fabric Software Tab
Fabrics
Issues
Managers Tab
Networks
Node Software Tab
Service Accounts Tab
Systems
User Mappings
Export Communication Policies Create a .csv file containing all available data up to one
Connector Software Tab million rows
Data Centers If more than one million rows of data are available, then use
Fabric Software Tab the filters to display the data you want before exporting it
Fabrics
Issues
Managers Tab
Networks
Node Software Tab
Service Accounts Tab
Systems
User Mappings
Row Actions
The following table lists the QueryGrid portlet row actions, the components from which each action is
available, and the description for each action.
Action Component Description
Add Pending Communication Policies Create a pending version of the selected component that
Version Connectors you can edit and test
Fabrics
Links
Networks
Links
Edit Communication Policies Change all configuration for the current (active) version
If a pending version, you cannot change the name or
description
Service Accounts Edit the password and description for a service account
User Mappings Modify the name and description for a user mapping
View Driver Connectors View the status of the drivers on the selected connector
Status
View Node Nodes View the network interfaces, fabrics, and connectors this
Details node is associated with
View Node Connectors View the status of the nodes for a selected connector
Status
Fabrics View the status of the nodes associated with a fabric
Convention Description
Square braces in Represent options. The indicated parentheses are required when you specify options.
the text For example:
DECIMAL [(n[,m])] means the decimal data type can be defined
optionally:
• without specifying the precision value n or scale value m
• specifying precision (n) only
• specifying both values (n,m)
You cannot specify scale without first defining precision.
• CHARACTER [(n)] means that use of (n) is optional.
The values for n and m are integers in all cases.
Paths
The main path along the syntax diagram begins at the left with a keyword, and proceeds, left to right, to the
vertical bar, which marks the end of the diagram. Paths that do not have an arrow or a vertical bar only
show portions of the syntax.
The only part of a path that reads from right to left is a loop.
Continuation Links
Paths that are too long for one line use continuation links. Continuation links are circled letters indicating
the beginning and end of a link:
When you see a circled letter in a syntax diagram, go to the corresponding circled letter and continue
reading.
Required Entries
Required entries appear on the main path:
If you can choose from more than one entry, the choices appear vertically, in a stack. The first entry appears
on the main path:
Optional Entries
You may choose to include or disregard optional entries. Optional entries appear below the main path:
If you can optionally choose from more than one entry, all the choices appear below the main path:
Some commands and statements treat one of the optional choices as a default value. This value is
UNDERLINED. It is presumed to be selected if you type the command or statement without specifying one
of the options.
Strings
String literals appear in apostrophes:
Abbreviations
If a keyword or a reserved word has a valid abbreviation, the unabbreviated form always appears on the
main path. The shortest valid abbreviation appears beneath.
Loops
A loop is an entry or a group of entries that you can repeat one or more times. Syntax diagrams show loops
as a return path above the main path, over the item or items that you can repeat:
maximum number The number appears in a circle on the return In the example, you may type cname
of entries allowed path. a maximum of four times.
minimum number The number appears in a square on the In the example, you must type at least
of entries allowed return path. three groups of column names.
separator The character appears on the return path. In the example, the separator
character required If the diagram does not show a separator character is a comma.
between entries character, use one blank space.
delimiter character The beginning and end characters appear In the example, the delimiter
required around outside the return path. characters are the left and right
entries Generally, a space is not needed between parentheses.
delimiter characters and entries.
Excerpts
Sometimes a piece of a syntax phrase is too large to fit into the diagram. Such a phrase is indicated by a
break in the path, marked by (|) terminators on each side of the break. The name for the excerpted piece
appears between the terminators in boldface type.
The boldface excerpt name and the excerpted phrase appears immediately after the main diagram. The
excerpted phrase starts and ends with a plain horizontal line:
dbname
DATABASE dbname
tname
TABLE tname
vname
VIEW vname
Audience
This guide is intended for technical personnel who use Teradata QueryGrid:
• System administrators
• Database administrators
• Hadoop administrators
• Users
• Teradata Customer Support
Teradata Links
Link Description
Link Description
Related Documentation
Title Publication ID
Teradata® Viewpoint Installation, Configuration, and Upgrade Guide for Customers B035-2207
Describes how to install Viewpoint software, configure settings, and upgrade a Teradata
Viewpoint server.