HiveQL中受影响的行数
问题描述:
有没有办法在配置单元中运行CTAS之后获取受影响的行数?HiveQL中受影响的行数
我运行
创建表T1作为SELECT * FROM T2哪里...;
基本上,我想打印新表中的行数为记录目的。
谢谢!
答
蜂巢确实受到影响CTAS的一部分行的报告编号:看到这里的例子:
Table default.errors2 stats: [num_partitions: 0, num_files: 1, num_rows: 860, total_size: 17752, raw_data_size: 16892]
更多输出的详细信息:
hive> create table errors2 as select * from errors;
..
Stage-5 is filtered out by condition resolver.
Moving data to: hdfs://localhost:9000/tmp/hive-steve/hive_2014-12-13_06-00-40_553_7396982929134959624/-ext-10001
Moving data to: hdfs://localhost:9000/user/hive/warehouse/errors2
Table default.errors2 stats: [num_partitions: 0, num_files: 1, num_rows: 860, total_size: 17752, raw_data_size: 16892]
OK
dayandhour dowandhour cnt
Time taken: 7.348 seconds
UPDATE OP询问保存行数在一个变量。没有内置配置单元命令AFAIK。然而,您可以通过命令行运行命令
hive -e "<hivesql>" | grep "[num_partitions]" | <regex command to isolate the num_rows>
对于提供的答案的某些反馈如何? – javadba 2014-12-31 18:00:47