hdfs_import()

Read(47) Label: hivedatabase, orc, parquet,

Description:

Retrieve ORC/Parquet data.

Syntax:

f.hdfs_import([col,…])

Note:

External library function (See External Library Guide for uses).

 

It retrieves ORC or Parquet data from local or HDFS files.

Parameter:

f

A local or HDFS file object of ORC or Parquet format.

col

A to-be-retrieved column; return all fields by default.

Option:

@c

Enable returning a cursor.

@p

Enable retrieving Parquet data; retrieve ORC data by default.

Return value:

Table sequence

Example:

 

A

 

1

=file("F:/tmp/mytest.orc")

Open a local ORC format data file.

2

=A1.hdfs_import()

Retrieve the ORC file and return all its fields.

3

=A1.hdfs_import@c()

Return a cursor.

4

=file("hdfs://localhost:9000/user/hive/warehouse/test1.orc")

Open an ORC format data file in HDFS.

5

=A4.hdfs_import("product","store")

Retrieve certain fields.

6

=hive_open("hdfs://localhost:9000","thrift://localhost:9083","hive","asus")

Connect to Hive database.

7

=hive_table@p(A6)

Retrieve all Parquet format tables.

8

=A7.select(tableName=="myParquet")

Select myParquet table.

9

=file(A8.location)

Load the corresponding HDFS file.

10

=A9.hdfs_import@p()

Retrieve data from the table.

11

=hive_close(A6)