Skip to content

Commit c6c09e7

Browse files
hutiefang76hutiefang
andauthored
[ISSUE-5130][EC-JDBC] Map NUMERIC columns to decimal (#5445)
Co-authored-by: hutiefang <hutiefang@qq.com>
1 parent 6dcc6ae commit c6c09e7

2 files changed

Lines changed: 36 additions & 0 deletions

File tree

  • linkis-engineconn-plugins/jdbc/src

‎linkis-engineconn-plugins/jdbc/src/main/scala/org/apache/linkis/manager/engineplugin/jdbc/executor/JDBCHelper.java‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public static String getTypeStr(int type) {
145145
case Types.BINARY:
146146
retVal = BinaryType.typeName();
147147
break;
148+
case Types.NUMERIC:
148149
case Types.DECIMAL:
149150
retVal = DecimalType.typeName();
150151
break;
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Licensed to the Apache Software Foundation (ASF) under one or more
3+
* contributor license agreements. See the NOTICE file distributed with
4+
* this work for additional information regarding copyright ownership.
5+
* The ASF licenses this file to You under the Apache License, Version 2.0
6+
* (the "License"); you may not use this file except in compliance with
7+
* the License. You may obtain a copy of the License at
8+
*
9+
* http://www.apache.org/licenses/LICENSE-2.0
10+
*
11+
* Unless required by applicable law or agreed to in writing, software
12+
* distributed under the License is distributed on an "AS IS" BASIS,
13+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
* See the License for the specific language governing permissions and
15+
* limitations under the License.
16+
*/
17+
18+
package org.apache.linkis.manager.engineplugin.jdbc.executor;
19+
20+
import org.apache.linkis.storage.domain.DecimalType;
21+
22+
import java.sql.Types;
23+
24+
import org.junit.jupiter.api.Assertions;
25+
import org.junit.jupiter.api.DisplayName;
26+
import org.junit.jupiter.api.Test;
27+
28+
public class JDBCHelperTest {
29+
30+
@Test
31+
@DisplayName("numeric JDBC columns should map to Linkis decimal type")
32+
public void numericColumnsShouldMapToDecimalType() {
33+
Assertions.assertEquals(DecimalType.typeName(), JDBCHelper.getTypeStr(Types.NUMERIC));
34+
}
35+
}

0 commit comments

Comments
 (0)