云日志服务 LTS-操作符函数:op_nullif

时间:2025-03-03 16:33:03

op_nullif

如果表达式1等于表达式2,返回None。否则返回表达式1的值。

  • 函数格式
    op_nullif(expression1, expression2)
  • 参数说明

    参数名称

    参数类型

    是否必填

    说明

    expression1

    任意

    表达式1。

    expression2

    任意

    表达式2。

  • 返回结果

    如果表达式1和表达式2相等返回None,否则返回表达式1的值。

  • 函数示例
    1. 示例1:
      • 测试数据
        {
         "test_if": "hello",
         "escape_name": "Etl"
        }
      • 加工规则
        e_set("test_ifnull", op_nullif(v("test_if"),v("escape_name")))
      • 加工结果
        test_if: hello
        escape_name: Etl 
        test_ifnull:  hello
    2. 示例2:
      • 测试数据
        {
         "test_if": "hello",
         "escape_name": "hello"
        }
      • 加工规则
        e_set("test_ifnull", op_nullif(v("content"),v("escape_name")))
      • 加工结果
        #因为content与escape_name内容一样,所以没有任何内容返回给test_isnull字段。
        test_if: hello 
        escape_name: hello
support.huaweicloud.com/usermanual-lts/lts_07_0158.html