tELTHiveMap
Builds graphically the Hive QL statement in order to transform data.
The three ELT Hive components are closely related, in terms
of their operating conditions. These components should be used to handle Hive DB schemas
to generate Insert statements, including clauses, which are to be executed in the DB
output table defined.
This component uses the tables provided as input, to feed the
parameter in the built statement. The statement can include inner or
outer joins to be implemented between tables or between one table
and its aliases.
tELTHiveMap Standard properties
These properties are used to configure tELTHiveMap running in the Standard Job framework.
The Standard
tELTHiveMap component belongs to the ELT family.
The component in this framework is available in all Talend products with Big Data
and in Talend Data Fabric.
Basic settings
- When you use this component with Qubole on AWS:
API Token Click the … button next to the
API Token field to enter the
authentication token generated for the Qubole user account
to be used. For further information about how to obtain this
token, see Manage Qubole
account from the Qubole documentation.This
token allows you to specify the user account you want to
use to access Qubole. Your Job automatically uses
the rights and permissions granted to this user account
in Qubole.Cluster label Select the Cluster label check
box and enter the name of the Qubole cluster to be used. If
leaving this check box clear, the default cluster is
used.If you need details about your default cluster,
ask the administrator of your Qubole service. You can
also read this article
from the Qubole documentaiton to find more information
about configuring a default Qubole cluster.Change API endpoint Select the Change API endpoint
check box and select the region to be used. If leaving this
check box clear, the default region is used.For further
information about the Qubole Endpoints supported on
QDS-on-AWS, see Supported Qubole
Endpoints on Different Cloud
Providers. -
When you use this component with Google Dataproc:
Project identifier
Enter the ID of your Google Cloud Platform project.
If you are not certain about your project ID, check it in the Manage
Resources page of your Google Cloud Platform services.Cluster identifier
Enter the ID of your Dataproc cluster to be used.
Region From this drop-down list, select the Google Cloud region to
be used.Google Storage staging bucket As a Talend Job expects its
dependent jar files for execution, specify the Google Storage directory to
which these jar files are transferred so that your Job can access these
files at execution.The directory to be entered must end with a slash (/). If not existing, the
directory is created on the fly but the bucket to be used must already
exist.Database
Fill this field with the name of the database.
Provide Google Credentials in file
Leave this check box clear, when you
launch your Job from a given machine in which Google Cloud SDK has been
installed and authorized to use your user account credentials to access
Google Cloud Platform. In this situation, this machine is often your
local machine.When you launch your Job from a remote
machine, such as a Jobserver, select this check box and in the
Path to Google Credentials file field that is
displayed, enter the directory in which this JSON file is stored in the
Jobserver machine.For further information about this Google
Credentials file, see the administrator of your Google Cloud Platform or
visit Google Cloud Platform Auth
Guide. -
When you use this component with HDInsight:
WebHCat configuration
Enter the address and the authentication information of the Microsoft HD
Insight cluster to be used. For example, the address could be
your_hdinsight_cluster_name.azurehdinsight.net and the
authentication information is your Azure account name: ychen.
The Studio uses this service to submit the Job to the HD Insight cluster.In the Job result folder field, enter
the location in which you want to store the execution result of a Job in the Azure
Storage to be used.HDInsight
configuration- The Username is the one defined when
creating your cluster. You can find it in the SSH
+ Cluster login blade of your cluster. - The Password is defined when creating your HDInsight
cluster for authentication to this cluster.
Windows Azure Storage
configurationEnter the address and the authentication information of the Azure Storage
account to be used. In this configuration, you do not define where to read or write
your business data but define where to deploy your Job only. Therefore always use
the Azure
Storage
system for this configuration.In the Container field, enter the name
of the container to be
used. You can
find the available containers in the Blob blade of the Azure
Storage account to be used.In the Deployment Blob field, enter the
location in which you want to store the current Job and its dependent libraries in
this Azure Storage account.In the Hostname field, enter the
Primary Blob Service Endpoint of your Azure Storage account without the https:// part. You can find this endpoint in the Properties blade of this storage account.In the Username field, enter the name of the Azure Storage account to be used.
In the Password field, enter the access key of the Azure Storage account to be used. This key can be found in the Access keys blade of this storage account.
Database
Fill this field with the name of the database.
- The Username is the one defined when
-
When you use the other distributions:
Connection mode
Select a connection mode from the list. The
options vary depending on the distribution you are
using.Hive server
Select the Hive server through which you want the Job using this component
to execute queries on Hive.This Hive server list is available
only when the Hadoop distribution to be used such as HortonWorks Data Platform V1.2.0 (Bimota) supports HiveServer2. It
allows you to select HiveServer2 (Hive 2), the
server that better support concurrent connections of multiple clients than
HiveServer (Hive 1).For further information about HiveServer2, see https://cwiki.apache.org/confluence/display/Hive/Setting+Up+HiveServer2.
Host
Database server IP address.
Port
Listening port number of DB server.
Database
Fill this field with the name of the
database.Note:This field is not available when you
select Embedded
from the Connection
mode list.Username and
PasswordDB user authentication data.
To enter the password, click the […] button next to the
password field, and then in the pop-up dialog box enter the password between double quotes
and click OK to save the settings.Use kerberos authentication
If you are accessing a Hive Metastore running with Kerberos security,
select this check box and then enter the relevant parameters in the fields that
appear.-
If this cluster is a MapR cluster of the version 5.0.0 or later, you can set the
MapR ticket authentication configuration in addition or as an alternative by following
the explanation in Connecting to a security-enabled MapR.Keep in mind that this configuration generates a new MapR security ticket for the username
defined in the Job in each execution. If you need to reuse an existing ticket issued for the
same username, leave both the Force MapR ticket
authentication check box and the Use Kerberos
authentication check box clear, and then MapR should be able to automatically
find that ticket on the fly.
The values of the following parameters can be found in the hive-site.xml file of the Hive system to be used.-
Hive principal uses the value
of hive.metastore.kerberos.principal. This is
the service principal of the Hive Metastore. -
HiveServer2 local user
principal uses the value of hive.server2.authentication.kerberos.principal. -
HiveServer2 local user keytab
uses the value of hive.server2.authentication.kerberos.keytab -
Metastore URL uses the value of
javax.jdo.option.ConnectionURL. This is the
JDBC connection string to the Hive Metastore. -
Driver class uses the value of
javax.jdo.option.ConnectionDriverName. This
is the name of the driver for the JDBC connection. -
Username uses the value of javax.jdo.option.ConnectionUserName. This, as
well as the Password parameter, is the user credential for connecting to
the Hive Metastore. -
Password uses the value of javax.jdo.option.ConnectionPassword.
For the other parameters that are displayed, please consult the Hadoop
configuration files they belong to. For example, the Namenode
principal can be found in the hdfs-site.xml file
or the hdfs-default.xml file of the distribution you are
using.This check box is available depending on the Hadoop distribution you are
connecting to.Use a keytab to authenticate Select the Use a keytab to authenticate
check box to log into a Kerberos-enabled system using a given keytab file. A keytab
file contains pairs of Kerberos principals and encrypted keys. You need to enter the
principal to be used in the Principal field and
the access path to the keytab file itself in the Keytab field. This keytab file must be stored in the machine in
which your Job actually runs, for example, on a Talend Jobserver.Note that the user that executes a keytab-enabled Job is not necessarily
the one a principal designates but must have the right to read the keytab file being
used. For example, the user name you are using to execute a Job is user1 and the principal to be used is guest; in this
situation, ensure that user1 has the right to read the keytab
file to be used.Use SSL encryption
Select this check box to enable the SSL or TLS encrypted connection.
Then in the fields that are displayed, provide the authentication
information:-
In the Trust store
path field, enter the path, or browse to the TrustStore
file to be used. By default, the supported TrustStore types are JKS and PKCS 12. -
To enter the password, click the […] button next to the
password field, and then in the pop-up dialog box enter the password between double quotes
and click OK to save the settings.
This feature is available only to the HiveServer2 in the Standalone mode of the following distributions:-
Hortonworks Data Platform 2.0 +
-
Cloudera CDH4 +
-
Pivotal HD 2.0 +
-
Amazon EMR 4.0.0 +
Set Resource Manager
Select this check box and in the displayed field, enter the location of the
ResourceManager of your distribution. For example, tal-qa114.talend.lan:8050.Then you can continue to set the following parameters depending on the
configuration of the Hadoop cluster to be used (if you leave the check box of a
parameter clear, then at runtime, the configuration about this parameter in the
Hadoop cluster to be used will be ignored ):-
Select the Set resourcemanager
scheduler address check box and enter the Scheduler address in
the field that appears. -
Select the Set jobhistory
address check box and enter the location of the JobHistory
server of the Hadoop cluster to be used. This allows the metrics information of
the current Job to be stored in that JobHistory server. -
Select the Set staging
directory check box and enter this directory defined in your
Hadoop cluster for temporary files created by running programs. Typically, this
directory can be found under the yarn.app.mapreduce.am.staging-dir property in the configuration files
such as yarn-site.xml or mapred-site.xml of your distribution. -
Allocate proper memory volumes to the Map and the Reduce
computations and the ApplicationMaster
of YARN by selecting the Set memory
check box in the Advanced settings
view. -
Select the Set Hadoop
user check box and enter the user name under which you
want to execute the Job. Since a file or a directory in Hadoop has its
specific owner with appropriate read or write rights, this field allows
you to execute the Job directly under the user name that has the
appropriate rights to access the file or directory to be processed. -
Select the Use datanode hostname check box to allow the
Job to access datanodes via their hostnames. This actually sets the dfs.client.use.datanode.hostname
property to true. When connecting to a
S3N filesystem, you must select this check box.
For further information about these parameters, see the documentation or
contact the administrator of the Hadoop cluster to be used.For further information about the Hadoop Map/Reduce framework, see the
Map/Reduce tutorial in Apache’s Hadoop documentation on http://hadoop.apache.org.Set NameNode URI
Select this check box and in the displayed field, enter the URI of the
Hadoop NameNode, the master node of a Hadoop system. For example, assuming that you
have chosen a machine called masternode as the NameNode, then
the location is hdfs://masternode:portnumber. If you are using WebHDFS, the location should be
webhdfs://masternode:portnumber; WebHDFS with SSL is not
supported yet.For further information about the Hadoop Map/Reduce framework, see the
Map/Reduce tutorial in Apache’s Hadoop documentation on http://hadoop.apache.org. -
Property type |
Either Built-In or Repository. Built-In: No property data stored centrally.
Repository: Select the repository file where the |
Use an existing connection |
Select this check box and in the Component List click the relevant connection component to Note: When a Job contains the parent Job and the child Job, if you
need to share an existing connection between the two levels, for example, to share the connection created by the parent Job with the child Job, you have to:
For an example about how to share a database connection |
ELT Hive Map editor |
The ELT Map editor helps you to define the output schema as well as build If you use context variables in the Expression |
Style link |
Select the way in which links are displayed.
Auto: By default, the links between the
Bezier curve: Links between the schema
Line: Links between the schema and the This option slightly optimizes performance. |
Distribution |
Select the cluster you are using from the drop-down list. The options in the
list vary depending on the component you are using. Among these options, the following ones requires specific configuration:
|
Hive version |
Select the version of the Hadoop distribution you are using. The available |
Execution engine |
Select this check box and from the drop-down list, select the framework you need to use to This list is available only when you are using the Embedded mode for the Hive connection and the distribution you are working
with is:
Before using Tez, ensure that the Hadoop cluster you are using supports Tez. You will need to configure the access to the relevant Tez libraries via the Advanced settings view of this component. For further information about Hive on Tez, see Apache’s related documentation in https://cwiki.apache.org/confluence/display/Hive/Hive+on+Tez. Some examples are presented there to show how Tez can be used to gain performance over MapReduce. |
When you need to enable Hive components to access HBase:
These parameters are available only when the Use an existing
connection check box is clear.
Store by HBase |
Select this check box to display the parameters to be set to allow the Hive components to
access HBase tables:
For further information about this access involving Hive and HBase, see Apache’s Hive |
Zookeeper quorum |
Type in the name or the URL of the Zookeeper service you use to coordinate the transaction |
Zookeeper client port |
Type in the number of the client listening port of the Zookeeper service you are |
Define the jars to register for |
Select this check box to display the Register jar for |
Register jar for HBase |
Click the [+] button to add rows to this table, then, in the Jar name column, select the jar file(s) to be registered and in the |
Advanced settings
Tez lib |
Select how the Tez libraries are accessed:
|
Temporary path |
If you do not want to set the Jobtracker and the NameNode when you execute |
Hadoop properties |
Talend Studio uses a default configuration for its engine to perform operations in a Hadoop distribution. If you need to use a custom configuration in a specific situation, complete this table with the property or properties to be customized. Then at runtime, the customized property or properties will override those default ones.
For further information about the properties required by Hadoop and its related systems such
as HDFS and Hive, see the documentation of the Hadoop distribution you are using or see Apache’s Hadoop documentation on http://hadoop.apache.org/docs and then select the version of the documentation you want. For demonstration purposes, the links to some properties are listed below:
|
Hive properties |
Talend Studio uses a default configuration for its engine to
perform operations in a Hive database. If you need to use a custom configuration in a specific situation, complete this table with the property or properties to be customized. Then at runtime, the customized property or properties will override those default ones. For further information for Hive dedicated properties, see https://cwiki.apache.org/confluence/display/Hive/AdminManual+Configuration.
|
Mapred job map memory mb and |
You can tune the map and reduce computations by In that situation, you need to enter the values you need in the Mapred |
Path separator in server |
Leave the default value of the Path separator in |
tStatCatcher Statistics |
Select this check box to collect log data at the component |
Temporary path |
If you do not want to set the Jobtracker and the NameNode when you execute |
Global Variables
Global Variables |
ERROR_MESSAGE: the error message generated by the A Flow variable functions during the execution of a component while an After variable To fill up a field or expression with a variable, press Ctrl + For further information about variables, see |
Usage
Usage rule |
tELTHiveMap is used along with a If the Studio used to connect to a Hive database is operated on Windows, Note:
The ELT components do not handle actual data flow but only schema |
Usage with Dataproc |
The ELT Hive components require Tez to be installed on
|
Dynamic settings |
Click the [+] button to add a row in the table The Dynamic settings table is For examples on using dynamic parameters, see Reading data from databases through context-based dynamic connections and Reading data from different MySQL databases using dynamically loaded connection parameters. For more information on Dynamic |
Prerequisites |
The Hadoop distribution must be properly installed, so as to guarantee the interaction
For further information about how to install a Hadoop distribution, see the manuals |
Joining table columns and writing them into Hive
This scenario applies only to Talend products with Big Data.
This scenario uses a four-component Job to join the columns selected from two Hive
tables and write them into another Hive table.
Preparing the Hive tables
-
Create the Hive table you want to write data in. In this scenario, this
table is named as agg_result, and you can
create it using the following statement in tHiveRow:
create table agg_result (id int, name string, address string, sum1 string, postal string, state string, capital string, mostpopulouscity string) partitioned by (type string) row format delimited fields terminated by ';' location '/user/ychen/hive/table/agg_result'
In this statement,
‘/user/ychen/hive/table/agg_result’ is the directory used in
this scenario to store this created table in HDFS. You need to replace it
with the directory you want to use in your environment. -
Create two input Hive tables containing the columns you want to join and
aggregate these columns into the output Hive table, agg_result. The statements to be used are:
create table customer (id int, name string, address string, idState int, id2 int, regTime string, registerTime string, sum1 string, sum2 string) row format delimited fields terminated by ';' location '/user/ychen/hive/table/customer'
and
create table state_city (id int, postal string, state string, capital int, mostpopulouscity string) row format delimited fields terminated by ';' location '/user/ychen/hive/table/state_city'
-
Use tHiveRow to load data into the two
input tables, customer and state_city. The statements to be used are:
"LOAD DATA LOCAL INPATH 'C:/tmp/customer.csv' OVERWRITE INTO TABLE customer"
and
"LOAD DATA LOCAL INPATH 'C:/tmp/State_City.csv' OVERWRITE INTO TABLE state_city"
The two files, customer.csv and
State_City.csv, are two local files
we created for this scenario. You need to create your own files to provide
data to the input Hive tables. The data schema of each file should be
identical with their corresponding table.You can use tRowGenerator and tFileOutputDelimited to create these two files
easily. For further information about these two components, see tRowGenerator and tFileOutputDelimited.For further information about the Hive query language, see https://cwiki.apache.org/confluence/display/Hive/LanguageManual.
Linking the components
-
In the
Integration
perspective
of
Talend Studio
,
create an empty Job from the Job Designs
node in the Repository tree view.For further information about how to create a Job, see
Talend Studio User Guide. -
Drop two tELTHiveInput components and
tELTHiveMap and tELTHiveOutput onto the workspace. -
Connect them using the Row > Main
link.Each time when you connect two components, a wizard pops up to prompt you
to name the link you are creating. This name must be the same as that of the
Hive table you want the active component to process. In this scenario, the
input tables the two tELTHiveInput
components will handle are customer and
state_city and the output table
tELTHiveOutput will handle is agg_result.
Configuring the input schemas
-
Double-click the tELTHiveInput component
using the customer link to open its
Component view. - Click the […] button next to Edit schema to open the schema editor.
-
Click the
button as many times as required to add columns and
rename them to replicate the schema of the customer table we created earlier in Hive.You can as well use the customer schema you retrieve and store in the Repository to set up this schema. For further
information about how to set up a connection to Hive and retrieve and store the
schema in Repository, see
Talend Studio User Guide. -
In the Default table name field, enter
the name of the input table, customer, to
be processed by this component. -
Double-click the other tELTHiveInput
component using the state_city link to
open its Component view. - Click the […] button next to Edit schema to open the schema editor.
-
Click the
button as many times as required to add columns and
rename them to replicate the schema of the state_city table we created earlier in Hive. -
In the Default table name field, enter
the name of the input table, state_city,
to be processed by this component.
Mapping the input and the output schemas
Configuring the connection to Hive
-
Click tELTHiveMap, then, click Component to open its Component view.
-
In the Version area, select the Hadoop
distribution you are using and the Hive version. -
In the Connection mode list, select the
connection mode you want to use. If your distribution is HortonWorks, this
mode is Embedded only. -
In the Host field and the Port field, enter the authentication information
for the component to connect to Hive. For example, the host is talend-hdp-all and the port is 9083. -
Select the Set Jobtracker URI check box
and enter the location of the Jobtracker. For example, talend-hdp-all:50300. -
Select the Set NameNode URI
check box and enter the location of the NameNode. For example, hdfs://talend-hdp-all:8020. If you are using WebHDFS, the location should be
webhdfs://masternode:portnumber; WebHDFS with SSL is not
supported yet.
Mapping the schemas
-
Click ELT Hive Map Editor to map the
schemas -
On the input side (left in the figure), click the Add alias button to add the table to be used.
- In the pop-up window, select the customer table, then click OK.
- Repeat the operations to select the state_city table.
-
Drag and drop the idstate column from
the customer table onto the id column of the state_city table. Thus an inner join is created
automatically. -
On the output side (the right side in the figure), the agg_result table is empty at first. Click
at the bottom of this side to add as many columns as
required and rename them to replicate the schema of the agg_result table you created earlier in Hive.Note:The type column is the partition
column of the agg_result table and
should not be replicated in this schema. For further information about
the partition column of the Hive table, see the Hive manual. -
From the customer table, drop id, name,
address, and sum1 to the corresponding columns in the agg_result table. -
From the state_city table, drop postal, state, capital and mostpopulouscity to the corresponding
columns in the agg_result table.In this scenario, context variables are not used in the
Expression column in the Map editor. If you use context
variables, put them in single quotation marks. For example: -
Click OK to validate these
changes.
Configuring the output schema
-
Double-click tELTHiveOutput to open its
Component view. -
If this component does not have the same schema of the preceding
component, a warning icon appears. In this case, click the Sync columns button to retrieve the schema from
the preceding one and once done, the warning icon disappears. -
In the Default table name field, enter
the output table you want to write data in. In this example, it is agg_result. -
In the Field partition table, click
to add one row. This allows you to write data in the
partition column of the agg_result
table.This partition column was defined the moment we created the agg_result table usingpartitioned by
in the Create statement presented earlier. This
(type string)
partition column is type, which describes
the type of a customer. -
In Partition column, enter type without any quotation marks and in
Partition value, enter prospective in single quotation marks.
Executing the Job
example,
1 |
select * from agg_result; |
This figure present only a part of the table. You can find that the selected input
columns are aggregated and written into the
agg_result table and the partition column is filled with the value
prospective.