Skip to content

Hive 解释器

原文链接 : http://zeppelin.apache.org/docs/0.7.2/interpreter/hive.html

译文链接 : https://www.apachecn.org/pages/viewpage.action?pageId=10030808

贡献者 : 片刻 ApacheCN Apache中文网

重要的提醒

Hive Interpreter将被弃用并合并到JDBC Interpreter中。您可以使用具有相同功能的JDBC解释器使用Hive Interpreter。请参阅下面的设置和依赖关系示例。

属性

属性
hive.driver org.apache.hive.jdbc.HiveDriver
hive.url jdbc:hive2://localhost:10000
hive.user hiveUser
hive.password hivePassword

依赖

Artifact Exclude
org.apache.hive:hive-jdbc:0.14.0  
org.apache.hadoop:hadoop-common:2.6.0  

配置

属性 默认 描述
default.driver org.apache.hive.jdbc.HiveDriver JDBC驱动程序的类路径
default.url jdbc:hive2://localhost:10000 网址连接
default.user   (可选)连接的用户名
default.password   (可选)连接密码
default.xxx   (可选)驱动程序使用的其他属性
${prefix}.driver   驱动程序类路径 %hive(${prefix})
${prefix}.url   的网址 %hive(${prefix})
${prefix}.user   (可选)连接的用户名%hive(${prefix})
${prefix}.password   (可选)连接密码%hive(${prefix})
${prefix}.xxx   (可选)驱动程序使用的其他属性%hive(${prefix})

此解释器提供多种配置${prefix}。用户可以通过此前缀设置多个连接属性。它可以像%hive(${prefix})

概述

Apache Hive™ 数据仓库软件便于查询和管理驻留在分布式存储大型数据集。Hive提供了一种机制来将结构投影到这些数据上,并使用类似SQL的语言HiveQL查询数据。同时,这种语言还允许传统的map/reduce程序员在HiveQL中表达这种逻辑不方便或低效时插入自定义映射器和缩减器。

如何使用

基本上可以使用

%hive
select * from my_table; 

要么

%hive(etl)
-- 'etl' is a ${prefix}
select * from my_table; 

默认情况下,您还可以运行多达10个查询。更改这些设置尚未实现。

应用Zeppelin动态表单

您可以在查询内使用Zeppelin 动态表单。您可以同时使用text inputselect form参数化功能。

%hive
SELECT ${group_by}, count(*) as count
FROM retail_demo.order_lineitems_pxf
GROUP BY ${group_by=product_id,product_id|product_name|customer_id|store_id}
ORDER BY count ${order=DESC,DESC|ASC}
LIMIT ${limit=10}; 

我们一直在努力

apachecn/AiLearning

【布客】中文翻译组