Saving all output to "!!{outputDirectory}!!/udf_case.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/udf_case.q >>> DESCRIBE FUNCTION case; 'tab_name' 'There is no documentation for function 'case'' 1 row selected >>> DESCRIBE FUNCTION EXTENDED case; 'tab_name' 'There is no documentation for function 'case'' 1 row selected >>> >>> EXPLAIN SELECT CASE 1 WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE 5 END, CASE 2 WHEN 1 THEN 2 ELSE 5 END, CASE 14 WHEN 12 THEN 13 WHEN 14 THEN 15 END, CASE 16 WHEN 12 THEN 13 WHEN 14 THEN 15 END, CASE 17 WHEN 18 THEN NULL WHEN 17 THEN 20 END, CASE 21 WHEN 22 THEN 23 WHEN 21 THEN 24 END FROM src LIMIT 1; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME src))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION CASE 1 1 2 3 4 5)) (TOK_SELEXPR (TOK_FUNCTION CASE 2 1 2 5)) (TOK_SELEXPR (TOK_FUNCTION CASE 14 12 13 14 15)) (TOK_SELEXPR (TOK_FUNCTION CASE 16 12 13 14 15)) (TOK_SELEXPR (TOK_FUNCTION CASE 17 18 TOK_NULL 17 20)) (TOK_SELEXPR (TOK_FUNCTION CASE 21 22 23 21 24))) (TOK_LIMIT 1)))' '' '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:' ' src ' ' TableScan' ' alias: src' ' Select Operator' ' expressions:' ' expr: CASE (1) WHEN (1) THEN (2) WHEN (3) THEN (4) ELSE (5) END' ' type: int' ' expr: CASE (2) WHEN (1) THEN (2) ELSE (5) END' ' type: int' ' expr: CASE (14) WHEN (12) THEN (13) WHEN (14) THEN (15) END' ' type: int' ' expr: CASE (16) WHEN (12) THEN (13) WHEN (14) THEN (15) END' ' type: int' ' expr: CASE (17) WHEN (18) THEN (null) WHEN (17) THEN (20) END' ' type: int' ' expr: CASE (21) WHEN (22) THEN (23) WHEN (21) THEN (24) END' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5' ' Limit' ' 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' '' '' 42 rows selected >>> >>> SELECT CASE 1 WHEN 1 THEN 2 WHEN 3 THEN 4 ELSE 5 END, CASE 2 WHEN 1 THEN 2 ELSE 5 END, CASE 14 WHEN 12 THEN 13 WHEN 14 THEN 15 END, CASE 16 WHEN 12 THEN 13 WHEN 14 THEN 15 END, CASE 17 WHEN 18 THEN NULL WHEN 17 THEN 20 END, CASE 21 WHEN 22 THEN 23 WHEN 21 THEN 24 END FROM src LIMIT 1; '_c0','_c1','_c2','_c3','_c4','_c5' '2','5','15','','20','24' 1 row selected >>> >>> -- verify that short-circuiting is working correctly for CASE >>> -- we should never get to the ELSE branch, which would raise an exception >>> SELECT CASE 1 WHEN 1 THEN 'yo' ELSE reflect('java.lang.String', 'bogus', 1) END FROM src LIMIT 1; '_c0' 'yo' 1 row selected >>> !record