Skip to content

Commit abd6d42

Browse files
committed
Fixed merge issues
1 parent 9eaad94 commit abd6d42

5 files changed

Lines changed: 0 additions & 440 deletions

File tree

data/semantickernel-data-oracle/src/main/java/com/microsoft/semantickernel/data/jdbc/oracle/OracleDataTypesMapping.java

Lines changed: 0 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
<<<<<<< add-oracle-store
21
/*
32
** Semantic Kernel Oracle connector version 1.0.
43
**
@@ -71,27 +70,5 @@ public class OracleDataTypesMapping {
7170
/**
7271
* Oracle database type used to map vectors (the parameter is the dimension of the vector)
7372
*/
74-
=======
75-
package com.microsoft.semantickernel.data.jdbc.oracle;
76-
77-
/**
78-
* Defines oracle database type constants for supported field types.
79-
*/
80-
public class OracleDataTypesMapping {
81-
public static final String STRING_VARCHAR = "NVARCHAR2(%s)";
82-
public static final String STRING_CLOB = "CLOB";
83-
public static final String BOOLEAN = "BOOLEAN";
84-
public static final String BYTE = "NUMBER(3)";
85-
public static final String BYTE_ARRAY = "RAW(2000)";
86-
public static final String SHORT = "NUMBER(5)";
87-
public static final String INTEGER = "NUMBER(10)";
88-
public static final String LONG = "NUMBER(19)";
89-
public static final String FLOAT = "BINARY_FLOAT";
90-
public static final String DOUBLE = "BINARY_DOUBLE";
91-
public static final String DECIMAL = "NUMBER";
92-
public static final String OFFSET_DATE_TIME = "TIMESTAMP(7) WITH TIME ZONE";
93-
public static final String UUID = "RAW(16)";
94-
public static final String JSON = "JSON";
95-
>>>>>>> main
9673
public static final String VECTOR_FLOAT = "VECTOR(%s, FLOAT32)";
9774
}
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,14 @@
1-
<<<<<<< add-oracle-store
21
/*
32
** Semantic Kernel Oracle connector version 1.0.
43
**
54
** Copyright (c) 2025 Oracle and/or its affiliates.
65
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
76
*/
8-
=======
9-
>>>>>>> main
107
package com.microsoft.semantickernel.data.jdbc.oracle;
118

129
import com.microsoft.semantickernel.data.jdbc.oracle.OracleVectorStoreQueryProvider.StringTypeMapping;
1310
import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordDataField;
14-
<<<<<<< add-oracle-store
1511
import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordField;
16-
=======
17-
>>>>>>> main
1812
import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordKeyField;
1913
import com.microsoft.semantickernel.data.vectorstorage.definition.VectorStoreRecordVectorField;
2014
import oracle.jdbc.OracleTypes;
@@ -29,7 +23,6 @@
2923
import java.util.stream.Collectors;
3024

