Saving all output to "!!{outputDirectory}!!/udf_locate.q.raw". Enter "record" with no arguments to stop it. >>> !run !!{qFileDirectory}!!/udf_locate.q >>> DESCRIBE FUNCTION locate; 'tab_name' 'locate(substr, str[, pos]) - Returns the position of the first occurance of substr in str after position pos' 1 row selected >>> DESCRIBE FUNCTION EXTENDED locate; 'tab_name' 'locate(substr, str[, pos]) - Returns the position of the first occurance of substr in str after position pos' 'Example:' ' > SELECT locate('bar', 'foobarbar', 5) FROM src LIMIT 1;' ' 7' 4 rows selected >>> >>> EXPLAIN SELECT locate('abc', 'abcd'), locate('ccc', 'abcabc'), locate('23', 123), locate(23, 123), locate('abc', 'abcabc', 2), locate('abc', 'abcabc', '2'), locate(1, TRUE), locate(1, FALSE), locate(CAST('2' AS TINYINT), '12345'), locate('34', CAST('12345' AS SMALLINT)), locate('456', CAST('123456789012' AS BIGINT)), locate('.25', CAST(1.25 AS FLOAT)), locate('.0', CAST(16.0 AS DOUBLE)), locate(null, 'abc'), locate('abc', null), locate('abc', 'abcd', null), locate('abc', 'abcd', 'invalid number') 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 locate 'abc' 'abcd')) (TOK_SELEXPR (TOK_FUNCTION locate 'ccc' 'abcabc')) (TOK_SELEXPR (TOK_FUNCTION locate '23' 123)) (TOK_SELEXPR (TOK_FUNCTION locate 23 123)) (TOK_SELEXPR (TOK_FUNCTION locate 'abc' 'abcabc' 2)) (TOK_SELEXPR (TOK_FUNCTION locate 'abc' 'abcabc' '2')) (TOK_SELEXPR (TOK_FUNCTION locate 1 TRUE)) (TOK_SELEXPR (TOK_FUNCTION locate 1 FALSE)) (TOK_SELEXPR (TOK_FUNCTION locate (TOK_FUNCTION TOK_TINYINT '2') '12345')) (TOK_SELEXPR (TOK_FUNCTION locate '34' (TOK_FUNCTION TOK_SMALLINT '12345'))) (TOK_SELEXPR (TOK_FUNCTION locate '456' (TOK_FUNCTION TOK_BIGINT '123456789012'))) (TOK_SELEXPR (TOK_FUNCTION locate '.25' (TOK_FUNCTION TOK_FLOAT 1.25))) (TOK_SELEXPR (TOK_FUNCTION locate '.0' (TOK_FUNCTION TOK_DOUBLE 16.0))) (TOK_SELEXPR (TOK_FUNCTION locate TOK_NULL 'abc')) (TOK_SELEXPR (TOK_FUNCTION locate 'abc' TOK_NULL)) (TOK_SELEXPR (TOK_FUNCTION locate 'abc' 'abcd' TOK_NULL)) (TOK_SELEXPR (TOK_FUNCTION locate 'abc' 'abcd' 'invalid number'))) (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: locate('abc''abcd')' ' type: int' ' expr: locate('ccc''abcabc')' ' type: int' ' expr: locate('23'123)' ' type: int' ' expr: locate(23123)' ' type: int' ' expr: locate('abc''abcabc'2)' ' type: int' ' expr: locate('abc''abcabc''2')' ' type: int' ' expr: locate(1true)' ' type: int' ' expr: locate(1false)' ' type: int' ' expr: locate(UDFToByte('2')'12345')' ' type: int' ' expr: locate('34'UDFToShort('12345'))' ' type: int' ' expr: locate('456'UDFToLong('123456789012'))' ' type: int' ' expr: locate('.25'UDFToFloat(1.25))' ' type: int' ' expr: locate('.0'16.0)' ' type: int' ' expr: locate(null'abc')' ' type: int' ' expr: locate('abc'null)' ' type: int' ' expr: locate('abc''abcd'null)' ' type: int' ' expr: locate('abc''abcd''invalid number')' ' type: int' ' outputColumnNames: _col0, _col1, _col2, _col3, _col4, _col5, _col6, _col7, _col8, _col9, _col10, _col11, _col12, _col13, _col14, _col15, _col16' ' 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' '' '' 64 rows selected >>> >>> SELECT locate('abc', 'abcd'), locate('ccc', 'abcabc'), locate('23', 123), locate(23, 123), locate('abc', 'abcabc', 2), locate('abc', 'abcabc', '2'), locate(1, TRUE), locate(1, FALSE), locate(CAST('2' AS TINYINT), '12345'), locate('34', CAST('12345' AS SMALLINT)), locate('456', CAST('123456789012' AS BIGINT)), locate('.25', CAST(1.25 AS FLOAT)), locate('.0', CAST(16.0 AS DOUBLE)), locate(null, 'abc'), locate('abc', null), locate('abc', 'abcd', null), locate('abc', 'abcd', 'invalid number') FROM src LIMIT 1; '_c0','_c1','_c2','_c3','_c4','_c5','_c6','_c7','_c8','_c9','_c10','_c11','_c12','_c13','_c14','_c15','_c16' '1','0','2','2','4','4','0','0','2','3','4','2','3','','','0','0' 1 row selected >>> !record