Hive Connector介绍

GeaFlow 支持通过 Hive metastore 服务器读取 Hive 表中的数据。目前,我们支持 Hive 2.3.x系列版本。

语法

CREATE TABLE hive_table (
  id BIGINT,
  name VARCHAR,
  age INT
) WITH (
    type='hive',
    geaflow.dsl.hive.database.name = 'default',
    geaflow.dsl.hive.table.name = 'user',
    geaflow.dsl.hive.metastore.uris = 'thrift://localhost:9083'
)

参数

参数名 是否必须 描述
geaflow.dsl.hive.database.name Hive数据库名字
geaflow.dsl.hive.table.name Hive表名
geaflow.dsl.hive.metastore.uris 连接Hive元数据metastore的uri列表
geaflow.dsl.hive.splits.per.partition 每个Hive分片的逻辑分片数量,默认为1

示例

CREATE TABLE hive_table (
  id BIGINT,
  name VARCHAR,
  age INT
) WITH (
    type='hive',
    geaflow.dsl.hive.database.name = 'default',
    geaflow.dsl.hive.table.name = 'user',
    geaflow.dsl.hive.metastore.uris = 'thrift://localhost:9083'
);

CREATE TABLE console (
  id BIGINT,
  name VARCHAR,
  age INT
) WITH (
    type='console'
);

INSERT INTO console
SELECT * FROM hive_table;