3125
/**
32-
<<<<<<< add-oracle-store
3326
* Helper class for field operations. Handles mapping between field java types to DB types and
3427
* generating SQL statement to create field indexes.
3528
*/
@@ -39,29 +32,13 @@ class OracleVectorStoreFieldHelper {
3932
* The logger
4033
*/
4134
private static final Logger LOGGER = Logger.getLogger(OracleVectorStoreFieldHelper.class.getName());
42-
=======
43-
* Helper class for field operations.
44-
*/
45-
public class OracleVectorStoreFieldHelper {
46-
private static final Logger LOGGER = Logger.getLogger(OracleVectorStoreQueryProvider.class.getName());
47-
>>>>>>> main
4835

4936
/**
5037
* Maps supported key java classes to Oracle database types
5138
*/
5239
private static final HashMap<Class<?>, String> supportedKeyTypes = new HashMap() {
5340
{
5441
put(String.class, String.format(OracleDataTypesMapping.STRING_VARCHAR, 255));
55-
<<<<<<< add-oracle-store
56-
=======
57-
put(short.class, OracleDataTypesMapping.SHORT);
58-
put(Short.class, OracleDataTypesMapping.SHORT);
59-
put(int.class, OracleDataTypesMapping.INTEGER);
60-
put(Integer.class, OracleDataTypesMapping.INTEGER);
61-
put(long.class, OracleDataTypesMapping.LONG);
62-
put(Long.class, OracleDataTypesMapping.LONG);
63-
put(UUID .class, OracleDataTypesMapping.UUID);
64-
>>>>>>> main
6542
}
6643
};
6744

@@ -75,17 +52,6 @@ public class OracleVectorStoreFieldHelper {
7552
put(Collection.class, OracleDataTypesMapping.VECTOR_FLOAT);
7653
put(float[].class, OracleDataTypesMapping.VECTOR_FLOAT);
7754
put(Float[].class, OracleDataTypesMapping.VECTOR_FLOAT);
78-
<<<<<<< add-oracle-store
79-
=======
80-
/*
81-
put(byte[].class,"VECTOR(%s, INT8)");
82-
put(Byte[].class,"VECTOR(%s, INT8)");
83-
put(double[].class,"VECTOR(%s, FLOAT64)");
84-
put(Double[].class,"VECTOR(%s, FLOAT64)");
85-
put(boolean[].class,"VECTOR(%s, BINARY)");
86-
put(Boolean[].class,"VECTOR(%s, BINARY)");
87-
*/
88-
>>>>>>> main
8955
}
9056
};
9157

@@ -114,35 +80,12 @@ public class OracleVectorStoreFieldHelper {
11480
put(byte[].class, OracleDataTypesMapping.BYTE_ARRAY);
11581
put(List.class, OracleDataTypesMapping.JSON);
11682
}
117-
<<<<<<< add-oracle-store
11883
};
11984

12085
/**
12186
* Suffix added to the effective column name to generate the index name for a vector column.
12287
*/
12388
public static final String VECTOR_INDEX_SUFFIX = "_VECTOR_INDEX";
124-
=======
125-
126-
};
127-
128-
/**
129-
* Maps vector type to OracleTypes. Only needed if types other than FLOAT_32 are supported.
130-
*/
131-
private static final Map<Class<?>, Integer> mapOracleTypeToVector = new HashMap() {
132-
{
133-
put(float[].class, OracleTypes.VECTOR_FLOAT32);
134-
put(Float[].class, OracleTypes.VECTOR_FLOAT32);
135-
/*
136-
put(byte[].class, OracleTypes.VECTOR_INT8);
137-
put(Byte[].class, OracleTypes.VECTOR_INT8);
138-
put(Double[].class, OracleTypes.VECTOR_FLOAT64);
139-
put(double[].class, OracleTypes.VECTOR_FLOAT64);
140-
put(Boolean[].class, OracleTypes.VECTOR_BINARY);
141-
put(boolean[].class, OracleTypes.VECTOR_BINARY);
142-
*/
143-
}
144-
};
145-
>>>>>>> main
14689

14790
/**
14891
* Gets the mapping between the supported Java key types and the Oracle database type.
@@ -160,20 +103,11 @@ public static HashMap<Class<?>, String> getSupportedKeyTypes() {
160103
*/
161104
public static Map<Class<?>, String> getSupportedDataTypes(
162105
StringTypeMapping stringTypeMapping, int defaultVarCharLength) {
163-
<<<<<<< add-oracle-store
164106
String stringType = stringTypeMapping.equals(StringTypeMapping.USE_VARCHAR)
165107
? String.format(OracleDataTypesMapping.STRING_VARCHAR, defaultVarCharLength)
166108
: OracleDataTypesMapping.STRING_CLOB;
167109
supportedDataTypes.put(String.class, stringType);
168110
LOGGER.finest("Mapping String columns to " + stringType);
169-
=======
170-
171-
if (stringTypeMapping.equals(StringTypeMapping.USE_VARCHAR)) {
172-
supportedDataTypes.put(String.class, String.format(OracleDataTypesMapping.STRING_VARCHAR, defaultVarCharLength));
173-
} else {
174-
supportedDataTypes.put(String.class, OracleDataTypesMapping.STRING_CLOB);
175-
}
176-
>>>>>>> main
177111
return supportedDataTypes;
178112
}
179113

