PageRenderTime 16ms CodeModel.GetById 11ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/tags/release-0.2.0-rc0/hive/external/ql/src/test/results/clientpositive/udf_get_json_object.q.out

#
text | 157 lines | 151 code | 6 blank | 0 comment | 0 complexity | 6cffdc950e0e0ea860fd41f8edecd88d MD5 | raw file
  1PREHOOK: query: DESCRIBE FUNCTION get_json_object
  2PREHOOK: type: DESCFUNCTION
  3POSTHOOK: query: DESCRIBE FUNCTION get_json_object
  4POSTHOOK: type: DESCFUNCTION
  5get_json_object(json_txt, path) - Extract a json object from path 
  6PREHOOK: query: DESCRIBE FUNCTION EXTENDED get_json_object
  7PREHOOK: type: DESCFUNCTION
  8POSTHOOK: query: DESCRIBE FUNCTION EXTENDED get_json_object
  9POSTHOOK: type: DESCFUNCTION
 10get_json_object(json_txt, path) - Extract a json object from path 
 11Extract json object from a json string based on json path specified, and return json string of the extracted json object. It will return null if the input json string is invalid.
 12A limited version of JSONPath supported:
 13  $   : Root object
 14  .   : Child operator
 15  []  : Subscript operator for array
 16  *   : Wildcard for []
 17Syntax not supported that's worth noticing:
 18  ''  : Zero length string as key
 19  ..  : Recursive descent
 20  @   : Current object/element
 21  ()  : Script expression
 22  ?() : Filter (script) expression.
 23  [,] : Union operator
 24  [start:end:step] : array slice operator
 25
 26PREHOOK: query: CREATE TABLE dest1(c1 STRING) STORED AS TEXTFILE
 27PREHOOK: type: CREATETABLE
 28POSTHOOK: query: CREATE TABLE dest1(c1 STRING) STORED AS TEXTFILE
 29POSTHOOK: type: CREATETABLE
 30POSTHOOK: Output: default@dest1
 31PREHOOK: query: FROM src INSERT OVERWRITE TABLE dest1 SELECT '  abc  ' WHERE src.key = 86
 32PREHOOK: type: QUERY
 33PREHOOK: Input: default@src
 34PREHOOK: Output: default@dest1
 35POSTHOOK: query: FROM src INSERT OVERWRITE TABLE dest1 SELECT '  abc  ' WHERE src.key = 86
 36POSTHOOK: type: QUERY
 37POSTHOOK: Input: default@src
 38POSTHOOK: Output: default@dest1
 39POSTHOOK: Lineage: dest1.c1 SIMPLE []
 40PREHOOK: query: EXPLAIN
 41SELECT get_json_object(src_json.json, '$.owner') FROM src_json
 42PREHOOK: type: QUERY
 43POSTHOOK: query: EXPLAIN
 44SELECT get_json_object(src_json.json, '$.owner') FROM src_json
 45POSTHOOK: type: QUERY
 46POSTHOOK: Lineage: dest1.c1 SIMPLE []
 47ABSTRACT SYNTAX TREE:
 48  (TOK_QUERY (TOK_FROM (TOK_TABREF src_json)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION get_json_object (. (TOK_TABLE_OR_COL src_json) json) '$.owner')))))
 49
 50STAGE DEPENDENCIES:
 51  Stage-1 is a root stage
 52  Stage-0 is a root stage
 53
 54STAGE PLANS:
 55  Stage: Stage-1
 56    Map Reduce
 57      Alias -> Map Operator Tree:
 58        src_json 
 59          TableScan
 60            alias: src_json
 61            Select Operator
 62              expressions:
 63                    expr: get_json_object(json, '$.owner')
 64                    type: string
 65              outputColumnNames: _col0
 66              File Output Operator
 67                compressed: false
 68                GlobalTableId: 0
 69                table:
 70                    input format: org.apache.hadoop.mapred.TextInputFormat
 71                    output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
 72
 73  Stage: Stage-0
 74    Fetch Operator
 75      limit: -1
 76
 77
 78PREHOOK: query: SELECT get_json_object(src_json.json, '$') FROM src_json
 79PREHOOK: type: QUERY
 80PREHOOK: Input: default@src_json
 81PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-14_447_588438208114015011/10000
 82POSTHOOK: query: SELECT get_json_object(src_json.json, '$') FROM src_json
 83POSTHOOK: type: QUERY
 84POSTHOOK: Input: default@src_json
 85POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-14_447_588438208114015011/10000
 86POSTHOOK: Lineage: dest1.c1 SIMPLE []
 87{"store":{"fruit":[{"weight":8,"type":"apple"},{"weight":9,"type":"pear"}],"book":[{"author":"Nigel Rees","category":"reference","title":"Sayings of the Century","price":8.95},{"author":"Herman Melville","category":"fiction","title":"Moby Dick","price":8.99,"isbn":"0-553-21311-3"},{"author":"J. R. R. Tolkien","category":"fiction","title":"The Lord of the Rings","price":22.99,"reader":[{"name":"bob","age":25},{"name":"jack","age":26}],"isbn":"0-395-19395-8"}],"basket":[[1,2,{"b":"y","a":"x"}],[3,4],[5,6]],"bicycle":{"price":19.95,"color":"red"}},"email":"amy@only_for_json_udf_test.net","owner":"amy"}
 88PREHOOK: query: SELECT get_json_object(src_json.json, '$.owner'), get_json_object(src_json.json, '$.store') FROM src_json
 89PREHOOK: type: QUERY
 90PREHOOK: Input: default@src_json
 91PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-18_096_5433104910168634226/10000
 92POSTHOOK: query: SELECT get_json_object(src_json.json, '$.owner'), get_json_object(src_json.json, '$.store') FROM src_json
 93POSTHOOK: type: QUERY
 94POSTHOOK: Input: default@src_json
 95POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-18_096_5433104910168634226/10000
 96POSTHOOK: Lineage: dest1.c1 SIMPLE []
 97amy	{"fruit":[{"weight":8,"type":"apple"},{"weight":9,"type":"pear"}],"book":[{"author":"Nigel Rees","category":"reference","title":"Sayings of the Century","price":8.95},{"author":"Herman Melville","category":"fiction","title":"Moby Dick","price":8.99,"isbn":"0-553-21311-3"},{"author":"J. R. R. Tolkien","category":"fiction","title":"The Lord of the Rings","price":22.99,"reader":[{"name":"bob","age":25},{"name":"jack","age":26}],"isbn":"0-395-19395-8"}],"basket":[[1,2,{"b":"y","a":"x"}],[3,4],[5,6]],"bicycle":{"price":19.95,"color":"red"}}
 98PREHOOK: query: SELECT get_json_object(src_json.json, '$.store.bicycle'), get_json_object(src_json.json, '$.store.book') FROM src_json
 99PREHOOK: type: QUERY
