NiFi:ReplaceTextWithMapping处理器

编程入门 行业动态 更新时间:2024-10-10 07:30:14
本文介绍了NiFi:ReplaceTextWithMapping处理器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

我有以下插入语句:

  • insert into temp1 values (test1, test2)

    insert into temp2 values (test3)

    预期结果:

  • insert into temp1 values (100, 200)

    insert into temp2 values (300)

    本质上,我想分别用值100,200替换第一个查询文字test1,test2,对于第二个查询,用值300替换test3.有人可以为上述用例提供映射文件帮助吗?

    Essentially, I wanted to replace the first query literals test1, test2 with value 100, 200 respectively and for the second query replace test3 with value 300. Can someone help with the mapping file for the above use case?

    我尝试了以下操作,但没有任何效果.

    I tried with the following, but it doesn't have any effect.

    搜索值(RegEx)替换值

    Search Value (RegEx) Replacement values

    (1)(.*values.*)(.*test1)(.*,)(.*test2) -> $2 val1 $4 val2 (2)(.*values.*)(.*test1) -> $2 val3

    推荐答案

    如果从字面上看这是您需要执行的映射范围,那么常规的ReplaceText处理器就足够了.使用以下设置可得到所需的输出:

    If this is literally the extent of the mapping you need to perform, a regular ReplaceText processor is enough. Using the settings below results in the desired output:

    它仅检测test的每个实例,后跟一个数字,并将其替换为该数字和00.

    It simply detects every instance of test followed by a single digit and replaces it with that digit and 00.

    如果您需要使用ReplaceTextWithMapping进行更复杂的查找,则映射文件的格式必须为:

    If you need to use ReplaceTextWithMapping for more complex lookups, the mapping file must be of the format:

    search_value_1 replacement_value_1 search_value_2 replacement_value_2 etc.

    搜索值和替换值之间的分隔符为 \ t .

    The delimiter between the search and replacement values is \t.

    -------------------------------------------------- Standard FlowFile Attributes Key: 'entryDate' Value: 'Wed Dec 07 10:48:24 PST 2016' Key: 'lineageStartDate' Value: 'Wed Dec 07 10:48:24 PST 2016' Key: 'fileSize' Value: '66' FlowFile Attribute Map Content Key: 'filename' Value: '56196144045589' Key: 'path' Value: './' Key: 'uuid' Value: 'f6b28eb0-73b5-4d94-86c2-b7a5d4cc991e' -------------------------------------------------- insert into temp1 values (100, 200) insert into temp2 values (300)
  • 更多推荐

    NiFi:ReplaceTextWithMapping处理器

    本文发布于:2023-11-27 21:42:36,感谢您对本站的认可!
    本文链接:https://www.elefans.com/category/jswz/34/1639700.html
    版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
    本文标签:处理器   NiFi   ReplaceTextWithMapping

    发布评论

    评论列表 (有 0 条评论)
    草根站长

    >www.elefans.com

    编程频道|电子爱好者 - 技术资讯及电子产品介绍!