August 17, 2023

tHiveCreateTable – Docs for ESB 5.x

tHiveCreateTable

thivecreatetable_icon32_white.png

Warning

This component will be available in the Palette of
Talend Studio on the condition that you have subscribed to one of
the Talend
solutions with Big Data.

tHiveCreateTable properties

Component family

Big Data / Hive

 

Function

This component connects to the Hive database to be used and
creates a Hive table that is dedicated to data of the format you
specify.

Purpose

This component is used to create Hive tables that fit a wide range
of Hive data formats. A proper Hive data format such as RC or ORC
allows you to obtain a better performance in processing data with
Hive.

Basic settings

Property type

Either Built-in or Repository.

 

 

Built-in: No property data stored
centrally.

 

 

Repository: Select the repository
file in which the properties are stored. The fields that follow are
completed automatically using the data retrieved.

Use an existing connection

Select this check box and in the Component List click the
relevant connection component to reuse the connection details you already defined.

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:

  1. In the parent level, register the database connection to be shared in the
    Basic settings view of the connection
    component which creates that very database connection.

  2. In the child level, use a dedicated connection component to read that
    registered database connection.

For an example about how to share a database connection across Job levels, see
Talend Studio User
Guide
.

Version

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:

  • If available in this Distribution drop-down list, the
    Microsoft HD Insight option allows you to use a
    Microsoft HD Insight cluster. For this purpose, you need to configure the
    connections to the WebHCat service, the HD Insight service and the Windows Azure
    Storage service of that cluster in the areas that are displayed. A demonstration
    video about how to configure this connection is available in the following link:
    https://www.youtube.com/watch?v=A3QTT6VsNoM

  • The Custom option allows you to connect to a
    cluster different from any of the distributions given in this list, that is to
    say, to connect to a cluster not officially supported by Talend.

In order to connect to a custom distribution, once selecting Custom, click the dotbutton.png button to display the dialog box in which you can
alternatively:

  1. Select Import from existing version to import an
    officially supported distribution as base and then add other required jar files
    which the base distribution does not provide.

  2. Select Import from zip to import a custom
    distribution zip that, for example, you can download from http://www.talendforge.org/exchange/index.php.

    Note

    In this dialog box, the active check box must be kept selected so as to import
    the jar files pertinent to the connection to be created between the custom
    distribution and this component.

    For an step-by-step example about how to connect to a custom distribution and
    share this connection, see Connecting to a custom Hadoop distribution.

 

Hive version

Select the version of the Hadoop distribution you are using. The available options vary
depending on the component you are using. Along with the evolution of Hadoop, please note
the following changes:

  • If you use Hortonworks Data Platform V2.2, the
    configuration files of your cluster might be using environment variables such as
    ${hdp.version}. If this is your situation, you
    need to set the mapreduce.application.framework.path property in the Hadoop properties table of this component with the path value
    explicitly pointing to the MapReduce framework archive of your cluster. For
    example:

  • If you use Hortonworks Data Platform V2.0.0, the
    type of the operating system for running the distribution and a Talend
    Job must be the same, such as Windows or Linux. Otherwise, you have to use Talend
    Jobserver to execute the Job in the same type of operating system in which the
    Hortonworks Data Platform V2.0.0 distribution you
    are using is run. For further information about Talend Jobserver, see
    Talend Installation
    and Upgrade Guide
    .

 

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.

 

Username and
Password

DB 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.

Authentication

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.

The values of the following parameters can be found in the hive-site.xml file of the Hive system to be used.

  1. Hive principal uses the value of hive.metastore.kerberos.principal. This is the
    service principal of the Hive Metastore.

  2. Metastore URL uses the value of javax.jdo.option.ConnectionURL. This is the JDBC
    connection string to the Hive Metastore.

  3. Driver class uses the value of javax.jdo.option.ConnectionDriverName. This is the
    name of the driver for the JDBC connection.

  4. 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.

  5. 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 Hadoop 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.

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 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 +

Hadoop properties

Set Jobtracker URI

