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

[INLONG-10130][SDK] Transform SQL support string concat function #10143

Merged
merged 2 commits into from
May 7, 2024

Conversation

luchunliang
Copy link
Contributor

Fixes #10130

Motivation

Transform SQL support string concat function

Modifications

  • Support to parse the following PB protocol
    syntax = "proto3";
    package test;
    message SdkMessage {
    bytes msg = 1;
    int64 msgTime = 2;
    map<string, string> extinfo = 3;
    }
    message SdkDataRequest {
    string sid = 1;
    repeated SdkMessage msgs = 2;
    uint64 packageID = 3;
    }

  • Support to parse the following PB data
    SdkDataRequest.Builder requestBuilder = SdkDataRequest.newBuilder();
    requestBuilder.setSid("sid");
    requestBuilder.setPackageID(1);
    {
    SdkMessage.Builder msgBuilder = SdkMessage.newBuilder();
    msgBuilder.setMsgTime(1713243918000L);
    msgBuilder.setMsg(ByteString.copyFrom("msgValue4".getBytes()));
    msgBuilder.putExtinfo("key", "value");
    SdkMessage msgObj = msgBuilder.build();
    requestBuilder.addMsgs(msgObj);
    }
    {
    SdkMessage.Builder msgBuilder = SdkMessage.newBuilder();
    msgBuilder.setMsgTime(1713243918002L);
    msgBuilder.setMsg(ByteString.copyFrom("msgValue42".getBytes()));
    msgBuilder.putExtinfo("key2", "value2");
    SdkMessage msgObj = msgBuilder.build();
    requestBuilder.addMsgs(msgObj);
    }
    SdkDataRequest requestObj = requestBuilder.build();
    byte[] srcBytes = requestObj.toByteArray();

  • Generate the final data by the following SQL
    select $root.sid,$root.packageID,$child.msgTime,concat($root.sid,$root.packageID,$child.msgTime,$child.msg) msg from source

  • The final data is the following string
    sid|1|1713243918000|sid11713243918000msgValue4
    sid|1|1713243918002|sid11713243918002msgValue42

Verifying this change

(Please pick either of the following options)

  • This change is a trivial rework/code cleanup without any test coverage.

  • This change is already covered by existing tests, such as:
    (please describe tests)

  • This change added tests and can be verified as follows:

    (example:)

    • Added integration tests for end-to-end deployment with large payloads (10MB)
    • Extended integration test for recovery after broker failure

Documentation

  • Does this pull request introduce a new feature? (yes / no)
  • If yes, how is the feature documented? (not applicable / docs / JavaDocs / not documented)
  • If a feature is not applicable for documentation, explain why?
  • If a feature is not documented yet in this PR, please create a follow-up issue for adding the documentation

@luchunliang luchunliang added this to the 1.13.0 milestone May 7, 2024
@luchunliang luchunliang self-assigned this May 7, 2024
Copy link
Contributor

@aloyszhang aloyszhang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@dockerzhang dockerzhang merged commit 9c40c95 into apache:master May 7, 2024
8 checks passed
herywang pushed a commit to herywang/inlong that referenced this pull request May 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Feature][SDK] Transform SQL support string concat function
3 participants