Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature][Transform][JsonPath] 2.3.8版本不支持对象数组的提取 #8400

Open
2 of 3 tasks
valtenhyl opened this issue Dec 29, 2024 · 0 comments
Open
2 of 3 tasks
Labels

Comments

@valtenhyl
Copy link

Search before asking

  • I had searched in the feature and found no similar feature requirement.

Description

JsonPath 支持 map<string, string> 和array,不支持 array<map<string, string>>,有别的方式可以实现存入 Elasticsearch 的是 nested 的对象,而不是转义的 json 字符串吗

env {
  parallelism = 4
  job.mode = "BATCH"
}
source{
    Jdbc {
        url = "jdbc:dm://192.168.1.1:5236"
        driver = "dm.jdbc.driver.DmDriver"
        connection_check_timeout_sec = 100
        user = "xxx"
        password = "xxx"
        query = "SELECT sfzh, CONCAT('[',LISTAGG(json, ','),']') json_data FROM (SELECT sfzh, JSON_OBJECT('sfzh', sfzh, 'school', school, 'stex', stex) AS json FROM PICS.TB_EDU_INFO GROUP BY sfzh"
        result_table_name = "input_t"
        fetch_size = 1000
    }
}

transform {

  JsonPath {
    source_table_name = "input_t"
    result_table_name = "input_t2"
    columns = [
     {
        "src_field" = "json_data"
        "path" = "$"
        "dest_field" = "edu"
        "dest_type" = "array<map<string, string>>"
     }
    ]
  }  

  Filter {
    source_table_name = "input_t2"
    result_table_name = "input_t3"
    fields = [sfzh, edu]
  }  
}

sink {
    Elasticsearch {
        hosts = ["http://192.168.1.1:9200"]
        source_table_name = "input_t3"
        index = "index_user"
        primary_keys = ["sfzh"]   
        bulk_flush_max_actions = 1000
        bulk_flush_interval = 2000
        schema_save_mode = "CREATE_SCHEMA_WHEN_NOT_EXIST"
        data_save_mode = "APPEND_DATA"
    }
}

Usage Scenario

No response

Related issues

No response

Are you willing to submit a PR?

  • Yes I am willing to submit a PR!

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants