|
| 1 | +[[load-arrow]] |
| 2 | += Load and Import Arrow |
| 3 | +:description: This section describes procedures that can be used to import Apache Arrow data from web APIs or files. |
| 4 | + |
| 5 | + |
| 6 | + |
| 7 | +The following procedures allow you to read an Apache Arrow file exported via xref::export/arrow.adoc[apoc.export.arrow.* procedures]. |
| 8 | +It could also potentially read other Apache Arrow files that have not been created via the export procedures. |
| 9 | + |
| 10 | +[[load-arrow-available-procedures]] |
| 11 | +== Procedure and Function Overview |
| 12 | + |
| 13 | +The table below describes the available procedures and functions: |
| 14 | + |
| 15 | +[separator=¦,opts=header,cols="5,1m"] |
| 16 | +|=== |
| 17 | +¦Qualified Name¦Type |
| 18 | +¦xref::overview/apoc.load/apoc.load.arrow.adoc[apoc.load.arrow icon:book[]] + |
| 19 | +`apoc.load.arrow(file STRING, config MAP<STRING, ANY>)` - loads values from the provided Arrow file. |
| 20 | +¦label:procedure[] |
| 21 | + |
| 22 | +¦xref::overview/apoc.load/apoc.load.arrow.stream.adoc[apoc.load.arrow.stream.adoc icon:book[]] + |
| 23 | +`apoc.load.arrow.stream(source LIST<INTEGER>, config MAP<STRING, ANY>)` - loads values from the provided Arrow byte array. |
| 24 | +¦label:procedure[] |
| 25 | + |
| 26 | +¦xref::overview/apoc.import/apoc.import.arrow.adoc[apoc.import.arrow icon:book[]] + |
| 27 | +`apoc.import.arrow(urlOrBinaryFile ANY, config MAP<STRING, ANY>)` - imports entities from the provided Arrow file or byte array |
| 28 | +¦label:procedure[] |
| 29 | +|=== |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +[[load-arrow-available-procedures-apoc.load.arrow]] |
| 34 | +=== `apoc.load.arrow` |
| 35 | + |
| 36 | + |
| 37 | +This procedure takes a file or HTTP URL and parses the Apache Arrow into a map data structure. |
| 38 | + |
| 39 | +[separator=¦,opts=header,cols="1m"] |
| 40 | +|=== |
| 41 | +¦signature |
| 42 | +¦apoc.load.arrow(file :: STRING, config = {} :: MAP) :: (value :: MAP) |
| 43 | +|=== |
| 44 | + |
| 45 | + |
| 46 | +Currently, this procedure does not support any config parameters. |
| 47 | + |
| 48 | +include::includes/enableFileImport.adoc[] |
| 49 | + |
| 50 | +[[load-arrow-available-procedures-apoc.load.arrow.stream]] |
| 51 | +=== `apoc.load.arrow.stream` |
| 52 | + |
| 53 | + |
| 54 | +This procedure takes a byte[] source and parses the Apache Arrow into a map data structure. |
| 55 | + |
| 56 | +[separator=¦,opts=header,cols="1m"] |
| 57 | +|=== |
| 58 | +¦signature |
| 59 | +¦apoc.load.arrow.stream(source :: LIST<INTEGER>, config = {} :: MAP) :: (value :: MAP) |
| 60 | +|=== |
| 61 | + |
| 62 | +Currently, this procedure does not support any config parameters. |
| 63 | + |
| 64 | + |
| 65 | +[[load-arrow-examples]] |
| 66 | +== Examples |
| 67 | + |
| 68 | +The following section contains examples showing how to import data from various Apache Arrow sources. |
| 69 | + |
| 70 | +[[load-arrow-examples-local-file]] |
| 71 | +=== Import from local file |
| 72 | + |
| 73 | +Taking the output xref::export/arrow.adoc#export-cypher-query-arrow[of this case]: |
| 74 | + |
| 75 | +.The following query processes a `test.arrow` file and returns the content as Cypher data structures |
| 76 | +[source,cypher] |
| 77 | +---- |
| 78 | +CALL apoc.load.arrow('test.arrow') |
| 79 | +YIELD value |
| 80 | +RETURN value |
| 81 | +---- |
| 82 | + |
| 83 | +.Results |
| 84 | +[options="header"] |
| 85 | +|=== |
| 86 | +| value |
| 87 | +| {arrayArray -> ["[0]"], dateData -> 2015-05-18T19:32:24Z, boolArray -> [true,false,true], intArray -> [1,2,3], mapData -> "{"foo":"bar"}", boolData -> true, intData -> 1, mixedArray -> ["1","2","true",<null>], doubleArray -> [1.1,2.2,3.3], doubleData -> 1.1, stringData -> "a"} |
| 88 | +|=== |
| 89 | + |
| 90 | + |
| 91 | +[[load-arrow-examples-binary-source]] |
| 92 | +=== Import from binary source |
| 93 | + |
| 94 | +Taking the output xref::export/arrow.adoc#export-cypher-query-arrow-stream[of this case]: |
| 95 | + |
| 96 | +.The following query processes a `test.arrow` file and returns the content as Cypher data structures |
| 97 | +[source,cypher] |
| 98 | +---- |
| 99 | +CALL apoc.load.arrow.stream('<binary arrow file>') |
| 100 | +YIELD value |
| 101 | +RETURN value |
| 102 | +---- |
| 103 | + |
| 104 | +.Results |
| 105 | +[options="header"] |
| 106 | +|=== |
| 107 | +| value |
| 108 | +| {arrayArray -> ["[0]"], dateData -> 2015-05-18T19:32:24Z, boolArray -> [true,false,true], intArray -> [1,2,3], mapData -> "{"foo":"bar"}", boolData -> true, intData -> 1, mixedArray -> ["1","2","true",<null>], doubleArray -> [1.1,2.2,3.3], doubleData -> 1.1, stringData -> "a"} |
| 109 | +|=== |
| 110 | + |
| 111 | + |
| 112 | +[[import-arrow]] |
| 113 | +=== Import Arrow file created by Export Arrow procedures |
| 114 | + |
| 115 | +The `apoc.import.arrow` procedure can be used to import Apache Arrow files created by the xref::export/arrow.adoc[apoc.export.arrow.*] procedures. |
| 116 | + |
| 117 | +This procedure should not be confused with the `apoc.load.arrow*` procedures, |
| 118 | +which just loads the values of the Arrow file, and does not create entities in the database. |
| 119 | + |
| 120 | +See xref::overview/apoc.import/apoc.import.arrow.adoc[this page] for more info. |
| 121 | + |
0 commit comments