Select this check box to indicate the location of the Jobtracker service within the Hadoop
cluster to be used. For example, we assume that you have chosen a machine called machine1 as the JobTracker, then set its location as machine1:portnumber. A Jobtracker is the service that assigns
Map/Reduce tasks to specific nodes in a Hadoop cluster. Note that the notion job in this
term JobTracker does not designate a Talend Job, but rather a Hadoop job
described as MR or MapReduce job in Apache’s Hadoop documentation on http://hadoop.apache.org.

If you use YARN in your Hadoop cluster such as Hortonworks Data
Platform V2.0.0
or Cloudera CDH4.3 + (YARN
mode)
, you need to specify the location of the Resource
Manager
instead of the Jobtracker. 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 ):

  1. Select the Set resourcemanager scheduler
    address
    check box and enter the Scheduler address in the field
    that appears.

  2. 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.

  3. 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.

  4. 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.

  5. 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.

  6. 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.

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 to indicate the location of the NameNode of the Hadoop cluster to be
used. The NameNode is the master node of a Hadoop cluster. For example, we assume that you
have chosen a machine called masternode as the NameNode
of an Apache Hadoop distribution, then the location is hdfs://masternode:portnumber.

For further information about the Hadoop Map/Reduce framework, see the Map/Reduce tutorial
in Apache’s Hadoop documentation on http://hadoop.apache.org.

Microsoft HD Insight properties

WebHCat configuration

Enter the address and the authentication information of the WebHCat service of the Microsoft
HD Insight cluster to be used. 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

Enter the authentication information of the HD Insight cluster to be used.

 

Windows Azure Storage
configuration

Enter the address and the authentication information of the Azure Storage account to be
used.

In the Container field, enter the name of the container
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.

 

Schema and Edit
Schema

A schema is a row description. It defines the number of fields to be processed and passed on
to the next component. The schema is either Built-In or
stored remotely in the Repository.

Click Edit schema to make changes to the schema. If the
current schema is of the Repository type, three options are
available:

  • View schema: choose this option to view the
    schema only.

  • Change to built-in property: choose this option
    to change the schema to Built-in for local
    changes.

  • Update repository connection: choose this option to change
    the schema stored in the repository and decide whether to propagate the changes to
    all the Jobs upon completion. If you just want to propagate the changes to the
    current Job, you can select No upon completion and
    choose this schema metadata again in the [Repository
    Content]
    window.

 

 

Built-In: You create and store the schema locally for this
component only. Related topic: see Talend Studio
User Guide.

 

 

Repository: You have already created the schema and
stored it in the Repository. You can reuse it in various projects and Job designs. Related
topic: see Talend Studio User Guide.

When the schema to be reused has default values that are integers or functions, ensure that
these default values are not enclosed within quotation marks. If they are, you must remove
the quotation marks manually.

For more details, see https://help.talend.com/display/KB/Verifying+default+values+in+a+retrieved+schema.

 

Table Name

Name of the table to be created.

 

Action on table

Select the action to be carried out for creating a table.

 

Format

Select the data format to which the table to be created is
dedicated.

The available data formats vary depending on the version of the
Hadoop distribution you are using.

Note that when the file format to be used is PARQUET, you
might be prompted to find the specific Parquet jar file and install it into the Studio.

  • When the connection mode to Hive is Embedded,
    the Job is run in your local machine and calls this jar installed in the
    Studio.

  • When the connection mode to Hive is Standalone, the Job is run in the server hosting Hive and this
    jar file is sent to the HDFS system of the cluster you are connecting to.
    Therefore, ensure that you have properly defined the NameNode URI in the
    corresponding field of the Basic settings
    view.

This jar file can be downloaded from Apache’s site. For further information
about how to install an external jar file, see https://help.talend.com/display/KB/How+to+install+external+modules+in+the+Talend+products.

 

Inputformat class and Outputformat class

These fields appear only when you have selected INPUTFORMAT and OUTPUTFORMAT from the
Format list.

These fields allow you to enter the name of the jar files to be
used for the data formats not available in the Format list.

 

Storage class

Enter the name of the storage handler to be used for creating a
non-native table (Hive table stored and managed in other systems
than Hive, for example, Cassandra or MongoDB).

This field is available only when you have selected STORAGE from the Format list.

For further information about a storage handler, see https://cwiki.apache.org/confluence/display/Hive/StorageHandlers.

  Set partitions

