PREHOOK: query: use default PREHOOK: type: SWITCHDATABASE POSTHOOK: query: use default POSTHOOK: type: SWITCHDATABASE PREHOOK: query: -- Test format_number() UDF DESCRIBE FUNCTION format_number PREHOOK: type: DESCFUNCTION POSTHOOK: query: -- Test format_number() UDF DESCRIBE FUNCTION format_number POSTHOOK: type: DESCFUNCTION format_number(X, D) - Formats the number X to a format like '#,###,###.##', rounded to D decimal places, and returns the result as a string. If D is 0, the result has no decimal point or fractional part. This is supposed to function like MySQL's FORMAT PREHOOK: query: DESCRIBE FUNCTION EXTENDED format_number PREHOOK: type: DESCFUNCTION POSTHOOK: query: DESCRIBE FUNCTION EXTENDED format_number POSTHOOK: type: DESCFUNCTION format_number(X, D) - Formats the number X to a format like '#,###,###.##', rounded to D decimal places, and returns the result as a string. If D is 0, the result has no decimal point or fractional part. This is supposed to function like MySQL's FORMAT Example: > SELECT format_number(12332.123456, 4) FROM src LIMIT 1; '12,332.1235' PREHOOK: query: EXPLAIN SELECT format_number(12332.123456, 4), format_number(12332.1,4), format_number(12332.2,0) FROM src limit 1 PREHOOK: type: QUERY POSTHOOK: query: EXPLAIN SELECT format_number(12332.123456, 4), format_number(12332.1,4), format_number(12332.2,0) FROM src limit 1 POSTHOOK: type: QUERY 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 format_number 12332.123456 4)) (TOK_SELEXPR (TOK_FUNCTION format_number 12332.1 4)) (TOK_SELEXPR (TOK_FUNCTION format_number 12332.2 0))) (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: format_number(12332.123456, 4) type: string expr: format_number(12332.1, 4) type: string expr: format_number(12332.2, 0) type: string outputColumnNames: _col0, _col1, _col2 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 PREHOOK: query: SELECT format_number(12332.123456, 4), format_number(12332.1,4), format_number(12332.2,0) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: SELECT format_number(12332.123456, 4), format_number(12332.1,4), format_number(12332.2,0) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### 12,332.1235 12,332.1000 12,332 PREHOOK: query: -- positive numbers SELECT format_number(0.123456789, 12), format_number(12345678.123456789, 5), format_number(1234567.123456789, 7), format_number(123456.123456789, 0) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: -- positive numbers SELECT format_number(0.123456789, 12), format_number(12345678.123456789, 5), format_number(1234567.123456789, 7), format_number(123456.123456789, 0) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### 0.123456789000 12,345,678.12346 1,234,567.1234568 123,456 PREHOOK: query: -- negative numbers SELECT format_number(-123456.123456789, 0), format_number(-1234567.123456789, 2), format_number(-0.123456789, 15), format_number(-12345.123456789, 4) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: -- negative numbers SELECT format_number(-123456.123456789, 0), format_number(-1234567.123456789, 2), format_number(-0.123456789, 15), format_number(-12345.123456789, 4) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### -123,456 -1,234,567.12 -0.123456789000000 -12,345.1235 PREHOOK: query: -- zeros SELECT format_number(0.0, 4), format_number(0.000000, 1), format_number(000.0000, 1), format_number(00000.0000, 1), format_number(-00.0, 4) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: -- zeros SELECT format_number(0.0, 4), format_number(0.000000, 1), format_number(000.0000, 1), format_number(00000.0000, 1), format_number(-00.0, 4) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### 0.0000 0.0 0.0 0.0 -0.0000 PREHOOK: query: -- integers SELECT format_number(0, 0), format_number(1, 4), format_number(12, 2), format_number(123, 5), format_number(1234, 7) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: -- integers SELECT format_number(0, 0), format_number(1, 4), format_number(12, 2), format_number(123, 5), format_number(1234, 7) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### 0 1.0000 12.00 123.00000 1,234.0000000 PREHOOK: query: -- long and double boundary -- 9223372036854775807 is LONG_MAX -- -9223372036854775807 is one more than LONG_MIN, -- due to HIVE-2733, put it here to check LONG_MIN boundary -- 4.9E-324 and 1.7976931348623157E308 are Double.MIN_VALUE and Double.MAX_VALUE -- check them for Double boundary SELECT format_number(-9223372036854775807, 10), format_number(9223372036854775807, 20), format_number(4.9E-324, 324), format_number(1.7976931348623157E308, 308) FROM src limit 1 PREHOOK: type: QUERY PREHOOK: Input: default@src #### A masked pattern was here #### POSTHOOK: query: -- long and double boundary -- 9223372036854775807 is LONG_MAX -- -9223372036854775807 is one more than LONG_MIN, -- due to HIVE-2733, put it here to check LONG_MIN boundary -- 4.9E-324 and 1.7976931348623157E308 are Double.MIN_VALUE and Double.MAX_VALUE -- check them for Double boundary SELECT format_number(-9223372036854775807, 10), format_number(9223372036854775807, 20), format_number(4.9E-324, 324), format_number(1.7976931348623157E308, 308) FROM src limit 1 POSTHOOK: type: QUERY POSTHOOK: Input: default@src #### A masked pattern was here #### -9,223,372,036,854,775,807.0000000000 9,223,372,036,854,775,807.00000000000000000000 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005 179,769,313,486,231,570,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000,000.00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000