flink icon indicating copy to clipboard operation
flink copied to clipboard

[FLINK-12450] Add leftshift, rightshift functions support in Table API and SQL

Open kartikeypant opened this issue 1 year ago • 6 comments

What is the purpose of the change

  • The purpose of this change is to enhance the Flink Table API and SQL by introducing new bitwise functions: shiftleft and shiftright. These will also improve compatibility with Hive since Hive also provides the functions with the same names.
  • These functions will allow users to perform bitwise left shift and right shift operations directly within their SQL queries and Table API expressions.
  • This change is associated to the following Jira Feature: FLINK-12450

Brief change log

  • Adds classes org.apache.flink.table.runtime.functions.scalar.BitRightShiftFunction and org.apache.flink.table.runtime.functions.scalar.BitRightShiftFunction.
  • Modifies org.apache.flink.table.functions.BuiltInFunctionDefinitions to add shiftleft and shiftright functions.
  • Modifies org.apache.flink.table.api.internal.BaseExpressions to add shiftleft and shiftright functions.

Verifying this change

  • Added relevant tests for the functions to test the functional correctness in class MathFunctionsITCase.

Does this pull request potentially affect one of the following parts:

  • Dependencies (does it add or upgrade a dependency): no
  • The public API, i.e., is any changed class annotated with @Public(Evolving): yes
  • The serializers: no
  • The runtime per-record code paths (performance sensitive): no
  • Anything that affects deployment or recovery: JobManager (and its components), Checkpointing, Kubernetes/Yarn, ZooKeeper: no
  • The S3 file system connector: no

Documentation

  • Does this pull request introduce a new feature? yes
  • If yes, how is the feature documented? yes

kartikeypant avatar Jul 08 '24 17:07 kartikeypant

CI report:

  • 510e71ba06dd23c5d2888f3a5765a292a5baa005 UNKNOWN
  • 56a78186a4c0c78fd6e45230b93cf552575bef5f Azure: SUCCESS
Bot commands The @flinkbot bot supports the following commands:
  • @flinkbot run azure re-run the last Azure build

flinkbot avatar Jul 08 '24 17:07 flinkbot

Thanks for the review, @superdiaodiao. Updated the PR to fix the tests.

kartikeypant avatar Jul 10 '24 09:07 kartikeypant

Thanks for the review, @superdiaodiao. Updated the PR to fix the tests.

You're welcome! ^_^ I left some suggestion just now, please take a look.

superdiaodiao avatar Jul 11 '24 02:07 superdiaodiao

Thanks for the helpful review @superdiaodiao.

kartikeypant avatar Jul 18 '24 10:07 kartikeypant

@snuyanzin @lincoln-lil - can you please take a look at this PR?

kartikeypant avatar Jul 18 '24 10:07 kartikeypant

@flinkbot run azure

kartikeypant avatar Jul 18 '24 12:07 kartikeypant

This PR is being marked as stale since it has not had any activity in the last 90 days. If you would like to keep this PR alive, please leave a comment asking for a review. If the PR has merge conflicts, update it with the latest from the base branch.

If you are having difficulty finding a reviewer, please reach out to the community, contact details can be found here: https://flink.apache.org/what-is-flink/community/

If this PR is no longer valid or desired, please feel free to close it. If no activity occurs in the next 30 days, it will be automatically closed.

github-actions[bot] avatar Apr 06 '25 06:04 github-actions[bot]

This PR has been closed since it has not had any activity in 120 days. If you feel like this was a mistake, or you would like to continue working on it, please feel free to re-open the PR and ask for a review.

github-actions[bot] avatar May 07 '25 06:05 github-actions[bot]