描述:
读取orc、parquet格式数据。
语法:
f.hdfs_import([col,…][;n])
备注:
外部库函数,外部库的使用请参考《外部库使用指南》。
读取本地或hdfs中的orc、parquet格式数据。
参数:
f |
本地或hdfs中orc/parquet格式的文件对象。 |
col |
读出的字段,缺省返回表中所有字段。 |
n |
正整数,表示读取n条记录,缺省返回所有数据;使用@c时当前参数无效。 |
选项:
@c |
返回游标。 |
@p |
读取parquet格式,缺省读取orc格式。 |
@m |
并行读取数据,与@c同时使用表示多游标读取数据。 |
返回值:
序表
示例:
|
|
|
|
=file("F:/tmp/mytest.orc") |
打开本地orc格式数据文件。 |
|
=A1.hdfs_import() |
读取orc文件,返回所有字段。 |
|
=A1.hdfs_import@c() |
返回游标。 |
|
|
打开hdfs上orc格式数据文件。 |
|
|
读取指定字段,且只返回前10条记录。 |
|
=hive_open("hdfs://localhost:9000","thrift://localhost:9083","hive","asus") |
连接hive数据库。 |
|
=hive_table@p(A6) |
查询所有parquet类型的表。 |
|
=A7.select(tableName=="myParquet") |
选中myParquet表。 |
|
=file(A8.location) |
加载hdfs文件。 |
|
=A9.hdfs_import@p(;10) |
读取表中的数据,且只返回前10条记录。 |
|
=A9.hdfs_import@pcm() |
多游标读取数据。 |
|
=A11.fetch(10) |
返回结果与A10相同。 |
|
|
|