apoc.import.arrow

Procedure Apoc Extended

apoc.import.arrow(input, $config) - Imports arrow from the provided arrow file or byte array

Signature

apoc.import.arrow(urlOrBinaryFile :: ANY?, config = {} :: MAP?) :: (file :: STRING?, source :: STRING?, format :: STRING?, nodes :: INTEGER?, relationships :: INTEGER?, properties :: INTEGER?, time :: INTEGER?, rows :: INTEGER?, batchSize :: INTEGER?, batches :: INTEGER?, done :: BOOLEAN?, data :: STRING?)

Input parameters

Name Type Default

urlOrBinaryFile

ANY?

null

config

MAP?

{}

Config parameters

This procedure supports the following config parameters:

Table 1. Config parameters
name type default description

unwindBatchSize

Integer

2000

the batch size of the unwind

mapping

Map

{}

see Mapping config example below

Output parameters

Name Type

file

STRING?

source

STRING?

format

STRING?

nodes

INTEGER?

relationships

INTEGER?

properties

INTEGER?

time

INTEGER?

rows

INTEGER?

batchSize

INTEGER?

batches

INTEGER?

done

BOOLEAN?

data

STRING?

Usage Examples

The apoc.import.arrow procedure can be used to import arrow files created by the apoc.export.arrow.* procedures.

CALL apoc.import.arrow("fileCreatedViaExportProcedures.arrow")
Table 2. Results
file source format nodes relationships properties time rows batchSize batches done data

"fileCreatedViaExportProcedures.arrow"

"file"

"arrow"

3

1

15

105

4

-1

0

TRUE

NULL

We can also import a file from a binary byte[] created by the apoc.export.arrow.stream.* procedures.

CALL apoc.import.arrow(`<binaryArrow>`)

Mapping config

In order to import complex types not supported by Parquet, like Point, Duration, List of Duration, etc.. we can use the mapping config to convert to the desired data type. For example, if we have a node (:MyLabel {durationProp: duration('P5M1.5D')}, and we export it in a parquet file/binary, we can import it by explicit a map with key the property key, and value the property type.

That is in this example, by using the load procedure:

CALL apoc.load.arrow(fileOrBinary, {mapping: {durationProp: 'Duration'}})

Or with the import procedure:

CALL apoc.import.parquet(fileOrBinary, {mapping: {durationProp: 'Duration'}})

The mapping value types can be one of the following:

  • Point

  • LocalDateTime

  • LocalTime

  • DateTime

  • Time

  • Date

  • Duration

  • Char

  • Byte

  • Double

  • Float

  • Short

  • Int

  • Long

  • Node

  • Relationship

  • BaseType followed by Array, to map a list of values, where BaseType can be one of the previous type, for example DurationArray