Skip to content

Commit

Permalink
[Fix] Fix read from Oracle Date type value lose time (#5814)
Browse files Browse the repository at this point in the history
  • Loading branch information
Hisoka-X authored Nov 11, 2023
1 parent 7d8028a commit 2d704e3
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ public SeaTunnelDataType<?> toSeaTunnelType(
case ORACLE_XML:
return BasicType.STRING_TYPE;
case ORACLE_DATE:
return LocalTimeType.LOCAL_DATE_TYPE;
case ORACLE_TIMESTAMP:
case ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return LocalTimeType.LOCAL_DATE_TIME_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,6 @@ public class OracleTypeMapper implements JdbcDialectTypeMapper {
public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex)
throws SQLException {
String oracleType = metadata.getColumnTypeName(colIndex).toUpperCase();
String columnName = metadata.getColumnName(colIndex);
int precision = metadata.getPrecision(colIndex);
int scale = metadata.getScale(colIndex);
switch (oracleType) {
Expand Down Expand Up @@ -110,7 +109,6 @@ public SeaTunnelDataType<?> mapping(ResultSetMetaData metadata, int colIndex)
case ORACLE_XML:
return BasicType.STRING_TYPE;
case ORACLE_DATE:
return LocalTimeType.LOCAL_DATE_TYPE;
case ORACLE_TIMESTAMP:
case ORACLE_TIMESTAMP_WITH_LOCAL_TIME_ZONE:
return LocalTimeType.LOCAL_DATE_TIME_TYPE;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,23 @@ public class JdbcOracleIT extends AbstractJdbcIT {
+ " XML_TYPE_COL \"SYS\".\"XMLTYPE\"\n"
+ ")";

private static final String[] fieldNames =
new String[] {
"VARCHAR_10_COL",
"CHAR_10_COL",
"CLOB_COL",
"NUMBER_3_SF_2_DP",
"INTEGER_COL",
"FLOAT_COL",
"REAL_COL",
"BINARY_FLOAT_COL",
"BINARY_DOUBLE_COL",
"DATE_COL",
"TIMESTAMP_WITH_3_FRAC_SEC_COL",
"TIMESTAMP_WITH_LOCAL_TZ",
"XML_TYPE_COL"
};

@Override
JdbcCase getJdbcCase() {
Map<String, String> containerEnv = new HashMap<>();
Expand Down Expand Up @@ -117,7 +134,9 @@ JdbcCase getJdbcCase() {
}

@Override
void compareResult(String executeKey) {}
void compareResult(String executeKey) {
defaultCompare(executeKey, fieldNames, "INTEGER_COL");
}

@Override
String driverUrl() {
Expand All @@ -126,23 +145,6 @@ String driverUrl() {

@Override
Pair<String[], List<SeaTunnelRow>> initTestData() {
String[] fieldNames =
new String[] {
"VARCHAR_10_COL",
"CHAR_10_COL",
"CLOB_COL",
"NUMBER_3_SF_2_DP",
"INTEGER_COL",
"FLOAT_COL",
"REAL_COL",
"BINARY_FLOAT_COL",
"BINARY_DOUBLE_COL",
"DATE_COL",
"TIMESTAMP_WITH_3_FRAC_SEC_COL",
"TIMESTAMP_WITH_LOCAL_TZ",
"XML_TYPE_COL"
};

List<SeaTunnelRow> rows = new ArrayList<>();
for (int i = 0; i < 100; i++) {
SeaTunnelRow row =
Expand Down

0 comments on commit 2d704e3

Please sign in to comment.