Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有办法将模式/列标题作为第一行添加到 Hive 查询的输出吗?
我使用这个 hive 语句将典型的转储到本地目录
INSERT OVERWRITE LOCAL DIRECTORY '/some_path/' SELECT ... AS column1 ... AS column2 ... ;
在我想要的输出中:
column1 column2 data data data data
由于设置 hive.cli.print.header=true; 仅适用于终端,它不会将标题打印到文件中。我会这样做以实现这一目标:
bin/hive -e "set hive.cli.print.header=true; select * from demo;" > /path/to/file