Saving all output to "!!{outputDirectory}!!/ppd_udf_case.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/ppd_udf_case.q >>> set hive.optimize.ppd=true; No rows affected >>> set hive.ppd.remove.duplicatefilters=false; No rows affected >>> >>> EXPLAIN SELECT * FROM srcpart a JOIN srcpart b ON a.key = b.key WHERE a.ds = '2008-04-08' AND b.ds = '2008-04-08' AND CASE a.key WHEN '27' THEN TRUE WHEN '38' THEN FALSE ELSE NULL END ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME srcpart) a) (TOK_TABREF (TOK_TABNAME srcpart) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (AND (AND (= (. (TOK_TABLE_OR_COL a) ds) '2008-04-08') (= (. (TOK_TABLE_OR_COL b) ds) '2008-04-08')) (TOK_FUNCTION CASE (. (TOK_TABLE_OR_COL a) key) '27' TRUE '38' FALSE TOK_NULL))) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) ds)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) hr)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) ds)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) hr)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Filter Operator' ' predicate:' ' expr: CASE (key) WHEN ('27') THEN (true) WHEN ('38') THEN (false) ELSE (null) END' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' expr: hr' ' type: string' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: CASE (key) WHEN ('27') THEN (true) WHEN ('38') THEN (false) ELSE (null) END' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' expr: hr' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1} {VALUE._col2} {VALUE._col3}' ' 1 {VALUE._col0} {VALUE._col1} {VALUE._col2} {VALUE._col3}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col2, _col3, _col6, _col7, _col8, _col9' ' Filter Operator' ' predicate:' ' expr: (((_col2 = '2008-04-08') and (_col8 = '2008-04-08')) and CASE (_col0) WHEN ('27') THEN (true) WHEN ('38') THEN (false) ELSE (null) END)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' expr: _col8' ' type: string' ' expr: _col9' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col4' ' type: string' ' expr: _col5' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' sort order: ++++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col4' ' type: string' ' expr: _col5' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' Reduce Operator Tree:' ' Extract' ' 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' '' '' 156 rows selected >>> >>> SELECT * FROM srcpart a JOIN srcpart b ON a.key = b.key WHERE a.ds = '2008-04-08' AND b.ds = '2008-04-08' AND CASE a.key WHEN '27' THEN TRUE WHEN '38' THEN FALSE ELSE NULL END ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr; 'key','value','ds','hr','key','value','ds','hr' '27','val_27','2008-04-08','11','27','val_27','2008-04-08','11' '27','val_27','2008-04-08','11','27','val_27','2008-04-08','12' '27','val_27','2008-04-08','12','27','val_27','2008-04-08','11' '27','val_27','2008-04-08','12','27','val_27','2008-04-08','12' 4 rows selected >>> >>> set hive.ppd.remove.duplicatefilters=true; No rows affected >>> >>> EXPLAIN SELECT * FROM srcpart a JOIN srcpart b ON a.key = b.key WHERE a.ds = '2008-04-08' AND b.ds = '2008-04-08' AND CASE a.key WHEN '27' THEN TRUE WHEN '38' THEN FALSE ELSE NULL END ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME srcpart) a) (TOK_TABREF (TOK_TABNAME srcpart) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (AND (AND (= (. (TOK_TABLE_OR_COL a) ds) '2008-04-08') (= (. (TOK_TABLE_OR_COL b) ds) '2008-04-08')) (TOK_FUNCTION CASE (. (TOK_TABLE_OR_COL a) key) '27' TRUE '38' FALSE TOK_NULL))) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) ds)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL a) hr)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) key)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) value)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) ds)) (TOK_TABSORTCOLNAMEASC (. (TOK_TABLE_OR_COL b) hr)))))' '' 'STAGE DEPENDENCIES:' ' Stage-1 is a root stage' ' Stage-2 depends on stages: Stage-1' ' Stage-0 is a root stage' '' 'STAGE PLANS:' ' Stage: Stage-1' ' Map Reduce' ' Alias -> Map Operator Tree:' ' a ' ' TableScan' ' alias: a' ' Filter Operator' ' predicate:' ' expr: CASE (key) WHEN ('27') THEN (true) WHEN ('38') THEN (false) ELSE (null) END' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 0' ' value expressions:' ' expr: key' ' type: string' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' expr: hr' ' type: string' ' b ' ' TableScan' ' alias: b' ' Filter Operator' ' predicate:' ' expr: CASE (key) WHEN ('27') THEN (true) WHEN ('38') THEN (false) ELSE (null) END' ' type: boolean' ' Reduce Output Operator' ' key expressions:' ' expr: key' ' type: string' ' sort order: +' ' Map-reduce partition columns:' ' expr: key' ' type: string' ' tag: 1' ' value expressions:' ' expr: key' ' type: string' ' expr: value' ' type: string' ' expr: ds' ' type: string' ' expr: hr' ' type: string' ' Reduce Operator Tree:' ' Join Operator' ' condition map:' ' Inner Join 0 to 1' ' condition expressions:' ' 0 {VALUE._col0} {VALUE._col1} {VALUE._col2} {VALUE._col3}' ' 1 {VALUE._col0} {VALUE._col1} {VALUE._col2} {VALUE._col3}' ' handleSkewJoin: false' ' outputColumnNames: _col0, _col1, _col2, _col3, _col6, _col7, _col8, _col9' ' Select Operator' ' expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' expr: _col8' ' type: string' ' expr: _col9' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7' ' File Output Operator' ' compressed: false' ' GlobalTableId: 0' ' table:' ' input format: org.apache.hadoop.mapred.SequenceFileInputFormat' ' output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat' '' ' Stage: Stage-2' ' Map Reduce' ' Alias -> Map Operator Tree:' ' file:!!{hive.exec.scratchdir}!! ' ' Reduce Output Operator' ' key expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col4' ' type: string' ' expr: _col5' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' sort order: ++++++++' ' tag: -1' ' value expressions:' ' expr: _col0' ' type: string' ' expr: _col1' ' type: string' ' expr: _col2' ' type: string' ' expr: _col3' ' type: string' ' expr: _col4' ' type: string' ' expr: _col5' ' type: string' ' expr: _col6' ' type: string' ' expr: _col7' ' type: string' ' Reduce Operator Tree:' ' Extract' ' 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' '' '' 152 rows selected >>> >>> SELECT * FROM srcpart a JOIN srcpart b ON a.key = b.key WHERE a.ds = '2008-04-08' AND b.ds = '2008-04-08' AND CASE a.key WHEN '27' THEN TRUE WHEN '38' THEN FALSE ELSE NULL END ORDER BY a.key, a.value, a.ds, a.hr, b.key, b.value, b.ds, b.hr; 'key','value','ds','hr','key','value','ds','hr' '27','val_27','2008-04-08','11','27','val_27','2008-04-08','11' '27','val_27','2008-04-08','11','27','val_27','2008-04-08','12' '27','val_27','2008-04-08','12','27','val_27','2008-04-08','11' '27','val_27','2008-04-08','12','27','val_27','2008-04-08','12' 4 rows selected >>> >>> !record