importavro()

Read(446) Label: avro, import,

Description:

Import an Avro data file.

Syntax:

importavro(avrofile,Fi...;schemafile)

Note:

External library function (See External Library Guide).

The function imports an Avro data file. When parameter schemafile, the avsc file object that describes the data structure, is present, read the avro data file as such a data structure. When both field name(s) Fi and file schemafile are specified, the former has greater priority than the latter; when both are absent, read all fields in the avrofile file.

Parameter:

avrofile

Avro file object that cannot be omitted and supports remote file objects such as httpfile() and Qfile()

schemafile

The avsc file object describing data structure and that supports remote file objects such as httpfile() and Qfile()

Fi

Field name(s)

Option:

@c

Return a cursor

Return value:

Table sequence/Cursor

Example:

 

A

 

1

=file("person.avro")

Read an Avro file.

2

=file("person.avsc")

Read the avsc file.

3

=importavro(A1)

Return all fields of A1’s Avro file.

4

=importavro(A1,name,age)

Return the specified fields.

5

=importavro(A1;A2)

Read data from A1 according to A2’s data structure.

6

=httpfile("http://localhost:7080/test/person.avro")

Read the Avro file in the HTTP service.

7

=importavro(A6)

Return all fields of A6.