Select this check box to add partition columns to the table to be
created. Once selecting it, you need to define the schema of the
partition columns you need to add.

 

Set file location

If you want to create a Hive table in a directory other than the
default one, select this check box and enter the directory in HDFS
you want to use to hold the table content.

This is typical useful when you need to create an external Hive
table by selecting the Create an external
table
check box in the Advanced
settings
tab.

 

Use S3 endpoint

The Use S3 endpoint check box is
displayed when you have selected the Set file
location
check box to create an external Hive table.

Once this Use S3 endpoint check box is selected, you need
to enter the following parameters in the fields that appear:

  • S3 bucket: enter the name of the bucket in
    which you need to create the table.

  • Access key and Secret
    key
    : enter the authentication information required to connect to
    the Amazon S3 bucket to be used.

    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.

Note that the format of the S3 file is S3N (S3 Native Filesystem).

Since a Hive table created in S3 is actually an external table,
this Use S3 endpoint check box must
be used with the Create an external
table
case being selected.

Row format

Set Delimited row format

Select this check box to use the Delimited row format as the
storage format of data in the Hive table to be created. Once
selecting it, you can further to specify the delimiter(s) for the
data you need to load to the table. This Delimited format is also
the default format which is used when you have not selected either
this check box or the Set SerDe row
format
check box.

  • The Field delimiter is to
    separate fields of the data.

  • The Collection item
    delimiter is to separate elements in an Array or Struct
    instance of the data or key-value pairs in a Map instance of
    the data.

  • The Map key delimiter is
    to separate the key and the value in a Map instance of the
    data.

  • The Line delimiter is to
    separate data rows.

For further information about the delimiters and the data types
mentioned in this list, see Apache’s documentation about Hive or the
documentation of the Hadoop distribution you are using.

In defining the Field delimiter,
you can as well define the escaping character you need to use by
selecting the Escape check box and
entering that character. Otherwise, the backward slash () is used
by default.

Note that this check box is not available when you have selected
AVRO or STORAGE from the Format list.

 

Set SerDe row format

Select this check box to use the SerDe row format as the storage
format of data in the Hive table to be created. Once selecting it,
you need to enter the name of the Java class that implements the
Hive SerDe interface you need to use.

This Java class might have to be developed by yourself or is
simply among the jars provided in the Hadoop distribution you are
using.

Note that this check box is not available when you have selected
AVRO, PARQUET or STORAGE
from the Format list.

 

Die on error

Select this check box to kill the Job when an error occurs.

Advanced settings

Like table

Select this check box and enter the name of the Hive table you
want to copy. This allows you to copy the definition of an existing
table without copying its data.

For further information about the Like parameter, see Apache’s
information about Hive’s Data Definition Language.

 

Create an external table

Select this check box to make the table to be created an external
Hive table. This kind of Hive table leaves the raw data where it is
if the data is in HDFS.

An external table is usually the better choice for accessing
shared data existing in a file system.

For further information about an external Hive table, see Apache’s
documentation about Hive.

 

Table comment

Enter the description you want to use for the table to be
created.

 

As select

Select this check box and enter the As select
statement for creating a Hive table that is based on a
Select statement.

 

Set clustered_by or skewed_by
statement

Enter the Clustered by statement to cluster the data
of a table or a partition into buckets, or/and enter the
Skewed by statement to allow Hive to extract the
heavily skewed data and put it into separate files. This is
typically used for obtaining better performance during
queries.

 

SerDe properties

If you are using the SerDe row format, you can add any custom
SerDe properties to override the default ones used by the Hadoop
engine of the Studio.

 

Table properties

Add any custom Hive table properties you want to override the
default ones used by the Hadoop engine of the Studio.

Temporary path

If you do not want to set the Jobtracker and the NameNode when you execute the query
select * from your_table_name, you need to set this temporary path. For
example, /C:/select_all in Windows.

 

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.

  • Note that if you are using the centrally stored metadata from the Repository, this table automatically inherits the
    properties defined in that metadata and becomes uneditable unless you change the
    Property type from Repository to Built-in.

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.

  • Note that if you are using the centrally stored metadata from the Repository, this table automatically inherits the
    properties defined in that metadata and becomes uneditable unless you change the
    Property type from Repository to Built-in.

 

