diff --git ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java index 9eb95a1..c5bdb1b 100644 --- ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java +++ ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java @@ -418,11 +418,13 @@ protected void initializeOp(Configuration hconf) throws HiveException { numRows = 0; - String context = jc.get(Operator.CONTEXT_NAME_KEY, ""); - if (context != null && !context.isEmpty()) { - context = "_" + context.replace(" ","_"); + String suffix = conf.getDestTableId(); + String fullName = conf.getTableInfo().getTableName(); + if (fullName != null) { + suffix = suffix + "_" + fullName.toLowerCase(); } - statsMap.put(Counter.RECORDS_OUT + context, row_count); + + statsMap.put(Counter.RECORDS_OUT + "_" + suffix, row_count); initializeChildren(hconf); } catch (HiveException e) { diff --git ql/src/java/org/apache/hadoop/hive/ql/history/HiveHistoryImpl.java ql/src/java/org/apache/hadoop/hive/ql/history/HiveHistoryImpl.java index f75b70e..b7b6f90 100644 --- ql/src/java/org/apache/hadoop/hive/ql/history/HiveHistoryImpl.java +++ ql/src/java/org/apache/hadoop/hive/ql/history/HiveHistoryImpl.java @@ -67,7 +67,7 @@ private static final String DELIMITER = " "; - private static final String ROW_COUNT_PATTERN = "TABLE_ID_(\\d+)_ROWCOUNT"; + private static final String ROW_COUNT_PATTERN = "RECORDS_OUT_(\\d+)(_)*(\\S+)*"; private static final Pattern rowCountPattern = Pattern.compile(ROW_COUNT_PATTERN); @@ -343,6 +343,10 @@ String getRowCountTableName(String name) { if (m.find()) { String tuple = m.group(1); + String tableName = m.group(3); + if (tableName != null) + return tableName; + return idToTableMap.get(tuple); } return null;