Table of Contents

Search

  1. Preface
  2. Mappings
  3. Mapplets
  4. Mapping Parameters
  5. Where to Assign Parameters
  6. Mapping Outputs
  7. Generate a Mapping from an SQL Query
  8. Dynamic Mappings
  9. How to Develop and Run a Dynamic Mapping
  10. Dynamic Mapping Use Cases
  11. Mapping Administration
  12. Export to PowerCenter
  13. Import From PowerCenter
  14. Performance Tuning
  15. Pushdown Optimization
  16. Partitioned Mappings
  17. Developer Tool Naming Conventions

Developer Mapping Guide

Developer Mapping Guide

Parameters in Custom Queries for Hive Sources

Parameters in Custom Queries for Hive Sources

When you use a string parameter in a SQL override, a join expression, or a filter query for a Hive source, you need to add quotes around the parameter reference if the parameter represents a literal value. You can use single or double quotes. This requirement is for Hive sources in mappings that run in the native execution environment or in the Hadoop execution environment.
For example, you need to create a filter that selects Hive source rows with a specific department name. You create a string parameter that represents the department name. You assign a default value of R&D for the department name parameter.
The following image shows the string parameter:
The Parameters tab shows a parameter called NewParameter, type string, precision 1000, default value R&D.
When you use the parameter in a filter query for a Hive source, you must include quotes around the parameter name. Otherwise the mapping fails at run time with a SQL parser error.
The following image shows the filter query for the Hive source on the
Query
view of the
Properties
tab:
The Query view on the Properties tab for a Hive source contains the following filter: dept.deptname="$NewParameter". Double quotes surround $NewParameter.
By default, the Expression editor does not add the quotes around the parameter. You must manually add them.
You do not need to add single or double quotes around the parameter name if the parameter contains a column name or a sub query name.
The following image show a string parameter with a default value that is a column name:
The Parameters tab shows a parameter called NewParameter, type string, precision 1000, default value dept.externam_deptname.
The following image shows a filter query that uses the parameter:
The Query view on the Properties tab for a Hive source contains the following filter: dept.deptname=$NewParameter. The $NewParameter does not have double quotes.

0 COMMENTS

We’d like to hear from you!