Saving all output to "!!{outputDirectory}!!/union21.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/union21.q >>> -- union of constants, udf outputs, and columns from text table and thrift table >>> >>> explain SELECT key, count(1) FROM ( SELECT '1' as key from src UNION ALL SELECT reverse(key) as key from src UNION ALL SELECT key as key from src UNION ALL SELECT astring as key from src_thrift UNION ALL SELECT lstring[0] as key from src_thrift ) union_output GROUP BY key; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR '1' key)))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION reverse (TOK_TABLE_OR_COL key)) key))))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key) key))))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_thrift))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL astring) key))))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src_thrift))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR ([ (TOK_TABLE_OR_COL lstring) 0) key))))) union_output)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_TABLE_OR_COL key)) (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_GROUPBY (TOK_TABLE_OR_COL key))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' null-subquery1-subquery1-subquery1-subquery1:union_output-subquery1-subquery1-subquery1-subquery1:src ' ' TableScan' ' alias: src' ' Select Operator' ' expressions:' ' expr: '1'' ' type: string' ' outputColumnNames: _col0' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: bigint' ' null-subquery1-subquery1-subquery1-subquery2:union_output-subquery1-subquery1-subquery1-subquery2:src ' ' TableScan' ' alias: src' ' Select Operator' ' expressions:' ' expr: reverse(key)' ' type: string' ' outputColumnNames: _col0' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: bigint' ' null-subquery1-subquery1-subquery2:union_output-subquery1-subquery1-subquery2:src ' ' TableScan' ' alias: src' ' Select Operator' ' expressions:' ' expr: key' ' type: string' ' outputColumnNames: _col0' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: bigint' ' null-subquery1-subquery2:union_output-subquery1-subquery2:src_thrift ' ' TableScan' ' alias: src_thrift' ' Select Operator' ' expressions:' ' expr: astring' ' type: string' ' outputColumnNames: _col0' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: bigint' ' null-subquery2:union_output-subquery2:src_thrift ' ' TableScan' ' alias: src_thrift' ' Select Operator' ' expressions:' ' expr: lstring[0]' ' type: string' ' outputColumnNames: _col0' ' Union' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' outputColumnNames: _col0' ' Group By Operator' ' aggregations:' ' expr: count(1)' ' bucketGroup: false' ' keys:' ' expr: _col0' ' type: string' ' mode: hash' ' outputColumnNames: _col0, _col1' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: _col0' ' type: string' ' tag: -1' ' value expressions:' ' expr: _col1' ' type: bigint' ' Reduce Operator Tree:' ' Group By Operator' ' aggregations:' ' expr: count(VALUE._col0)' ' bucketGroup: false' ' keys:' ' expr: KEY._col0' ' type: string' ' mode: mergepartial' ' outputColumnNames: _col0, _col1' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: bigint' ' outputColumnNames: _col0, _col1' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.TextInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat' '' ' Stage: Stage-0' ' Fetch Operator' ' limit: -1' '' '' 215 rows selected >>> >>> SELECT key, count(1) FROM ( SELECT '1' as key from src UNION ALL SELECT reverse(key) as key from src UNION ALL SELECT key as key from src UNION ALL SELECT astring as key from src_thrift UNION ALL SELECT lstring[0] as key from src_thrift ) union_output GROUP BY key; 'key','_c1' '','2' '0','7' '001','2' '002','2' '004','1' '01','1' '013','1' '02','1' '021','2' '03','1' '032','5' '034','3' '051','1' '061','1' '062','1' '063','1' '064','1' '07','3' '071','1' '074','1' '08','1' '081','1' '082','2' '084','3' '09','3' '091','1' '094','1' '1','500' '10','2' '100','2' '102','1' '103','2' '104','7' '105','1' '11','2' '111','2' '113','5' '114','2' '116','1' '118','2' '119','3' '12','2' '120','2' '122','2' '123','2' '124','1' '125','2' '126','1' '128','3' '129','2' '131','2' '133','3' '134','5' '136','1' '137','2' '138','4' '14','1' '142','1' '143','2' '145','1' '146','2' '149','2' '15','4' '150','1' '152','2' '153','2' '155','1' '156','1' '157','1' '158','1' '160','1' '162','1' '163','1' '164','2' '165','2' '166','1' '167','3' '168','1' '169','4' '17','1' '170','1' '172','2' '174','2' '175','2' '176','2' '177','1' '178','1' '179','2' '18','2' '180','1' '181','2' '182','2' '183','1' '184','1' '186','1' '187','3' '189','1' '19','1' '190','1' '191','4' '192','2' '193','3' '194','2' '195','2' '196','1' '197','2' '199','3' '2','2' '20','2' '200','2' '201','1' '202','2' '203','3' '204','1' '205','2' '207','2' '208','3' '209','2' '21','2' '213','2' '214','1' '216','2' '217','2' '218','1' '219','2' '221','2' '222','2' '223','4' '224','2' '226','1' '228','1' '229','2' '230','5' '233','3' '234','1' '235','1' '237','2' '238','2' '239','2' '24','4' '241','1' '242','4' '243','2' '244','1' '247','1' '248','1' '249','1' '251','2' '252','2' '254','1' '255','2' '256','2' '257','1' '258','1' '26','2' '260','1' '261','1' '262','2' '263','2' '264','2' '265','2' '266','1' '27','3' '271','2' '272','4' '273','3' '274','2' '275','1' '277','4' '278','2' '28','2' '280','2' '281','2' '282','4' '283','3' '284','2' '285','1' '286','1' '287','1' '288','2' '289','1' '29','1' '291','2' '292','2' '293','1' '294','2' '296','1' '298','3' '30','2' '301','2' '302','3' '304','3' '305','1' '306','1' '307','2' '308','1' '309','2' '310','1' '311','5' '312','2' '314','2' '315','1' '316','3' '317','2' '318','3' '321','2' '322','4' '323','2' '325','2' '327','3' '33','2' '331','3' '332','3' '333','4' '335','1' '336','1' '338','1' '339','1' '34','2' '341','2' '342','2' '344','3' '345','1' '348','5' '35','4' '351','2' '353','4' '354','1' '356','1' '360','1' '361','1' '362','2' '364','3' '365','1' '366','1' '367','2' '368','1' '369','3' '37','2' '372','3' '373','2' '374','1' '375','1' '377','1' '378','1' '379','1' '38','2' '381','1' '382','3' '384','4' '386','1' '389','1' '391','3' '392','1' '393','2' '394','2' '395','2' '396','3' '397','2' '399','2' '4','2' '40','1' '400','1' '401','7' '402','1' '403','3' '404','4' '406','4' '407','1' '409','3' '41','1' '411','2' '412','1' '413','2' '414','4' '417','3' '418','1' '419','1' '42','4' '421','1' '422','2' '424','4' '427','1' '429','2' '43','2' '430','3' '431','5' '432','1' '435','1' '436','1' '437','1' '438','3' '439','2' '44','2' '442','1' '443','3' '444','2' '446','1' '448','1' '449','1' '45','1' '452','1' '453','1' '454','6' '455','1' '457','1' '458','2' '459','2' '46','1' '460','1' '461','2' '462','2' '463','3' '466','3' '467','1' '468','4' '469','5' '47','2' '470','1' '471','2' '472','2' '473','1' '475','1' '477','1' '478','2' '479','1' '48','2' '480','3' '481','1' '482','2' '483','4' '484','2' '485','1' '487','1' '489','4' '490','1' '491','2' '492','2' '493','2' '494','2' '495','1' '496','1' '497','1' '498','3' '5','6' '50','1' '501','1' '502','2' '503','1' '51','4' '513','1' '521','2' '523','2' '53','4' '532','1' '533','1' '534','1' '54','1' '541','1' '543','1' '551','1' '552','2' '554','1' '56','1' '561','2' '562','2' '563','1' '57','1' '571','2' '572','1' '573','1' '574','1' '58','3' '582','1' '584','1' '59','2' '591','2' '593','2' '594','1' '60','1' '603','1' '604','4' '611','1' '612','2' '613','3' '62','2' '621','1' '622','1' '631','1' '633','1' '634','1' '64','1' '641','2' '644','1' '65','1' '651','1' '652','2' '653','1' '66','2' '661','1' '662','1' '663','1' '664','3' '67','4' '671','2' '68','1' '681','1' '682','1' '683','1' '69','2' '691','1' '692','1' '693','3' '694','1' '70','4' '702','2' '703','2' '704','1' '71','1' '712','2' '713','2' '714','3' '72','3' '723','3' '724','1' '73','2' '731','2' '732','2' '734','1' '74','2' '742','1' '75','1' '751','1' '752','1' '754','1' '76','4' '761','3' '763','2' '764','1' '77','2' '771','1' '772','4' '773','1' '774','1' '78','2' '781','3' '782','1' '784','1' '79','2' '791','2' '793','2' '794','1' '8','2' '80','2' '802','3' '803','1' '81','2' '811','2' '812','1' '813','3' '814','1' '82','2' '821','3' '822','1' '83','2' '831','4' '832','2' '833','1' '834','3' '84','2' '842','1' '843','5' '844','1' '85','3' '851','1' '852','1' '854','2' '86','1' '861','1' '863','1' '864','4' '87','2' '871','1' '872','2' '873','1' '874','2' '882','2' '89','2' '892','3' '894','3' '9','2' '90','4' '902','2' '903','2' '904','3' '91','1' '911','3' '912','2' '914','1' '92','1' '921','2' '922','2' '924','2' '932','2' '933','1' '934','2' '941','2' '942','1' '944','1' '95','2' '954','2' '96','2' '961','4' '963','3' '964','5' '97','2' '971','2' '973','1' '974','1' '98','2' '981','1' '982','1' '983','1' '984','4' '991','3' '993','2' 'record_0','1' 'record_1','1' 'record_2','1' 'record_3','1' 'record_4','1' 'record_5','1' 'record_6','1' 'record_7','1' 'record_8','1' 'record_9','1' 536 rows selected >>> !record