index.html 24 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE html
  3. PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4. <html lang="en-us" xml:lang="en-us">
  5. <head>
  6. <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
  7. <link rel="stylesheet" type="text/css" href="commonltr.css"/>
  8. <title>Impala Query UI</title>
  9. </head>
  10. <body id="topic_5"><a name="topic_5"><!-- --></a>
  11. <h1 class="title topictitle1">Impala Query UI </h1>
  12. <div class="body conbody">
  13. <p class="p"> The Impala Query UI application enables you to perform queries
  14. on Apache Hadoop data stored in HDFS or HBase using Impala. For information about
  15. Impala, see <a class="xref" href="http://impala.io" target="_blank">Installing and
  16. Using Impala</a>. You can create, run, and manage queries, and download the
  17. results in a Microsoft Office Excel worksheet file or a comma-separated values file. </p>
  18. </div>
  19. <span>Hue, </span><a href="http://gethue.com"><span>the Hadoop UI</span></a><span>, has been supporting </span><a href="https://github.com/cloudera/impala"><span>Impala</span></a><span> closely since its first version and brings fast interactive queries within your browser. If not familiar with </span><a href="http://blog.cloudera.com/blog/2012/10/cloudera-impala-real-time-queries-in-apache-hadoop-for-real/"><span>Impala</span></a><span>, we recommend you to check the documentation of the fastest </span><a href="http://www.cloudera.com/content/support/en/documentation/cloudera-impala/cloudera-impala-documentation-v1-latest.html"><span>SQL engine</span></a><span> for Hadoop.</span></p>
  20. <h1><span>Impala App</span></h1>
  21. <p><span>Most of Hive SQL is compatible with Impala and we are going to compare the queries of </span><a href="http://gethue.tumblr.com/post/60376973455/hadoop-tutorials-ii-1-prepare-the-data-for-analysis"><span>episode one</span></a><span> in both Hive and Impala applications. Notice that this comparison is not 100% scientific but it demonstrates what would happen in common cases.</span></p>
  22. <p><br/><span></span></p>
  23. <p><iframe frameborder="0" height="495" src="http://player.vimeo.com/video/90961050" width="900"></iframe></p>
  24. <p><span>Using Impala through the Hue app is easier in many ways than using it through the command-line impala-shell. For example, table names, databases, columns, built-in functions are auto-completable and the syntax highlighting shows the potential typos in your queries. Multiple queries or a selected portion of a query can be executed from the editor. Parameterized queries are supported and the user will be prompted for values at submission time. Impala queries can be saved and shared between users or deleted and then restored from trash in case of mistakes. </span></p>
  25. <p><br/><span></span></p>
  26. <p><span>Impala uses the same Metastore as Hive so you can browse tables with the </span><a href="http://gethue.tumblr.com/post/56804308712/hadoop-tutorial-how-to-access-hive-in-pig-with"><span>Metastore app</span></a><span>. You can also pick a database with a drop-down in the editor. After submission, progress and logs are reported and you can browse the result with infinite scroll or download the data with your browser.</span></p>
  27. <h1><span>Query speed comparison </span></h1>
  28. <p><span>Let’s start with the Hue examples as they are easily accessible. They are very small but show the lightning speed of Impala and the inefficiency of the series of MapReduce jobs created by Hive.</span></p>
  29. <p><span>Make sure the Hive and Impala examples are installed in Hue and then in each app, go to ‘</span><span>Saved Queries</span><span>’, copy the query ‘</span><span>Sample: Top salaries</span><span>’ and submit it.</span></p>
  30. <p><span>Then we are back to our Yelp data. Let’s take the query from </span><a href="http://gethue.tumblr.com/post/60376973455/hadoop-tutorials-ii-1-prepare-the-data-for-analysis"><span>episode one</span></a><span> and execute it in both apps:</span></p>
  31. <pre class="code">SELECT r.business_id, name, SUM(cool) AS coolness
  32. FROM review r JOIN business b
  33. ON (r.business_id = b.business_id)
  34. WHERE categories LIKE '%Restaurants%'
  35. AND `date` = '$date'
  36. GROUP BY r.business_id, name
  37. ORDER BY coolness DESC
  38. LIMIT 10
  39. </pre>
  40. <p><span> </span></p>
  41. <p><span>Again, you can see the benefits of Impala’s </span><a href="http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Using-Impala/ciiu_concepts.html"><span>architecture and optimization</span></a><span>.</span></p>
  42. <p><span> </span></p>
  43. <div class="topic concept nested1" xml:lang="en-US" lang="en-US" id="topic_5_1"><a name="topic_5_1"><!-- --></a>
  44. <h2 class="title topictitle2">Impala Query UI and Installation and Configuration
  45. </h2>
  46. <div class="body conbody">
  47. <p class="p"> The Impala Query UI application is one of the applications
  48. installed as part of Hue. <span class="ph">For information about installing and configuring Hue,
  49. see Hue Installation in <a class="xref" href="http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Installation-Guide/CDH4-Installation-Guide.html" target="_blank">http://www.cloudera.com/content/cloudera-content/cloudera-docs/CDH4/latest/CDH4-Installation-Guide/CDH4-Installation-Guide.html</a>.</span></p>
  50. <p class="p"> The Impala Query UI assumes an existing Impala
  51. installation. The Hue installation instructions include the configuration necessary for
  52. Impala. You can view the current configuration from the <strong class="ph b">Settings</strong> tab. </p>
  53. </div>
  54. </div>
  55. <div class="topic concept nested1" xml:lang="en-US" lang="en-US" id="topic_5_2"><a name="topic_5_2"><!-- --></a>
  56. <h2 class="title topictitle2">Starting Impala Query UI
  57. </h2>
  58. <div class="body conbody">
  59. <p class="p">Click the <strong class="ph b">Impala Query UI</strong>
  60. icon (<img class="image" src="/impala/static/art/icon_impala_24.png"/>) in the navigation bar at the top of the Hue browser page. </p>
  61. </div>
  62. </div>
  63. <div class="topic concept nested1" id="concept_kv5_j13_dk"><a name="concept_kv5_j13_dk"><!-- --></a>
  64. <h2 class="title topictitle2">Managing Databases, Tables, and Partitions</h2>
  65. <div class="body conbody">
  66. <p class="p">You can create databases, tables, partitions, and load data by executing
  67. <a class="xref" href="http://archive.cloudera.com/cdh4/cdh/4/hive/language_manual/data-manipulation-statements.html" target="_blank">Hive data manipulation
  68. statements</a> in the Beeswax application.</p>
  69. <p class="p">You can also use the <a class="xref" href="metastoremanager.html#xd_583c10bfdbd326ba-3ca24a24-13d80143249--7f9b">Metastore Manager</a> application to manage the
  70. databases, tables, and partitions and load data.</p>
  71. <p class="p"> When you change the metastore using one of these applications, you must click the
  72. <span class="ph uicontrol">Refresh</span> button under METASTORE CATALOG in the pane to the left of
  73. the Query Editor to make the metastore update visible to the Impala server. </p>
  74. </div>
  75. </div>
  76. <div class="topic concept nested1" xml:lang="en-US" lang="en-US" id="topic_4_2_1"><a name="topic_4_2_1"><!-- --></a>
  77. <h2 class="title topictitle2">Installing Example Queries and
  78. Tables</h2>
  79. <div class="body conbody">
  80. <div class="note note"><span class="notetitle"><img src="/static/art/help/note.jpg"/> 
  81. <b>Note</b>:</span> You must be a superuser to perform this task.</div>
  82. <a name="topic_4_2_1__ol_kss_btp_wj"><!-- --></a><ol class="ol" id="topic_4_2_1__ol_kss_btp_wj">
  83. <li class="li">Click <a name="topic_4_2_1__d104e102"><!-- --></a><img class="image" id="topic_4_2_1__d104e102" src="/static/art/hue-logo-mini.png"/>. The Quick Start Wizard opens.</li>
  84. <li class="li">Click <strong class="ph b">Step 2:
  85. Examples</strong>.</li>
  86. <li class="li">Click <strong class="ph b">Impala Query
  87. UI</strong>.</li>
  88. </ol>
  89. </div>
  90. </div>
  91. <div class="topic concept nested1" xml:lang="en-US" lang="en-US" id="topic_5_3"><a name="topic_5_3"><!-- --></a>
  92. <h2 class="title topictitle2">Queries </h2>
  93. <div class="body conbody">
  94. <p class="p"> The Query Editor view lets you create queries in the Impala
  95. Query Language, which is based on the Hive Standard Query Language (HiveQL) and described in
  96. the Impala Language Reference topic in <a class="xref" href="http://www.cloudera.com/content/cloudera-content/cloudera-docs/Impala/latest/Installing-and-Using-Impala/Installing-and-Using-Impala.html" target="_blank">Installing and
  97. Using Impala</a>. </p>
  98. <p class="p">You can name and save your queries to use later. </p>
  99. <p class="p">When you submit a query, you can either wait for the query to complete,
  100. or return later to find the queries in the <strong class="ph b">History</strong> view. </p>
  101. <p class="p">In the box to the left of the Query field, you can select a database,
  102. override the default Impala settings, enable users to enter parameters at run-time.
  103. See <a class="xref" href="#topic_5_3_2">Advanced Query Settings</a> for details on using these settings. </p>
  104. </div>
  105. <div class="topic concept nested2" xml:lang="en-US" lang="en-US" id="topic_5_3_1"><a name="topic_5_3_1"><!-- --></a>
  106. <h3 class="title topictitle3">Creating Queries </h3>
  107. <div class="body conbody">
  108. <ol class="ol">
  109. <li class="li">In the Query Editor window, type a query or
  110. multiple queries separated by a semicolon ";". To be presented with a drop-down of
  111. autocomplete options, type <span class="ph uicontrol">CTRL+spacebar</span> when entering a query. </li>
  112. <li class="li">To save your query and advanced settings to use
  113. again later, click <strong class="ph b">Save As</strong>, enter a name and
  114. description, and then click <strong class="ph b">OK</strong>. To save changes to an
  115. existing query, click <strong class="ph b">Save.</strong>
  116. </li>
  117. </ol>
  118. </div>
  119. </div>
  120. <div class="topic concept nested2" id="id_esc_5sb_zj"><a name="id_esc_5sb_zj"><!-- --></a>
  121. <h3 class="title topictitle3">Loading Queries into the Query Editor</h3>
  122. <div class="body conbody">
  123. <a name="id_esc_5sb_zj__d104e186"><!-- --></a><ol class="ol" id="id_esc_5sb_zj__d104e186">
  124. <li class="li">Do one of the following:<a name="id_esc_5sb_zj__d104e190"><!-- --></a><ul class="ul" id="id_esc_5sb_zj__d104e190">
  125. <li class="li">Click the <span class="ph uicontrol">My Queries</span> tab.<a name="id_esc_5sb_zj__d104e197"><!-- --></a><ol class="ol" type="a" id="id_esc_5sb_zj__d104e197">
  126. <li class="li">Click the <span class="ph uicontrol">Recent Saved Queries</span> or <span class="ph uicontrol">Recent Run
  127. Queries</span> tab to display the respective queries. </li>
  128. </ol>
  129. </li>
  130. <li class="li">Click the <span class="ph uicontrol">Saved Queries</span> tab.</li>
  131. </ul>
  132. </li>
  133. <li class="li">Click a query name. The query is loaded into the Query Editor.</li>
  134. </ol>
  135. </div>
  136. </div>
  137. <div class="topic concept nested2" id="concept_pcv_fpb_zj"><a name="concept_pcv_fpb_zj"><!-- --></a>
  138. <h3 class="title topictitle3">Running Queries</h3>
  139. <div class="body conbody">
  140. <div class="note note"><span class="notetitle"><img src="/static/art/help/note.jpg"/> 
  141. <b>Note</b>:</span> To run a query, you must be logged in to
  142. Hue as a user that also has a Unix user account on the remote server. </div>
  143. <a name="concept_pcv_fpb_zj__ol_ofq_xpb_zj"><!-- --></a><ol class="ol" id="concept_pcv_fpb_zj__ol_ofq_xpb_zj">
  144. <li class="li">To execute a portion of the query, highlight one or more query
  145. statements.</li>
  146. <li class="li">Click <strong class="ph b">Execute</strong>. The Query Results
  147. window appears with the results of your query. <a name="concept_pcv_fpb_zj__d104e242"><!-- --></a><ul class="ul" id="concept_pcv_fpb_zj__d104e242">
  148. <li class="li">To view a log of the query execution, click <strong class="ph b">Log</strong> at the top of the results display. You can use
  149. the information in this tab to debug your query.</li>
  150. <li class="li">To view the query that generated these results, click <strong class="ph b">Query</strong> at the top of the results display.</li>
  151. <li class="li">To view the columns of the query, click <strong class="ph b">Columns</strong>.</li>
  152. <li class="li">To return to the query in the Query Editor, click <strong class="ph b">Unsaved Query</strong>.</li>
  153. </ul>
  154. </li>
  155. <li class="li">If there are multiple statements in the query, click <span class="ph uicontrol">Next</span> in
  156. the Multi-statement query pane to execute the remaining statements.</li>
  157. </ol>
  158. </div>
  159. </div>
  160. <div class="topic concept nested2" xml:lang="en-US" lang="en-US" id="topic_5_3_2"><a name="topic_5_3_2"><!-- --></a>
  161. <h3 class="title topictitle3">Advanced Query Settings
  162. </h3>
  163. <div class="body conbody">
  164. <p class="p">
  165. The pane to the left of the Query Editor lets you specify the following options:
  166. </p>
  167. <div class="tablenoborder"><table cellpadding="4" cellspacing="0" summary="" class="table" frame="hsides" border="1" rules="all">
  168. <thead class="thead" align="left">
  169. <tr class="row">
  170. <th class="entry" valign="top" width="25%" id="d7221e304">
  171. <p class="p">
  172. <strong class="ph b">Option</strong>
  173. </p>
  174. </th>
  175. <th class="entry" valign="top" width="75%" id="d7221e313">
  176. <p class="p">
  177. <strong class="ph b">Description</strong>
  178. </p>
  179. </th>
  180. </tr>
  181. </thead>
  182. <tbody class="tbody">
  183. <tr class="row">
  184. <td class="entry" valign="top" width="25%" headers="d7221e304 ">
  185. <p class="p"><strong class="ph b">DATABASE</strong>
  186. </p>
  187. </td>
  188. <td class="entry" valign="top" width="75%" headers="d7221e313 ">
  189. <p class="p">The database containing the table definitions. </p>
  190. </td>
  191. </tr>
  192. <tr class="row">
  193. <td class="entry" valign="top" width="25%" headers="d7221e304 ">
  194. <p class="p"><strong class="ph b">SETTINGS</strong>
  195. </p>
  196. </td>
  197. <td class="entry" valign="top" width="75%" headers="d7221e313 ">
  198. <div class="p">Override Impala default settings. To configure a
  199. new setting: <a name="topic_5_3_2__ol_k5v_hcc_zj"><!-- --></a><ol class="ol" id="topic_5_3_2__ol_k5v_hcc_zj">
  200. <li class="li">Click <strong class="ph b">Add</strong>.</li>
  201. <li class="li">For <strong class="ph b">Key</strong>, enter a Impala
  202. configuration variable name. </li>
  203. <li class="li">For <strong class="ph b">Value</strong>, enter the value you want to
  204. use for the variable. </li>
  205. </ol>
  206. </div>
  207. <p class="p">To view the default settings, click the <strong class="ph b">Settings</strong> tab at the top of the page. </p>
  208. </td>
  209. </tr>
  210. <tr class="row">
  211. <td class="entry" valign="top" width="25%" headers="d7221e304 ">
  212. <p class="p"><strong class="ph b">PARAMETERIZATION</strong>
  213. </p>
  214. </td>
  215. <td class="entry" valign="top" width="75%" headers="d7221e313 ">
  216. <p class="p">Indicate that a dialog box should display to enter parameter
  217. values when a query containing the string $<var class="keyword varname">parametername</var> is
  218. executed. Enabled by default. </p>
  219. </td>
  220. </tr>
  221. <tr class="row">
  222. <td class="entry" valign="top" width="25%" headers="d7221e304 ">
  223. <p class="p"><strong class="ph b">METASTORE CATALOG</strong>
  224. </p>
  225. </td>
  226. <td class="entry" valign="top" width="75%" headers="d7221e313 ">
  227. <p class="p">Refresh metadata. It is best to  refresh  metadata after making changes to
  228. databases such as adding or dropping a table. </p>
  229. </td>
  230. </tr>
  231. </tbody>
  232. </table>
  233. </div>
  234. </div>
  235. </div>
  236. <div class="topic concept nested2" xml:lang="en-US" lang="en-US" id="id_bqm_lxh_dk"><a name="id_bqm_lxh_dk"><!-- --></a>
  237. <h3 class="title topictitle3">Viewing Query History </h3>
  238. <div class="body conbody">
  239. <p class="p">You can view the history of queries that you have run previously.
  240. Results for these queries are available for one week or until Hue is restarted. </p>
  241. <ol class="ol">
  242. <li class="li">Click <strong class="ph b">History</strong>. A list of your
  243. saved and unsaved queries displays in the Query History window.</li>
  244. <li class="li">To display the queries for all users, click <strong class="ph b">Show everyone's queries</strong>.
  245. To display your queries only, click <strong class="ph b">Show my queries</strong>.</li>
  246. <li class="li">To display the automatically generated actions performed on a
  247. user's behalf, click <strong class="ph b">Show auto actions</strong>. To display
  248. user queries again, click <strong class="ph b">Show user queries</strong>.</li>
  249. </ol>
  250. </div>
  251. </div>
  252. <div class="topic concept nested2" xml:lang="en-US" lang="en-US" id="id_qcp_cxk_xj"><a name="id_qcp_cxk_xj"><!-- --></a>
  253. <h3 class="title topictitle3">Viewing, Editing, Copying, and Deleting
  254. Saved Queries </h3>
  255. <div class="body conbody">
  256. <p class="p">You can view a list of saved queries of all users by clicking <strong class="ph b">My
  257. Queries</strong> and then selecting either <span class="ph uicontrol">Recent Saved Queries</span> or
  258. <span class="ph uicontrol">Recent Run Queries</span> tab to display the respective queries or
  259. clicking <strong class="ph b">Saved Queries</strong>. You can copy any query, but you
  260. can edit, delete, and view the history of only your own queries. </p>
  261. <div class="tablenoborder"><a name="id_qcp_cxk_xj__d104e691"><!-- --></a><table cellpadding="4" cellspacing="0" summary="" id="id_qcp_cxk_xj__d104e691" class="table" frame="hsides" border="1" rules="all">
  262. <thead class="thead" align="left">
  263. <tr class="row">
  264. <th class="entry" valign="top" width="25%" id="d7221e501">Saved Query</th>
  265. <th class="entry" valign="top" width="75%" id="d7221e504">Procedure</th>
  266. </tr>
  267. </thead>
  268. <tbody class="tbody">
  269. <tr class="row">
  270. <td class="entry" valign="top" width="25%" headers="d7221e501 ">
  271. <p class="p">
  272. <strong class="ph b">Edit</strong>
  273. </p>
  274. </td>
  275. <td class="entry" valign="top" width="75%" headers="d7221e504 ">
  276. <div class="p">
  277. <a name="id_qcp_cxk_xj__d104e728"><!-- --></a><ol class="ol" id="id_qcp_cxk_xj__d104e728">
  278. <li class="li">Click <strong class="ph b">Saved Queries</strong>.
  279. The Queries window displays.</li>
  280. <li class="li">Check the checkbox next to the query and click <strong class="ph b">Edit</strong>. The query displays in the Query
  281. Editor window.</li>
  282. <li class="li">Change the query and then click <strong class="ph b">Save.</strong> You can also click <strong class="ph b">Save As</strong>, enter a new name, and click <strong class="ph b">OK</strong> to save a copy of the query.</li>
  283. </ol>
  284. </div>
  285. </td>
  286. </tr>
  287. <tr class="row">
  288. <td class="entry" valign="top" width="25%" headers="d7221e501 ">
  289. <p class="p">
  290. <strong class="ph b">Copy</strong>
  291. </p>
  292. </td>
  293. <td class="entry" valign="top" width="75%" headers="d7221e504 ">
  294. <div class="p">
  295. <a name="id_qcp_cxk_xj__d104e773"><!-- --></a><ol class="ol" id="id_qcp_cxk_xj__d104e773">
  296. <li class="li">Click <strong class="ph b">Saved Queries</strong>.
  297. The Queries window displays.</li>
  298. <li class="li">Check the checkbox next to the query and click <strong class="ph b">Copy</strong>. The query displays in the Query
  299. Editor window.</li>
  300. <li class="li">Change the query as necessary and then click <strong class="ph b">Save.</strong> You can also click <strong class="ph b">Save As</strong>, enter a new name, and click <strong class="ph b">OK</strong> to save a copy of the query.</li>
  301. </ol>
  302. </div>
  303. </td>
  304. </tr>
  305. <tr class="row">
  306. <td class="entry" valign="top" width="25%" headers="d7221e501 ">
  307. <p class="p">
  308. <strong class="ph b">Copy in Query History</strong>
  309. </p>
  310. </td>
  311. <td class="entry" valign="top" width="75%" headers="d7221e504 ">
  312. <div class="p">
  313. <a name="id_qcp_cxk_xj__d104e818"><!-- --></a><ol class="ol" id="id_qcp_cxk_xj__d104e818">
  314. <li class="li">Click <strong class="ph b">History</strong>. The
  315. Query History window displays.</li>
  316. <li class="li">To display the queries for all users, click <strong class="ph b">Show everyone's queries</strong>. The queries for
  317. all users display in the History window.</li>
  318. <li class="li">Click the query you want to copy. A copy of the query
  319. displays in the Query Editor window.</li>
  320. <li class="li">Change the query, if necessary, and then click <strong class="ph b">Save As</strong>, enter a new name, and click <strong class="ph b">OK</strong> to save the query.</li>
  321. </ol>
  322. </div>
  323. </td>
  324. </tr>
  325. <tr class="row">
  326. <td class="entry" valign="top" width="25%" headers="d7221e501 ">
  327. <p class="p">
  328. <strong class="ph b">Delete</strong>
  329. </p>
  330. </td>
  331. <td class="entry" valign="top" width="75%" headers="d7221e504 ">
  332. <a name="id_qcp_cxk_xj__d104e861"><!-- --></a><ol class="ol" id="id_qcp_cxk_xj__d104e861">
  333. <li class="li">Click <strong class="ph b">Saved Queries</strong>.
  334. The Queries window displays.</li>
  335. <li class="li">Check the checkbox next to the query and click <strong class="ph b">Delete</strong>.</li>
  336. <li class="li">Click <strong class="ph b">Yes</strong> to confirm
  337. the deletion.</li>
  338. </ol>
  339. </td>
  340. </tr>
  341. </tbody>
  342. </table>
  343. </div>
  344. </div>
  345. </div>
  346. </div>
  347. </body>
  348. </html>