---
title: "【Hive十八】Hive QL中使用配置的变量"
author: "bit1129"
date: "2016-05-27T13:21:40Z"
tags: []
categories: ["开源软件"]
slug: "hive-hive-ql"
draft: false
lastmod: "2016-05-27T13:21:40Z"
id: 2301287
url: "https://bit1129.iteye.com/blog/2301287"
---

1\. 使用set命令，设置参数

hive&gt;set XYZ=abc

hive&gt;select * from t1 where line = '${hiveconf:XYZ}'

 

等价于

 

hive&gt;set XYZ=’abc‘

hive&gt;select * from t1 where line = ${hiveconf:XYZ}

 

2.以hive --hiveconf XYZ=abc启动

 

hive&gt;set XYZ

输出abc

 

hive&gt;select * from t1 where line = ${hiveconf:XYZ}

查询line列为abc的记录