Skip to content

Commit 32156a1

Browse files
committed
Fixes 4446 - wip
1 parent dc95863 commit 32156a1

File tree

6 files changed

+2513
-3
lines changed

6 files changed

+2513
-3
lines changed

extended/src/main/java/apoc/load/xls/LoadXls.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -212,6 +212,9 @@ private Object convertType(Object value) {
212212
return dateParse(value.toString(), OffsetTime.class, dateParse);
213213
case DURATION:
214214
return durationParse(value.toString());
215+
// TODO - vector
216+
case VECTOR:
217+
return null;
215218
default:
216219
return value;
217220
}

extended/src/main/java/apoc/util/ExtendedUtil.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,8 @@ public static String dateFormat( TemporalAccessor value, String format){
5050
public static double doubleValue( Entity pc, String prop, Number defaultValue) {
5151
return Util.toDouble(pc.getProperty(prop, defaultValue));
5252
}
53+
54+
// TODO - vector parse??
5355

5456
public static Duration durationParse(String value) {
5557
return Duration.parse(value);

extended/src/test/java/apoc/ComparePerformancesTest.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,9 @@
2626

2727
@Ignore("This test compare import/export procedures performances, we ignore it since it's slow and just log the times spent")
2828
public class ComparePerformancesTest {
29+
30+
// TODO - roundrip with these kind of procedures and vectors
31+
2932
private static final File directory = new File("target/import");
3033
static { //noinspection ResultOfMethodCallIgnored
3134
directory.mkdirs();

extended/src/test/java/apoc/export/arrow/ImportArrowExtendedTest.java

Lines changed: 48 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import apoc.meta.Meta;
44
import apoc.meta.MetaRestricted;
55
import apoc.util.TestUtil;
6+
import apoc.util.Util;
67
import org.junit.Before;
78
import org.junit.BeforeClass;
89
import org.junit.ClassRule;
@@ -14,13 +15,17 @@
1415

1516
import java.io.File;
1617
import java.util.HashMap;
18+
import java.util.List;
1719
import java.util.Map;
20+
import java.util.stream.Collectors;
1821

1922
import static apoc.ApocConfig.APOC_EXPORT_FILE_ENABLED;
2023
import static apoc.ApocConfig.APOC_IMPORT_FILE_ENABLED;
2124
import static apoc.ApocConfig.apocConfig;
2225
import static apoc.export.arrow.ArrowTestUtil.ARROW_BASE_FOLDER;
2326
import static apoc.export.arrow.ArrowTestUtil.testImportCommon;
27+
import static org.neo4j.configuration.SettingImpl.newBuilder;
28+
import static org.neo4j.configuration.SettingValueParsers.BOOL;
2429

2530
public class ImportArrowExtendedTest {
2631
private static File directory = new File(ARROW_BASE_FOLDER);
@@ -29,13 +34,45 @@ public class ImportArrowExtendedTest {
2934
}
3035

3136
private final Map<String, Object> MAPPING_ALL = Map.of("mapping",
32-
Map.of("bffSince", "Duration", "place", "Point", "listInt", "LongArray", "born", "LocalDateTime")
37+
Util.map("bffSince", "Duration",
38+
"place", "Point",
39+
"listInt", "LongArray",
40+
"born", "LocalDateTime",
41+
"INTEGER64", "vector",
42+
"INTEGER32", "vector",
43+
"INTEGER16", "vector",
44+
"INTEGER8", "vector",
45+
"FLOAT64", "vector",
46+
"FLOAT32", "vector"
47+
)
3348
);
3449

3550
@ClassRule
3651
public static DbmsRule db = new ImpermanentDbmsRule()
52+
53+
.withSetting(
54+
GraphDatabaseSettings.procedure_unrestricted,
55+
List.of(
56+
"apoc.meta.nodes.count",
57+
"apoc.meta.stats",
58+
"apoc.meta.data",
59+
"apoc.meta.schema",
60+
"apoc.meta.nodeTypeProperties",
61+
"apoc.meta.relTypeProperties",
62+
"apoc.meta.graph",
63+
"apoc.meta.graph.of",
64+
"apoc.meta.graphSample",
65+
"apoc.meta.subGraph"))
66+
.withSetting(GraphDatabaseInternalSettings.cypher_enable_vector_type, true)
67+
.withSetting(
68+
newBuilder("internal.dbms.debug.track_cursor_close", BOOL, false)
69+
.build(),
70+
false)
71+
.withSetting(
72+
newBuilder("internal.dbms.debug.trace_cursors", BOOL, false).build(), false)
73+
.withSetting(GraphDatabaseInternalSettings.cypher_enable_vector_type, true)
3774
.withSetting(GraphDatabaseInternalSettings.enable_experimental_cypher_versions, true)
38-
.withSetting(GraphDatabaseSettings.load_csv_file_url_root, directory.toPath().toAbsolutePath());
75+
.withSetting(GraphDatabaseSettings.load_csv_file_url_root, directory.toPath().toAbsolutePath());
3976

4077

4178

@@ -48,8 +85,17 @@ public static void beforeClass() {
4885
public void before() {
4986
db.executeTransactionally("MATCH (n) DETACH DELETE n");
5087

88+
var vectorTypes1 = List.of("INT64", "INT32", "INT16", "INT8", "FLOAT64", "FLOAT32");
89+
for (String type : vectorTypes1) {
90+
db.executeTransactionally("CYPHER 25 CREATE (:Foo { z: VECTOR([1, 2, 3], 3, %s) });".formatted(type));
91+
}
92+
5193
db.executeTransactionally("CREATE (f:User {name:'Adam',age:42,male:true,kids:['Sam','Anna','Grace'], born:localdatetime('2015-05-18T19:32:24.000'), place:point({latitude: 13.1, longitude: 33.46789, height: 100.0})})-[:KNOWS {since: 1993, bffSince: duration('P5M1.5D')}]->(b:User {name:'Jim',age:42})");
5294
db.executeTransactionally("CREATE (:Another {foo:1, listInt: [1,2]}), (:Another {bar:'Sam'})");
95+
// var vectorTypes = List.of("INTEGER64", "INTEGER32", "INTEGER16", "INTEGER8", "FLOAT64","FLOAT32");
96+
var vectorTypes = List.of("INT64", "INT32", "INT16", "INT8", "FLOAT64", "FLOAT32");
97+
var types = vectorTypes.stream().map(i -> "%1$s: VECTOR([1,2,3], 3, %1$s)".formatted(i)).collect(Collectors.joining(","));
98+
db.executeTransactionally("CYPHER 25 CREATE (:Vectors {%s})".formatted(types));
5399

54100
apocConfig().setProperty(APOC_IMPORT_FILE_ENABLED, true);
55101
apocConfig().setProperty(APOC_EXPORT_FILE_ENABLED, true);

0 commit comments

Comments
 (0)