Skip to content

Commit 159fdfb

Browse files
authored
fix(dml): failed to modify data which is geometry type (#2640)
1 parent 15d620a commit 159fdfb

2 files changed

Lines changed: 28 additions & 3 deletions

File tree

server/odc-service/src/main/java/com/oceanbase/odc/service/dml/converter/OBOracleGeometryConverter.java

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,17 +15,28 @@
1515
*/
1616
package com.oceanbase.odc.service.dml.converter;
1717

18+
import java.util.Arrays;
1819
import java.util.Collection;
19-
import java.util.Collections;
20+
21+
import com.oceanbase.odc.service.dml.DataValue;
22+
23+
import lombok.NonNull;
2024

2125
/**
2226
* @author jingtian
2327
* @date 2024/4/15
2428
* @since ODC_release_4.3.0
2529
*/
26-
public class OBOracleGeometryConverter extends OracleStringConverter {
30+
public class OBOracleGeometryConverter extends BaseDataConverter {
31+
32+
@Override
33+
protected String doConvert(@NonNull DataValue value) {
34+
return value.getValue();
35+
}
36+
2737
@Override
2838
protected Collection<String> getSupportDataTypeNames() {
29-
return Collections.singletonList("geometry");
39+
return Arrays.asList("sdo_geometry", "geometry");
3040
}
41+
3142
}

server/odc-service/src/test/java/com/oceanbase/odc/service/dml/DataConvertUtilTest.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -188,4 +188,18 @@ public void testGeometryForMySQLAndOBMySQL() {
188188
"GEOMETRYCOLLECTION (POINT (0 0), LINESTRING (1 1, 2 2)) | 4326")
189189
});
190190
}
191+
192+
@Test
193+
public void testGeometryForOBOracle() {
194+
Assert.assertArrayEquals(new Object[] {
195+
"SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(12, 34, NULL)",
196+
"SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(12, 34, NULL)"
197+
}, new Object[] {
198+
DataConvertUtil.convertToSqlString(DialectType.OB_ORACLE, "geometry",
199+
"SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(12, 34, NULL)"),
200+
DataConvertUtil.convertToSqlString(DialectType.OB_ORACLE, "sdo_geometry",
201+
"SDO_GEOMETRY(2001, NULL, SDO_POINT_TYPE(12, 34, NULL)")
202+
});
203+
}
204+
191205
}

0 commit comments

Comments
 (0)