首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Pentaho数据集成映射

Pentaho数据集成映射
EN

Stack Overflow用户
提问于 2012-07-25 02:56:52
回答 2查看 987关注 0票数 0

我正在使用Pentaho data Integration,我创建了一个新的转换,其中有两个步骤……一个是我的数据的CSV文件,第二个是包含两列的Excel文件,一个是州名称,另一个是州名称的排序形式,例如("New York“"NY")

在我的CSV文件中,我有一个带有州名称"New York“的state列,我想使用我的excel文件将"New York”映射到"NY“

我用谷歌搜索了一整天,没有清晰的answer...can,有人能帮我吗?

EN

回答 2

Stack Overflow用户

发布于 2016-11-18 21:15:48

您可以使用Merge Join。使用此选项,您可以合并这两个文件并选择所需的列。在合并之前,您必须根据用于映射的字段对这些文件进行排序。在您的例子中,它将是state name

票数 0
EN

Stack Overflow用户

发布于 2016-11-18 22:00:44

我建议您使用流查找来完成此任务。检查附加的测试转换。它会完成你的任务。

代码语言:javascript
复制
<?xml version="1.0" encoding="UTF-8"?>
<transformation-steps>
<steps>
  <step>
    <name>EXCEL</name>
    <type>DataGrid</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <fields>
      <field>
        <name>State</name>
        <type>String</type>
        <format/>
        <currency/>
        <decimal/>
        <group/>
        <length>-1</length>
        <precision>-1</precision>
        <set_empty_string>N</set_empty_string>
      </field>
      <field>
        <name>Short_state</name>
        <type>String</type>
        <format/>
        <currency/>
        <decimal/>
        <group/>
        <length>-1</length>
        <precision>-1</precision>
        <set_empty_string>N</set_empty_string>
      </field>
    </fields>
    <data>
      <line> <item>New York</item><item>TX</item> </line>
      <line> <item>Texas</item><item>TX</item> </line>
    </data>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>392</xloc>
      <yloc>80</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>CSV</name>
    <type>DataGrid</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <fields>
      <field>
        <name>Full_state_name</name>
        <type>String</type>
        <format/>
        <currency/>
        <decimal/>
        <group/>
        <length>-1</length>
        <precision>-1</precision>
        <set_empty_string>N</set_empty_string>
      </field>
    </fields>
    <data>
      <line> <item>New York</item> </line>
      <line> <item>Texas</item> </line>
    </data>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>511</xloc>
      <yloc>169</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

  <step>
    <name>Stream lookup</name>
    <type>StreamLookup</type>
    <description/>
    <distribute>Y</distribute>
    <custom_distribution/>
    <copies>1</copies>
         <partitioning>
           <method>none</method>
           <schema_name/>
           </partitioning>
    <from>EXCEL</from>
    <input_sorted>N</input_sorted>
    <preserve_memory>Y</preserve_memory>
    <sorted_list>N</sorted_list>
    <integer_pair>N</integer_pair>
    <lookup>
      <key>
        <name>Full_state_name</name>
        <field>State</field>
      </key>
      <value>
        <name>State</name>
        <rename>State</rename>
        <default/>
        <type>String</type>
      </value>
      <value>
        <name>Short_state</name>
        <rename>Short_state</rename>
        <default/>
        <type>String</type>
      </value>
    </lookup>
     <cluster_schema/>
 <remotesteps>   <input>   </input>   <output>   </output> </remotesteps>    <GUI>
      <xloc>510</xloc>
      <yloc>79</yloc>
      <draw>Y</draw>
      </GUI>
    </step>

</steps>
<order>
  <hop> <from>EXCEL</from><to>Stream lookup</to><enabled>Y</enabled> </hop>
  <hop> <from>CSV</from><to>Stream lookup</to><enabled>Y</enabled> </hop>
</order>
<notepads>
</notepads>
<step_error_handling>
</step_error_handling>
</transformation-steps>

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11637488

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档