100PREHOOK: Input: default@src_json
101PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-21_313_644009047344298458/10000
102POSTHOOK: query: SELECT get_json_object(src_json.json, '$.store.bicycle'), get_json_object(src_json.json, '$.store.book') FROM src_json
103POSTHOOK: type: QUERY
104POSTHOOK: Input: default@src_json
105POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-21_313_644009047344298458/10000
106POSTHOOK: Lineage: dest1.c1 SIMPLE []
107{"price":19.95,"color":"red"}	[{"author":"Nigel Rees","category":"reference","title":"Sayings of the Century","price":8.95},{"author":"Herman Melville","category":"fiction","title":"Moby Dick","price":8.99,"isbn":"0-553-21311-3"},{"author":"J. R. R. Tolkien","category":"fiction","title":"The Lord of the Rings","price":22.99,"reader":[{"name":"bob","age":25},{"name":"jack","age":26}],"isbn":"0-395-19395-8"}]
108PREHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[0]'), get_json_object(src_json.json, '$.store.book[*]') FROM src_json
109PREHOOK: type: QUERY
110PREHOOK: Input: default@src_json
111PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-24_685_8457778368302883452/10000
112POSTHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[0]'), get_json_object(src_json.json, '$.store.book[*]') FROM src_json
113POSTHOOK: type: QUERY
114POSTHOOK: Input: default@src_json
115POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-24_685_8457778368302883452/10000
116POSTHOOK: Lineage: dest1.c1 SIMPLE []
117{"author":"Nigel Rees","category":"reference","title":"Sayings of the Century","price":8.95}	[{"author":"Nigel Rees","category":"reference","title":"Sayings of the Century","price":8.95},{"author":"Herman Melville","category":"fiction","title":"Moby Dick","price":8.99,"isbn":"0-553-21311-3"},{"author":"J. R. R. Tolkien","category":"fiction","title":"The Lord of the Rings","price":22.99,"reader":[{"name":"bob","age":25},{"name":"jack","age":26}],"isbn":"0-395-19395-8"}]
118PREHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[0].category'), get_json_object(src_json.json, '$.store.book[*].category'), get_json_object(src_json.json, '$.store.book[*].isbn'), get_json_object(src_json.json, '$.store.book[*].reader') FROM src_json
119PREHOOK: type: QUERY
120PREHOOK: Input: default@src_json
121PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-27_983_4573769925077927197/10000
122POSTHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[0].category'), get_json_object(src_json.json, '$.store.book[*].category'), get_json_object(src_json.json, '$.store.book[*].isbn'), get_json_object(src_json.json, '$.store.book[*].reader') FROM src_json
123POSTHOOK: type: QUERY
124POSTHOOK: Input: default@src_json
125POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-27_983_4573769925077927197/10000
126POSTHOOK: Lineage: dest1.c1 SIMPLE []
127reference	["reference","fiction","fiction"]	["0-553-21311-3","0-395-19395-8"]	[{"name":"bob","age":25},{"name":"jack","age":26}]
128PREHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[*].reader[0].age'), get_json_object(src_json.json, '$.store.book[*].reader[*].age')  FROM src_json
129PREHOOK: type: QUERY
130PREHOOK: Input: default@src_json
131PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-31_316_8337341337637490694/10000
132POSTHOOK: query: SELECT get_json_object(src_json.json, '$.store.book[*].reader[0].age'), get_json_object(src_json.json, '$.store.book[*].reader[*].age')  FROM src_json
133POSTHOOK: type: QUERY
134POSTHOOK: Input: default@src_json
135POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-31_316_8337341337637490694/10000
136POSTHOOK: Lineage: dest1.c1 SIMPLE []
13725	[25,26]
138PREHOOK: query: SELECT get_json_object(src_json.json, '$.store.basket[0][1]'), get_json_object(src_json.json, '$.store.basket[*]'), get_json_object(src_json.json, '$.store.basket[*][0]'), get_json_object(src_json.json, '$.store.basket[0][*]'), get_json_object(src_json.json, '$.store.basket[*][*]'), get_json_object(src_json.json, '$.store.basket[0][2].b'), get_json_object(src_json.json, '$.store.basket[0][*].b') FROM src_json
139PREHOOK: type: QUERY
140PREHOOK: Input: default@src_json
141PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-34_666_5810556714267909747/10000
142POSTHOOK: query: SELECT get_json_object(src_json.json, '$.store.basket[0][1]'), get_json_object(src_json.json, '$.store.basket[*]'), get_json_object(src_json.json, '$.store.basket[*][0]'), get_json_object(src_json.json, '$.store.basket[0][*]'), get_json_object(src_json.json, '$.store.basket[*][*]'), get_json_object(src_json.json, '$.store.basket[0][2].b'), get_json_object(src_json.json, '$.store.basket[0][*].b') FROM src_json
143POSTHOOK: type: QUERY
144POSTHOOK: Input: default@src_json
145POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-34_666_5810556714267909747/10000
146POSTHOOK: Lineage: dest1.c1 SIMPLE []
1472	[[1,2,{"b":"y","a":"x"}],[3,4],[5,6]]	1	[1,2,{"b":"y","a":"x"}]	[1,2,{"b":"y","a":"x"},3,4,5,6]	y	["y"]
148PREHOOK: query: SELECT get_json_object(src_json.json, '$.non_exist_key'),  get_json_object(src_json.json, '$..no_recursive'), get_json_object(src_json.json, '$.store.book[10]'), get_json_object(src_json.json, '$.store.book[0].non_exist_key'), get_json_object(src_json.json, '$.store.basket[*].non_exist_key'), get_json_object(src_json.json, '$.store.basket[0][*].non_exist_key') FROM src_json
149PREHOOK: type: QUERY
150PREHOOK: Input: default@src_json
151PREHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-38_026_3347642415777976965/10000
152POSTHOOK: query: SELECT get_json_object(src_json.json, '$.non_exist_key'),  get_json_object(src_json.json, '$..no_recursive'), get_json_object(src_json.json, '$.store.book[10]'), get_json_object(src_json.json, '$.store.book[0].non_exist_key'), get_json_object(src_json.json, '$.store.basket[*].non_exist_key'), get_json_object(src_json.json, '$.store.basket[0][*].non_exist_key') FROM src_json
153POSTHOOK: type: QUERY
154POSTHOOK: Input: default@src_json
155POSTHOOK: Output: file:/data/users/athusoo/apache_workspaces/hive_trunk_ws1/.ptest_0/build/ql/scratchdir/hive_2010-04-05_18-37-38_026_3347642415777976965/10000
156POSTHOOK: Lineage: dest1.c1 SIMPLE []
157NULL	NULL	NULL	NULL	NULL	NULL