webhdfs_file()

Read(120) Label: file data, read/write,

Description:

Implement file read and write.

Syntax:

webhdfs_file(fileUrl,params)

Note:

The external library function implements file read and write using the HTTP request.

Parameters:

fileUrl

URL of the target file

params

Parameter in the file URL

Return value:

URL of the target file

Example:

 

A

 

1

=webhdfs_file("http://localhost:50070/webhdfs/v1/test/orders.txt":"UTF-8","user.name=root")

Connect to WebHDFS

2

=A1.read()

Read data from A1’s text file as a string

3

=A1.import@t()

Read content of the text file as records to form a table sequence to return

4

=A1.cursor().fetch ()

Create cursor for A1’s text file, and fetch records from the cursor

5

=webhdfs_file("http://localhost:50070/webhdfs/v1/test/orders.btx","user.name=root")

 

 

6

=A5.import@b()

Read content of A5’s bin file as records to form a table sequence to return

7

=A5.cursor@b().fetch()

Create cursor for A5’s bin file, and fetch records from the cursor