33import apoc .meta .Meta ;
44import apoc .meta .MetaRestricted ;
55import apoc .util .TestUtil ;
6+ import apoc .util .Util ;
67import org .junit .Before ;
78import org .junit .BeforeClass ;
89import org .junit .ClassRule ;
1415
1516import java .io .File ;
1617import java .util .HashMap ;
18+ import java .util .List ;
1719import java .util .Map ;
20+ import java .util .stream .Collectors ;
1821
1922import static apoc .ApocConfig .APOC_EXPORT_FILE_ENABLED ;
2023import static apoc .ApocConfig .APOC_IMPORT_FILE_ENABLED ;
2124import static apoc .ApocConfig .apocConfig ;
2225import static apoc .export .arrow .ArrowTestUtil .ARROW_BASE_FOLDER ;
2326import static apoc .export .arrow .ArrowTestUtil .testImportCommon ;
27+ import static org .neo4j .configuration .SettingImpl .newBuilder ;
28+ import static org .neo4j .configuration .SettingValueParsers .BOOL ;
2429
2530public 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