hive> set hive.cli.print.header=true;set hive.cli.print.current.db=true;set hive.cli.print.row.to.vertical=true;set mapred.output.encoding=UTF-8;set mapred.input.encoding=UTF-8;set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;set hive.exec.compress.output=false;set hive.exec.compress.intermediate=false;set hive.vectorized.execution.enabled=true;set hive.vectorized.execution.reduce.enabled=true;set hive.vectorized.execution.reduce.groupby.enabled=true; Query returned non-zero code: 1, cause: hive configuration hive.cli.print.row.to.vertical does not exists. hive (default)>
时间: 2023-10-06 13:08:11 浏览: 280
抱歉,之前提供的配置有误,可能是因为不同版本的Hive配置不同。以下是一组通用的配置,可以尝试在Hive中执行:
```
set hive.cli.print.header=true;
set hive.cli.print.current.db=true;
set hive.cli.print.row.to.vertical=false;
set mapred.output.encoding=UTF-8;
set mapred.input.encoding=UTF-8;
set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
set hive.exec.compress.output=false;
set hive.exec.compress.intermediate=false;
set hive.vectorized.execution.enabled=true;
set hive.vectorized.execution.reduce.enabled=true;
set hive.groupby.skewindata=true;
```
这组配置可以将Hive的输出编码方式设置为UTF-8,并启用一些Hive的优化方式。如果还有其他问题,请告诉我。
相关问题
<property> <name>hive.cli.print.header</name> <value>true</value> </property> <property> <name>hive.cli.print.current.db</name> <value>true</value> </property>
这段代码是Hive的配置文件中的两个属性。这些属性用于配置Hive客户端在执行查询时打印表头和当前数据库的信息。
`hive.cli.print.header`属性设置为`true`,表示在查询结果中打印表头信息。这样,在执行查询时,结果的第一行将显示列名。
`hive.cli.print.current.db`属性设置为`true`,表示在Hive客户端中打印当前所在的数据库。这样,在进入Hive客户端后,会显示当前所在的数据库。
这些属性可以根据需要进行配置,以满足特定的输出需求。
#!/bin/bash # 连接hive beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "set hive.cli.print.header=false; set hive.resultset.use.unique.column.names=true; set hive.cli.print.current.db=false;" # 统计表数据量 tables=$(beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "show tables in yinzhou like 'db_*';" | grep -v "INFO" | grep -v "WARN") # 输出cvs文件 echo "Table Name,Data Size" > db_tables.csv while read -r table; do data_size=$(beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "select count(*) from yinzhou.$table;") echo "$table,$data_size" >> db_tables.csv done <<< "$tables"
看起来您的代码格式有点混乱,可能是因为复制粘贴时出现了问题。请尝试使用以下代码,并将其中的username和password替换为您的用户名和密码:
```bash
#!/bin/bash
# 连接hive
beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "set hive.cli.print.header=false; set hive.resultset.use.unique.column.names=true; set hive.cli.print.current.db=false;"
# 统计表数据量
tables=$(beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "show tables in yinzhou like 'db_*';" | grep -v "INFO" | grep -v "WARN")
# 输出cvs文件
echo "Table Name,Data Size" > db_tables.csv
while read -r table; do
data_size=$(beeline -u jdbc:hive2://localhost:10000 -n username -p password -e "select count(*) from yinzhou.$table;")
echo "$table,$data_size" >> db_tables.csv
done <<< "$tables"
```
这个脚本会通过beeline连接到hive,并设置输出格式。然后,它会统计yinzhou库下表名开头为db_的表的数据量,并输出到一个cvs文件中。请替换其中的username和password为您的用户名和密码,然后再次尝试运行。
阅读全文
相关推荐
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![](https://csdnimg.cn/download_wenku/file_type_ask_c1.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![rar](https://img-home.csdnimg.cn/images/20241231044955.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![pdf](https://img-home.csdnimg.cn/images/20241231044930.png)
![zip](https://img-home.csdnimg.cn/images/20241231045053.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)