2014-12-12 2 views
0

하이브에서 CTAS를 실행 한 후 영향을받은 행을 얻는 방법이 있습니까?HiveQL에서 영향을받은 행 수

나는

이 같은 선택 테이블 t1을 만들고 실행하고 * T2에서 어디 ...;

기본적으로 로깅 목적으로 새 테이블에 행 수를 인쇄하고 싶습니다.

감사합니다.

+0

제공된 대답에 대한 피드백은 어떻습니까? – javadba

답변

0

하이브는 않습니다 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 영업 이익 행 개수를 저장에 대한 질문 여기 예를 참조 변수. 내장 하이브 명령 AFAIK가 없습니다. 그러나 명령 줄에서 명령을 실행할 수 있습니다.

hive -e "<hivesql>" | grep "[num_partitions]" | <regex command to isolate the num_rows> 
+0

고맙습니다. 로깅 테이블에 내역을 저장하려는 경우 변수에 영향을 미치는 행 수를 저장할 수있는 방법이 있습니까? – Anand

+0

행 번호를 얻는 방법에 대한 답변이 업데이트되었습니다. – javadba

관련 문제