Skip to content

[Improve][Transform][SQL] Support cast to TINYINT/SMALLINT #9347

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

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

hailin0
Copy link
Member

@hailin0 hailin0 commented May 21, 2025

Purpose of this pull request

Does this PR introduce any user-facing change?

How was this patch tested?

Check list

@hailin0 hailin0 requested a review from Copilot May 21, 2025 06:00
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This pull request extends the SQL cast functionality in SeaTunnel to support conversions to TINYINT and SMALLINT.

  • Added unit tests in CastFunctionTest.java to verify the new cast behavior.
  • Updated SystemFunction.java to handle TINYINT and SMALLINT conversions using Byte.parseByte and Short.parseShort.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
seatunnel-transforms-v2/src/test/java/org/apache/seatunnel/transform/sql/zeta/CastFunctionTest.java Introduces a new test case validating TINYINT and SMALLINT casts.
seatunnel-transforms-v2/src/main/java/org/apache/seatunnel/transform/sql/zeta/functions/SystemFunction.java Adds new cases in the cast function to support TINYINT and SMALLINT types.
Comments suppressed due to low confidence (1)

seatunnel-transforms-v2/src/test/java/org/apache/seatunnel/transform/sql/zeta/CastFunctionTest.java:33

  • Consider adding edge case tests for invalid or out-of-range values (e.g., non-numeric strings or values exceeding byte/short limits) for TINYINT and SMALLINT casts to improve test coverage.
public void testCastFunction() {

Copy link
Member

@Hisoka-X Hisoka-X left a comment

Choose a reason for hiding this comment

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

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.

2 participants