ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# Hive 解释器 原文链接 : [http://zeppelin.apache.org/docs/0.7.2/interpreter/hive.html](http://zeppelin.apache.org/docs/0.7.2/interpreter/hive.html) 译文链接 : [http://www.apache.wiki/pages/viewpage.action?pageId=10030808](http://www.apache.wiki/pages/viewpage.action?pageId=10030808) 贡献者 : [片刻](/display/~jiangzhonglian) [ApacheCN](/display/~apachecn) [Apache中文网](/display/~apachechina) ## 重要的提醒 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](https://hive.apache.org/)™ 数据仓库软件便于查询和管理驻留在分布式存储大型数据集。Hive提供了一种机制来将结构投影到这些数据上,并使用类似SQL的语言HiveQL查询数据。同时,这种语言还允许传统的map/reduce程序员在HiveQL中表达这种逻辑不方便或低效时插入自定义映射器和缩减器。 ## 如何使用 基本上可以使用 ``` %hive select * from my_table;  ``` 要么 ``` %hive(etl) -- 'etl' is a ${prefix} select * from my_table;  ``` 默认情况下,您还可以运行多达10个查询。更改这些设置尚未实现。 ### 应用Zeppelin动态表单 您可以在查询内使用[Zeppelin 动态表单](http://www.apache.wiki/pages/viewpage.action?pageId=10030585)。您可以同时使用`text input`和`select 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};  ```