-
Notifications
You must be signed in to change notification settings - Fork 619
[MHA] fix issue-2779 #2780
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
HanchiMed
wants to merge
8
commits into
ClickHouse:main
Choose a base branch
from
HanchiMed:issue-2779
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
[MHA] fix issue-2779 #2780
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
cbd7b6d
[MHA] fix issue-2779
231eda4
[MHA] fix issue-2779 : apply reviewer requests
b79b4ec
[MHA] Adding tests for issue-2779
43add8e
[MHA] Adding BigInteger conversion handler in convertObject method
2d821e9
[MHA] Adding integration test
6a7361c
[MHA] update Unit Tests
56a84ab
[MHA] delete import java.math.BigInteger
3cd682e
[MHA] map BigInteger to Types.NUMERIC instead of Types.DECIMAL
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
clickhouse-jdbc/src/test/java/com/clickhouse/jdbc/JdbcTypeMappingTest.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| package com.clickhouse.jdbc; | ||
|
|
||
| import com.clickhouse.data.ClickHouseColumn; | ||
| import com.clickhouse.data.ClickHouseDataType; | ||
| import org.testng.annotations.Test; | ||
|
|
||
| import java.math.BigDecimal; | ||
| import java.math.BigInteger; | ||
| import java.sql.Types; | ||
|
|
||
| import static org.testng.Assert.assertEquals; | ||
|
|
||
| public class JdbcTypeMappingTest { | ||
|
|
||
| private final JdbcTypeMapping mapping = JdbcTypeMapping.getDefaultMapping(); | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testInt128Mapping() { | ||
| ClickHouseColumn col = ClickHouseColumn.of("col", ClickHouseDataType.Int128, false, false); | ||
| assertEquals(mapping.toSqlType(col, null), Types.NUMERIC); | ||
| assertEquals(mapping.toJavaClass(col, null), BigInteger.class); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testInt256Mapping() { | ||
| ClickHouseColumn col = ClickHouseColumn.of("col", ClickHouseDataType.Int256, false, false); | ||
| assertEquals(mapping.toSqlType(col, null), Types.NUMERIC); | ||
| assertEquals(mapping.toJavaClass(col, null), BigInteger.class); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testUInt64Mapping() { | ||
| ClickHouseColumn col = ClickHouseColumn.of("col", ClickHouseDataType.UInt64, false, false); | ||
| assertEquals(mapping.toSqlType(col, null), Types.NUMERIC); | ||
| assertEquals(mapping.toJavaClass(col, null), BigInteger.class); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testUInt128Mapping() { | ||
| ClickHouseColumn col = ClickHouseColumn.of("col", ClickHouseDataType.UInt128, false, false); | ||
| assertEquals(mapping.toSqlType(col, null), Types.NUMERIC); | ||
| assertEquals(mapping.toJavaClass(col, null), BigInteger.class); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testUInt256Mapping() { | ||
| ClickHouseColumn col = ClickHouseColumn.of("col", ClickHouseDataType.UInt256, false, false); | ||
| assertEquals(mapping.toSqlType(col, null), Types.NUMERIC); | ||
| assertEquals(mapping.toJavaClass(col, null), BigInteger.class); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testBigIntegerToSqlType() { | ||
| // Test that BigInteger class is mapped to Types.NUMERIC (not DECIMAL) | ||
| assertEquals(mapping.getSqlType(BigInteger.class), Types.NUMERIC); | ||
| } | ||
|
|
||
| @Test(groups = {"unit"}) | ||
| public void testBigDecimalToSqlType() { | ||
| // Test that BigDecimal class is still mapped to Types.DECIMAL | ||
| assertEquals(mapping.getSqlType(BigDecimal.class), Types.DECIMAL); | ||
| } | ||
| } | ||
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.