@@ -224,22 +158,14 @@ public static String getCreateVectorIndexStatement(VectorStoreRecordVectorField
224158
*/
225159
public static String createIndexForDataField(String collectionTableName, VectorStoreRecordDataField dataField, Map<Class<?>, String> supportedDataTypes) {
226160
if (supportedDataTypes.get(dataField.getFieldType()) == "JSON") {
227-
<<<<<<< add-oracle-store
228161
String dataFieldIndex = "CREATE MULTIVALUE INDEX IF NOT EXISTS %s ON %s t (t.%s.%s)";
229-
=======
230-
String dataFieldIndex = "CREATE MULTIVALUE INDEX %s ON %s t (t.%s.%s)";
231-
>>>>>>> main
232162
return String.format(dataFieldIndex,
233163
collectionTableName + "_" + dataField.getEffectiveStorageName(),
234164
collectionTableName,
235165
dataField.getEffectiveStorageName(),
236166
getFunctionForType(supportedDataTypes.get(dataField.getFieldSubType())));
237167
} else {
238-
<<<<<<< add-oracle-store
239168
String dataFieldIndex = "CREATE INDEX IF NOT EXISTS %s ON %s (%s ASC)";
240-
=======
241-
String dataFieldIndex = "CREATE INDEX %s ON %s (%s ASC)";
242-
>>>>>>> main
243169
return String.format(dataFieldIndex,
244170
collectionTableName + "_" + dataField.getEffectiveStorageName(),
245171
collectionTableName,
@@ -249,7 +175,6 @@ public static String createIndexForDataField(String collectionTableName, VectorS
249175
}
250176

251177
/**
252-
<<<<<<< add-oracle-store
253178
* Returns vector columns names and types for CREATE TABLE statement
254179
* @param fields list of vector record fields.
255180
* @return comma separated list of columns and types for CREATE TABLE statement.
@@ -294,8 +219,6 @@ private static String getTypeForVectorField(VectorStoreRecordVectorField field)
294219
}
295220

296221
/**
297-
=======
298-
>>>>>>> main
299222
* Gets the function that allows to return the function that converts the JSON value to the
300223
* data type.
301224
* @param jdbcType The JDBC type.
@@ -321,93 +244,4 @@ private static String getFunctionForType(String jdbcType) {
321244
}
322245
}
323246

324-
<<<<<<< add-oracle-store
325-
=======
326-
/**
327-
* Gets the type of the vector given the field definition. This method is not needed if only
328-
*
329-
* @param field the vector field definition.
330-
* @return returns the type of vector for the given field type.
331-
*/
332-
public static String getTypeForVectorField(VectorStoreRecordVectorField field) {
333-
String dimension = field.getDimensions() > 0 ? String.valueOf(field.getDimensions()) : "*";
334-
return String.format(supportedVectorTypes.get(field.getFieldType()), dimension);
335-
/* Not needed since all types are FLOAT32
336-
if (field.getFieldSubType() != null) {
337-
String vectorType;
338-
switch (field.getFieldSubType().getName()) {
339-
case "java.lang.Double":
340-
vectorType = "FLOAT64";
341-
break;
342-
case "java.lang.Byte":
343-
vectorType = "INT8";
344-
break;
345-
case "java.lang.Boolean":
346-
vectorType = "BINARY";
347-
break;
348-
default:
349-
vectorType = "FLOAT32";
350-
}
351-
return String.format(supportedVectorTypes.get(field.getFieldType()), dimension, vectorType);
352-
} else {
353-
return String.format(supportedVectorTypes.get(field.getFieldType()), dimension);
354-
}
355-
*/
356-
}
357-
358-
/**
359-
* Gets the JDBC oracle of the vector field definition.
360-
* @param field the vector field definition.
361-
* @return the JDBC oracle type.
362-
*/
363-
public static int getOracleTypeForField(VectorStoreRecordVectorField field) {
364-
if (field.getFieldSubType() == null) {
365-
return mapOracleTypeToVector.get(field.getFieldType()).intValue();
366-
} else {
367-
switch (field.getFieldSubType().getName()) {
368-
case "java.lang.Double":
369-
return OracleTypes.VECTOR_FLOAT64;
370-
case "java.lang.Byte":
371-
return OracleTypes.VECTOR_INT8;
372-
case "java.lang.Boolean":
373-
return OracleTypes.VECTOR_BINARY;
374-
default:
375-
return OracleTypes.VECTOR_FLOAT32;
376-
}
377-
}
378-
}
379-
380-
/**
381-
* Generates the index name given the field name. by suffixing "_VECTOR_INDEX" to the field name.
382-
* @param effectiveStorageName the field name.
383-
* @return the index name.
384-
*/
385-
private static String getIndexName(String effectiveStorageName) {
386-
return effectiveStorageName + "_VECTOR_INDEX";
387-
}
388-
389-
/**
390-
* Returns vector columns names and types for CREATE TABLE statement
391-
* @param fields list of vector record fields.
392-
* @return comma separated list of columns and types for CREATE TABLE statement.
393-
*/
394-
public static String getVectorColumnNamesAndTypes(List<VectorStoreRecordVectorField> fields) {
395-
List<String> columns = fields.stream()
396-
.map(field -> field.getEffectiveStorageName() + " " +
397-
OracleVectorStoreFieldHelper.getTypeForVectorField(field)
398-
).collect(Collectors.toList());
399-
400-
return String.join(", ", columns);
401-
}
402-
403-
/**
404-
* Returns key column names and type for key column for CREATE TABLE statement
405-
* @param field the key field.
406-
* @return column name and type of the key field for CREATE TABLE statement.
407-
*/
408-
public static String getKeyColumnNameAndType(VectorStoreRecordKeyField field) {
409-
return field.getEffectiveStorageName() + " " + supportedKeyTypes.get(field.getFieldType());
410-
}
411-
412-
>>>>>>> main
413247
}

data/semantickernel-data-oracle/src/main/java/com/microsoft/semantickernel/data/jdbc/oracle/OracleVectorStoreRecordMapper.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ public OracleVectorStoreRecordMapper<Record> build() {
182182
value = resultSet.getBoolean(field.getEffectiveStorageName());
183183
break;
184184
case OracleDataTypesMapping.OFFSET_DATE_TIME:
185-
<<<<<<< add-oracle-store
186185
TIMESTAMPTZ timestamptz = ((OracleResultSet)resultSet).getTIMESTAMPTZ(field.getEffectiveStorageName());
187186
value = timestamptz != null ? timestamptz.offsetDateTimeValue() : null;
188187
break;
@@ -193,16 +192,6 @@ public OracleVectorStoreRecordMapper<Record> build() {
193192
String uuidValue = resultSet.getString(field.getEffectiveStorageName());
194193
value = uuidValue == null ? null : UUID.fromString(uuidValue);
195194
break;
196-
=======
197-
value = ((OracleResultSet)resultSet).getTIMESTAMPTZ(field.getEffectiveStorageName())
198-
.offsetDateTimeValue();
199-
break;
200-
case OracleDataTypesMapping.BYTE_ARRAY:
201-
value = resultSet.getBytes(field.getEffectiveStorageName());
202-
break;
203-
// fallthrough
204-
case OracleDataTypesMapping.UUID:
205-
>>>>>>> main
206195
case OracleDataTypesMapping.JSON:
207196
value = resultSet.getObject(field.getEffectiveStorageName(), fieldType);
208197
break;

data/semantickernel-data-oracle/src/test/java/com/microsoft/semantickernel/data/jdbc/oracle/OracleVectorStoreDataTypeSearchTest.java

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,9 @@
1-
<<<<<<< add-oracle-store
21
/*
32
** Semantic Kernel Oracle connector version 1.0.
43
**
54
** Copyright (c) 2025 Oracle and/or its affiliates.
65
** Licensed under the Universal Permissive License v 1.0 as shown at https://oss.oracle.com/licenses/upl/
76
*/
8-
=======
9-
>>>>>>> main
107
package com.microsoft.semantickernel.data.jdbc.oracle;
118

129
import com.microsoft.semantickernel.data.jdbc.JDBCVectorStore;
@@ -128,14 +125,6 @@ void testDataTypesSearch (ClassWithAllBoxedTypes record) {
128125
assertEquals(1, results.getTotalCount());
129126
assertEquals(record.getDoubleValue(), results.getResults().get(0).getRecord().getDoubleValue());
130127

131-
<<<<<<< add-oracle-store
132-
=======
133-
System.out.println(record.getDecimalValue());
134-
System.out.println(record.getDecimalValue().doubleValue());
135-
System.out.println(results.getResults().get(0).getRecord().getDecimalValue());
136-
System.out.println(results.getResults().get(0).getRecord().getDecimalValue().doubleValue());
137-
138-
>>>>>>> main
139128
// decimal
140129
results = collection.searchAsync(
141130
null,

0 commit comments

Comments
 (0)