Mapred job map memory mb and
Mapred job reduce memory
mb

If the Hadoop distribution to be used is Hortonworks Data Platform V1.2 or Hortonworks
Data Platform V1.3, you need to set proper memory allocations for the map and reduce
computations to be performed by the Hadoop system.

In that situation, you need to enter the values you need in the Mapred
job map memory mb
and the Mapred job reduce memory
mb
fields, respectively. By default, the values are both 1000 which are normally appropriate for running the
computations.

If the distribution is YARN, then the memory parameters to be set become Map (in Mb), Reduce (in Mb) and
ApplicationMaster (in Mb), accordingly. These fields
allow you to dynamically allocate memory to the map and the reduce computations and the
ApplicationMaster of YARN.

 

Path separator in server

Leave the default value of the Path separator in server as
it is, unless you have changed the separator used by your Hadoop distribution’s host machine
for its PATH variable or in other words, that separator is not a colon (:). In that
situation, you must change this value to the one you are using in that host.

 

tStatCatcher Statistics

Select this check box to collect log data at the component
level.

Dynamic settings

Click the [+] button to add a row in the table and fill
the Code field with a context variable to choose your
database connection dynamically from multiple connections planned in your Job. This feature
is useful when you need to access database tables having the same data structure but in
different databases, especially when you are working in an environment where you cannot
change your Job settings, for example, when your Job has to be deployed and executed
independent of Talend Studio.

The Dynamic settings table is available only when the
Use an existing connection check box is selected in the
Basic settings view. Once a dynamic parameter is
defined, the Component List box in the Basic settings view becomes unusable.

For more information on Dynamic settings and context
variables, see Talend Studio User Guide.

Global Variables

QUERY: the SQL query statement being processed. This is a
Flow variable and it returns a string.

ERROR_MESSAGE: the error message generated by the
component when an error occurs. This is an After variable and it returns a string. This
variable functions only if the Die on error check box is
cleared, if the component has this check box.

A Flow variable functions during the execution of a component while an After variable
functions after the execution of the component.

To fill up a field or expression with a variable, press Ctrl +
Space
to access the variable list and choose the variable to use from it.

For further information about variables, see Talend Studio
User Guide.

Usage

This component works standalone.

If the Studio used to connect to a Hive database is operated on Windows, you must manually
create a folder called tmp in the root of the disk where
this Studio is installed.

Prerequisites

The Hadoop distribution must be properly installed, so as to guarantee the interaction
with Talend Studio. The following list presents MapR related information for
example.

  • Ensure that you have installed the MapR client in the machine where the Studio is,
    and added the MapR client library to the PATH variable of that machine. According
    to MapR’s documentation, the library or libraries of a MapR client corresponding to
    each OS version can be found under MAPR_INSTALL
    hadoophadoop-VERSIONlib
    ative
    . For example, the library for
    Windows is lib
    ativeMapRClient.dll
    in the MapR
    client jar file. For further information, see the following link from MapR: http://www.mapr.com/blog/basic-notes-on-configuring-eclipse-as-a-hadoop-development-environment-for-mapr.

    Without adding the specified library or libraries, you may encounter the following
    error: no MapRClient in java.library.path.

  • Set the -Djava.library.path argument, for example, in the Job Run VM arguments area
    of the Run/Debug view in the [Preferences] dialog box. This argument provides to the Studio the
    path to the native library of that MapR client. This allows the subscription-based
    users to make full use of the Data viewer to view
    locally in the Studio the data stored in MapR. For further information about how to
    set this argument, see the section describing how to view data of Talend Big Data Getting Started Guide.

For further information about how to install a Hadoop distribution, see the manuals
corresponding to the Hadoop distribution you are using.

Log4j

The activity of this component can be logged using the log4j feature. For more information on this feature, see Talend Studio User
Guide
.

For more information on the log4j logging levels, see the Apache documentation at http://logging.apache.org/log4j/1.2/apidocs/org/apache/log4j/Level.html.

Related scenario

For a related scenario, see Scenario: creating a partitioned Hive table.


Document get from Talend https://help.talend.com
Thank you for watching.
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x