Saving all output to "!!{outputDirectory}!!/infer_const_type.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/infer_const_type.q >>> DROP TABLE infertypes; No rows affected >>> CREATE TABLE infertypes(ti TINYINT, si SMALLINT, i INT, bi BIGINT, fl FLOAT, db DOUBLE, str STRING); No rows affected >>> >>> LOAD DATA LOCAL INPATH '../data/files/infer_const_type.txt' OVERWRITE INTO TABLE infertypes; No rows affected >>> >>> SELECT * FROM infertypes; 'ti','si','i','bi','fl','db','str' '127','32767','12345','-12345','906.0','-307.0','1234' '126','32767','12345','-12345','906.0','-307.0','1234' '126','32767','12345','-12345','906.0','-307.0','1.57' 3 rows selected >>> >>> EXPLAIN SELECT * FROM infertypes WHERE ti = '127' AND si = 32767 AND i = '12345' AND bi = '-12345' AND fl = '0906' AND db = '-307' AND str = 1234; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME infertypes))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (AND (AND (AND (AND (AND (AND (= (TOK_TABLE_OR_COL ti) '127') (= (TOK_TABLE_OR_COL si) 32767)) (= (TOK_TABLE_OR_COL i) '12345')) (= (TOK_TABLE_OR_COL bi) '-12345')) (= (TOK_TABLE_OR_COL fl) '0906')) (= (TOK_TABLE_OR_COL db) '-307')) (= (TOK_TABLE_OR_COL str) 1234)))))' '' '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:' ' infertypes ' ' TableScan' ' alias: infertypes' ' Filter Operator' ' predicate:' ' expr: (((((((ti = 127) and (si = 32767)) and (i = 12345)) and (bi = -12345)) and (fl = 906.0)) and (db = -307.0)) and (str = 1234.0))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: ti' ' type: tinyint' ' expr: si' ' type: smallint' ' expr: i' ' type: int' ' expr: bi' ' type: bigint' ' expr: fl' ' type: float' ' expr: db' ' type: double' ' expr: str' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6' ' 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' '' '' 47 rows selected >>> >>> SELECT * FROM infertypes WHERE ti = '127' AND si = 32767 AND i = '12345' AND bi = '-12345' AND fl = '0906' AND db = '-307' AND str = 1234; 'ti','si','i','bi','fl','db','str' '127','32767','12345','-12345','906.0','-307.0','1234' 1 row selected >>> >>> -- all should return false as all numbers exceeed the largest number >>> -- which could be represented by the corresponding type >>> -- and string_col = long_const should return false >>> EXPLAIN SELECT * FROM infertypes WHERE ti = '128' OR si = 32768 OR i = '2147483648' OR bi = '9223372036854775808' OR fl = 'float' OR db = 'double'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME infertypes))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (OR (OR (OR (OR (OR (= (TOK_TABLE_OR_COL ti) '128') (= (TOK_TABLE_OR_COL si) 32768)) (= (TOK_TABLE_OR_COL i) '2147483648')) (= (TOK_TABLE_OR_COL bi) '9223372036854775808')) (= (TOK_TABLE_OR_COL fl) 'float')) (= (TOK_TABLE_OR_COL db) 'double')))))' '' '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:' ' infertypes ' ' TableScan' ' alias: infertypes' ' Filter Operator' ' predicate:' ' expr: (((((false or false) or false) or false) or false) or false)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: ti' ' type: tinyint' ' expr: si' ' type: smallint' ' expr: i' ' type: int' ' expr: bi' ' type: bigint' ' expr: fl' ' type: float' ' expr: db' ' type: double' ' expr: str' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6' ' 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' '' '' 47 rows selected >>> >>> SELECT * FROM infertypes WHERE ti = '128' OR si = 32768 OR i = '2147483648' OR bi = '9223372036854775808' OR fl = 'float' OR db = 'double'; 'ti','si','i','bi','fl','db','str' No rows selected >>> >>> -- for the query like: int_col = double, should return false >>> EXPLAIN SELECT * FROM infertypes WHERE ti = '127.0' OR si = 327.0 OR i = '-100.0'; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME infertypes))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (OR (OR (= (TOK_TABLE_OR_COL ti) '127.0') (= (TOK_TABLE_OR_COL si) 327.0)) (= (TOK_TABLE_OR_COL i) '-100.0')))))' '' '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:' ' infertypes ' ' TableScan' ' alias: infertypes' ' Filter Operator' ' predicate:' ' expr: ((false or false) or false)' ' type: boolean' ' Select Operator' ' expressions:' ' expr: ti' ' type: tinyint' ' expr: si' ' type: smallint' ' expr: i' ' type: int' ' expr: bi' ' type: bigint' ' expr: fl' ' type: float' ' expr: db' ' type: double' ' expr: str' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6' ' 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' '' '' 47 rows selected >>> >>> SELECT * FROM infertypes WHERE ti = '127.0' OR si = 327.0 OR i = '-100.0'; 'ti','si','i','bi','fl','db','str' No rows selected >>> >>> EXPLAIN SELECT * FROM infertypes WHERE ti < '127.0' AND i > '100.0' AND str = 1.57; 'Explain' 'ABSTRACT SYNTAX TREE:' ' (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME infertypes))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_WHERE (AND (AND (< (TOK_TABLE_OR_COL ti) '127.0') (> (TOK_TABLE_OR_COL i) '100.0')) (= (TOK_TABLE_OR_COL str) 1.57)))))' '' '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:' ' infertypes ' ' TableScan' ' alias: infertypes' ' Filter Operator' ' predicate:' ' expr: (((ti < 127.0) and (i > 100.0)) and (str = 1.57))' ' type: boolean' ' Select Operator' ' expressions:' ' expr: ti' ' type: tinyint' ' expr: si' ' type: smallint' ' expr: i' ' type: int' ' expr: bi' ' type: bigint' ' expr: fl' ' type: float' ' expr: db' ' type: double' ' expr: str' ' type: string' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6' ' 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' '' '' 47 rows selected >>> >>> SELECT * FROM infertypes WHERE ti < '127.0' AND i > '100.0' AND str = 1.57; 'ti','si','i','bi','fl','db','str' '126','32767','12345','-12345','906.0','-307.0','1.57' 1 row selected >>> >>> DROP TABLE infertypes; No rows affected >>> !record