{"id":5178,"date":"2015-10-08T14:07:30","date_gmt":"2015-10-08T19:07:30","guid":{"rendered":"http:\/\/appcrawler.com\/wordpress\/?p=5178"},"modified":"2015-10-08T15:48:30","modified_gmt":"2015-10-08T20:48:30","slug":"hive-performance-parser","status":"publish","type":"post","link":"http:\/\/appcrawler.com\/wordpress\/2015\/10\/08\/hive-performance-parser\/","title":{"rendered":"Hive performance parser"},"content":{"rendered":"<p>With data in the hiveserver2.log file, this awk scriptlet prints the timestamp, SQL, and seconds to run.\u00a0There is an issue where the parser thread hands off to the executor, and you can\u2019t always tie the two together.\u00a0 However, at a minimum, this tells you the SQL and execution time.  One limitation is that it won&#8217;t show queries which aren&#8217;t completed for whatever reason.<\/p>\n<p>I may see if I can add a plugin to write this to a file in a more usable format.<\/p>\n<pre>\r\nBEGIN {\r\n  while (++i <= 100) {\r\n    pad = pad\"*\"\r\n  }\r\n}\r\n{\r\n  if ($0 ~ \"Driver.java:execute.*Starting command\") {\r\n    r[$5] = $2\r\n    split($0,t,\":\")\r\n    n = 6\r\n    sql = \"\"\r\n    while (++n <= length(t)) {\r\n      sql = sql\"\"t[n]\r\n    }\r\n\r\n    getline\r\n    while (1) {\r\n      if ($0 !~ \"HiveServer2\") {\r\n        sql = sql\"\"$0\r\n      }\r\n      else {\r\n        break\r\n      }\r\n      getline;\r\n    }\r\n    s[$5] = sql\r\n  }\r\n  else if ($0 ~ \"PerfLogEnd.*PERFLOG method=Driver.run\") {\r\n    split($13,end,\"=\")\r\n    printf(\"%s\\n %-20s %s %.2f\\n\",pad,r[$5],s[$5],end[2]\/1000)\r\n  }\r\n}\r\n<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>With data in the hiveserver2.log file, this awk scriptlet prints the timestamp, SQL, and seconds to run.\u00a0There is an issue where the parser thread hands off to the executor, and you can\u2019t always tie the two together.\u00a0 However, at a&hellip;<\/p>\n<p class=\"more-link-p\"><a class=\"more-link\" href=\"http:\/\/appcrawler.com\/wordpress\/2015\/10\/08\/hive-performance-parser\/\">Read more &rarr;<\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_mi_skip_tracking":false,"footnotes":""},"categories":[19,43],"tags":[],"_links":{"self":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5178"}],"collection":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/comments?post=5178"}],"version-history":[{"count":6,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5178\/revisions"}],"predecessor-version":[{"id":5184,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/posts\/5178\/revisions\/5184"}],"wp:attachment":[{"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/media?parent=5178"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/categories?post=5178"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/appcrawler.com\/wordpress\/wp-json\/wp\/v2\/tags?post=5178"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}