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-11081][SDK] Transform SQL supports INTERVAL parse #11086

Merged
merged 1 commit into from
Sep 20, 2024

Conversation

Zkplo
Copy link
Contributor

@Zkplo Zkplo commented Sep 12, 2024

Fixes #11081

Motivation

Based on Mysql:

  1. Added IntervalParser class

IntervalParser  <-> INTERVAL expr unit ->  Pair(factor,Map(ChronoField,Count)):
`factor`:
   1) `expr` can accept strings starting with '-', representing the meaning of subtraction.
      So the positive or negative sign of `factor` indicates whether `expr` starts with a '-' or not.
   2) For units like WEEK and QUARTER, it is not easy to parse,
      so WEEK -> ( unit=DAY, adb(factor)=7 ); QUARTER -> ( unit=MONTH, adb(factor)=3 ).
`Map(ChronoField,Count)`:
   IntervalParser will automatically match the corresponding DateTimeFormatter based on the input `expr`,
   Based on DateTimeFormatter, IntervalParser will parse the incoming units and store them in a Map.

 In addition,acceptable expression parsing and specifying parameters in two ways:
     1) interval rowName year -> expression
     3) interval 2 year       -> fixed parameter
  1. Modified AdditionParser and SubtractionParser to have the ability of time calculation.
  2. Also, add the corresponding unit test classe: TestAdditionParser, TestSubtractionParser

Modifications

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

@dockerzhang dockerzhang merged commit d4df5ed into apache:master Sep 20, 2024
8 checks passed
Zkplo added a commit to Zkplo/inlong that referenced this pull request Sep 21, 2024
Co-authored-by: ZKpLo <14148880+zkplo@user.noreply.gitee.com>
@Zkplo Zkplo deleted the INLONG-11081 branch September 22, 2024 10:10
PeterZh6 pushed a commit to PeterZh6/inlong that referenced this pull request Sep 23, 2024
Co-authored-by: ZKpLo <14148880+zkplo@user.noreply.gitee.com>
wohainilaodou pushed a commit to wohainilaodou/inlong that referenced this pull request Oct 8, 2024
Co-authored-by: ZKpLo <14148880+zkplo@user.noreply.gitee.com>
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 supports INTERVAL parse
3 participants