Permalink
Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
2011 lines (2006 sloc) 94.7 KB
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]-->
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="generator" content="Asciidoctor 1.5.4">
<meta name="author" content="Kudu Team">
<title>Using Apache Kudu with Apache Impala (incubating)</title>
<link rel="stylesheet" href="https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700">
<style>
/* Asciidoctor default stylesheet | MIT License | http://asciidoctor.org */
/* Remove comment around @import statement below when using as a custom stylesheet */
/*@import "https://fonts.googleapis.com/css?family=Open+Sans:300,300italic,400,400italic,600,600italic%7CNoto+Serif:400,400italic,700,700italic%7CDroid+Sans+Mono:400,700";*/
article,aside,details,figcaption,figure,footer,header,hgroup,main,nav,section,summary{display:block}
audio,canvas,video{display:inline-block}
audio:not([controls]){display:none;height:0}
[hidden],template{display:none}
script{display:none!important}
html{font-family:sans-serif;-ms-text-size-adjust:100%;-webkit-text-size-adjust:100%}
body{margin:0}
a{background:transparent}
a:focus{outline:thin dotted}
a:active,a:hover{outline:0}
h1{font-size:2em;margin:.67em 0}
abbr[title]{border-bottom:1px dotted}
b,strong{font-weight:bold}
dfn{font-style:italic}
hr{-moz-box-sizing:content-box;box-sizing:content-box;height:0}
mark{background:#ff0;color:#000}
code,kbd,pre,samp{font-family:monospace;font-size:1em}
pre{white-space:pre-wrap}
q{quotes:"\201C" "\201D" "\2018" "\2019"}
small{font-size:80%}
sub,sup{font-size:75%;line-height:0;position:relative;vertical-align:baseline}
sup{top:-.5em}
sub{bottom:-.25em}
img{border:0}
svg:not(:root){overflow:hidden}
figure{margin:0}
fieldset{border:1px solid silver;margin:0 2px;padding:.35em .625em .75em}
legend{border:0;padding:0}
button,input,select,textarea{font-family:inherit;font-size:100%;margin:0}
button,input{line-height:normal}
button,select{text-transform:none}
button,html input[type="button"],input[type="reset"],input[type="submit"]{-webkit-appearance:button;cursor:pointer}
button[disabled],html input[disabled]{cursor:default}
input[type="checkbox"],input[type="radio"]{box-sizing:border-box;padding:0}
input[type="search"]{-webkit-appearance:textfield;-moz-box-sizing:content-box;-webkit-box-sizing:content-box;box-sizing:content-box}
input[type="search"]::-webkit-search-cancel-button,input[type="search"]::-webkit-search-decoration{-webkit-appearance:none}
button::-moz-focus-inner,input::-moz-focus-inner{border:0;padding:0}
textarea{overflow:auto;vertical-align:top}
table{border-collapse:collapse;border-spacing:0}
*,*:before,*:after{-moz-box-sizing:border-box;-webkit-box-sizing:border-box;box-sizing:border-box}
html,body{font-size:100%}
body{background:#fff;color:rgba(0,0,0,.8);padding:0;margin:0;font-family:"Noto Serif","DejaVu Serif",serif;font-weight:400;font-style:normal;line-height:1;position:relative;cursor:auto}
a:hover{cursor:pointer}
img,object,embed{max-width:100%;height:auto}
object,embed{height:100%}
img{-ms-interpolation-mode:bicubic}
.left{float:left!important}
.right{float:right!important}
.text-left{text-align:left!important}
.text-right{text-align:right!important}
.text-center{text-align:center!important}
.text-justify{text-align:justify!important}
.hide{display:none}
body{-webkit-font-smoothing:antialiased}
img,object,svg{display:inline-block;vertical-align:middle}
textarea{height:auto;min-height:50px}
select{width:100%}
.center{margin-left:auto;margin-right:auto}
.spread{width:100%}
p.lead,.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{font-size:1.21875em;line-height:1.6}
.subheader,.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{line-height:1.45;color:#7a2518;font-weight:400;margin-top:0;margin-bottom:.25em}
div,dl,dt,dd,ul,ol,li,h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6,pre,form,p,blockquote,th,td{margin:0;padding:0;direction:ltr}
a{color:#2156a5;text-decoration:underline;line-height:inherit}
a:hover,a:focus{color:#1d4b8f}
a img{border:none}
p{font-family:inherit;font-weight:400;font-size:1em;line-height:1.6;margin-bottom:1.25em;text-rendering:optimizeLegibility}
p aside{font-size:.875em;line-height:1.35;font-style:italic}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{font-family:"Open Sans","DejaVu Sans",sans-serif;font-weight:300;font-style:normal;color:#ba3925;text-rendering:optimizeLegibility;margin-top:1em;margin-bottom:.5em;line-height:1.0125em}
h1 small,h2 small,h3 small,#toctitle small,.sidebarblock>.content>.title small,h4 small,h5 small,h6 small{font-size:60%;color:#e99b8f;line-height:0}
h1{font-size:2.125em}
h2{font-size:1.6875em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.375em}
h4,h5{font-size:1.125em}
h6{font-size:1em}
hr{border:solid #ddddd8;border-width:1px 0 0;clear:both;margin:1.25em 0 1.1875em;height:0}
em,i{font-style:italic;line-height:inherit}
strong,b{font-weight:bold;line-height:inherit}
small{font-size:60%;line-height:inherit}
code{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;color:rgba(0,0,0,.9)}
ul,ol,dl{font-size:1em;line-height:1.6;margin-bottom:1.25em;list-style-position:outside;font-family:inherit}
ul,ol,ul.no-bullet,ol.no-bullet{margin-left:1.5em}
ul li ul,ul li ol{margin-left:1.25em;margin-bottom:0;font-size:1em}
ul.square li ul,ul.circle li ul,ul.disc li ul{list-style:inherit}
ul.square{list-style-type:square}
ul.circle{list-style-type:circle}
ul.disc{list-style-type:disc}
ul.no-bullet{list-style:none}
ol li ul,ol li ol{margin-left:1.25em;margin-bottom:0}
dl dt{margin-bottom:.3125em;font-weight:bold}
dl dd{margin-bottom:1.25em}
abbr,acronym{text-transform:uppercase;font-size:90%;color:rgba(0,0,0,.8);border-bottom:1px dotted #ddd;cursor:help}
abbr{text-transform:none}
blockquote{margin:0 0 1.25em;padding:.5625em 1.25em 0 1.1875em;border-left:1px solid #ddd}
blockquote cite{display:block;font-size:.9375em;color:rgba(0,0,0,.6)}
blockquote cite:before{content:"\2014 \0020"}
blockquote cite a,blockquote cite a:visited{color:rgba(0,0,0,.6)}
blockquote,blockquote p{line-height:1.6;color:rgba(0,0,0,.85)}
@media only screen and (min-width:768px){h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2}
h1{font-size:2.75em}
h2{font-size:2.3125em}
h3,#toctitle,.sidebarblock>.content>.title{font-size:1.6875em}
h4{font-size:1.4375em}}
table{background:#fff;margin-bottom:1.25em;border:solid 1px #dedede}
table thead,table tfoot{background:#f7f8f7;font-weight:bold}
table thead tr th,table thead tr td,table tfoot tr th,table tfoot tr td{padding:.5em .625em .625em;font-size:inherit;color:rgba(0,0,0,.8);text-align:left}
table tr th,table tr td{padding:.5625em .625em;font-size:inherit;color:rgba(0,0,0,.8)}
table tr.even,table tr.alt,table tr:nth-of-type(even){background:#f8f8f7}
table thead tr th,table tfoot tr th,table tbody tr td,table tr td,table tfoot tr td{display:table-cell;line-height:1.6}
body{tab-size:4}
h1,h2,h3,#toctitle,.sidebarblock>.content>.title,h4,h5,h6{line-height:1.2;word-spacing:-.05em}
h1 strong,h2 strong,h3 strong,#toctitle strong,.sidebarblock>.content>.title strong,h4 strong,h5 strong,h6 strong{font-weight:400}
.clearfix:before,.clearfix:after,.float-group:before,.float-group:after{content:" ";display:table}
.clearfix:after,.float-group:after{clear:both}
*:not(pre)>code{font-size:.9375em;font-style:normal!important;letter-spacing:0;padding:.1em .5ex;word-spacing:-.15em;background-color:#f7f7f8;-webkit-border-radius:4px;border-radius:4px;line-height:1.45;text-rendering:optimizeSpeed}
pre,pre>code{line-height:1.45;color:rgba(0,0,0,.9);font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;font-weight:400;text-rendering:optimizeSpeed}
.keyseq{color:rgba(51,51,51,.8)}
kbd{font-family:"Droid Sans Mono","DejaVu Sans Mono",monospace;display:inline-block;color:rgba(0,0,0,.8);font-size:.65em;line-height:1.45;background-color:#f7f7f7;border:1px solid #ccc;-webkit-border-radius:3px;border-radius:3px;-webkit-box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em white inset;box-shadow:0 1px 0 rgba(0,0,0,.2),0 0 0 .1em #fff inset;margin:0 .15em;padding:.2em .5em;vertical-align:middle;position:relative;top:-.1em;white-space:nowrap}
.keyseq kbd:first-child{margin-left:0}
.keyseq kbd:last-child{margin-right:0}
.menuseq,.menu{color:rgba(0,0,0,.8)}
b.button:before,b.button:after{position:relative;top:-1px;font-weight:400}
b.button:before{content:"[";padding:0 3px 0 2px}
b.button:after{content:"]";padding:0 2px 0 3px}
p a>code:hover{color:rgba(0,0,0,.9)}
#header,#content,#footnotes,#footer{width:100%;margin-left:auto;margin-right:auto;margin-top:0;margin-bottom:0;max-width:62.5em;*zoom:1;position:relative;padding-left:.9375em;padding-right:.9375em}
#header:before,#header:after,#content:before,#content:after,#footnotes:before,#footnotes:after,#footer:before,#footer:after{content:" ";display:table}
#header:after,#content:after,#footnotes:after,#footer:after{clear:both}
#content{margin-top:1.25em}
#content:before{content:none}
#header>h1:first-child{color:rgba(0,0,0,.85);margin-top:2.25rem;margin-bottom:0}
#header>h1:first-child+#toc{margin-top:8px;border-top:1px solid #ddddd8}
#header>h1:only-child,body.toc2 #header>h1:nth-last-child(2){border-bottom:1px solid #ddddd8;padding-bottom:8px}
#header .details{border-bottom:1px solid #ddddd8;line-height:1.45;padding-top:.25em;padding-bottom:.25em;padding-left:.25em;color:rgba(0,0,0,.6);display:-ms-flexbox;display:-webkit-flex;display:flex;-ms-flex-flow:row wrap;-webkit-flex-flow:row wrap;flex-flow:row wrap}
#header .details span:first-child{margin-left:-.125em}
#header .details span.email a{color:rgba(0,0,0,.85)}
#header .details br{display:none}
#header .details br+span:before{content:"\00a0\2013\00a0"}
#header .details br+span.author:before{content:"\00a0\22c5\00a0";color:rgba(0,0,0,.85)}
#header .details br+span#revremark:before{content:"\00a0|\00a0"}
#header #revnumber{text-transform:capitalize}
#header #revnumber:after{content:"\00a0"}
#content>h1:first-child:not([class]){color:rgba(0,0,0,.85);border-bottom:1px solid #ddddd8;padding-bottom:8px;margin-top:0;padding-top:1rem;margin-bottom:1.25rem}
#toc{border-bottom:1px solid #efefed;padding-bottom:.5em}
#toc>ul{margin-left:.125em}
#toc ul.sectlevel0>li>a{font-style:italic}
#toc ul.sectlevel0 ul.sectlevel1{margin:.5em 0}
#toc ul{font-family:"Open Sans","DejaVu Sans",sans-serif;list-style-type:none}
#toc li{line-height:1.3334;margin-top:.3334em}
#toc a{text-decoration:none}
#toc a:active{text-decoration:underline}
#toctitle{color:#7a2518;font-size:1.2em}
@media only screen and (min-width:768px){#toctitle{font-size:1.375em}
body.toc2{padding-left:15em;padding-right:0}
#toc.toc2{margin-top:0!important;background-color:#f8f8f7;position:fixed;width:15em;left:0;top:0;border-right:1px solid #efefed;border-top-width:0!important;border-bottom-width:0!important;z-index:1000;padding:1.25em 1em;height:100%;overflow:auto}
#toc.toc2 #toctitle{margin-top:0;margin-bottom:.8rem;font-size:1.2em}
#toc.toc2>ul{font-size:.9em;margin-bottom:0}
#toc.toc2 ul ul{margin-left:0;padding-left:1em}
#toc.toc2 ul.sectlevel0 ul.sectlevel1{padding-left:0;margin-top:.5em;margin-bottom:.5em}
body.toc2.toc-right{padding-left:0;padding-right:15em}
body.toc2.toc-right #toc.toc2{border-right-width:0;border-left:1px solid #efefed;left:auto;right:0}}
@media only screen and (min-width:1280px){body.toc2{padding-left:20em;padding-right:0}
#toc.toc2{width:20em}
#toc.toc2 #toctitle{font-size:1.375em}
#toc.toc2>ul{font-size:.95em}
#toc.toc2 ul ul{padding-left:1.25em}
body.toc2.toc-right{padding-left:0;padding-right:20em}}
#content #toc{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
#content #toc>:first-child{margin-top:0}
#content #toc>:last-child{margin-bottom:0}
#footer{max-width:100%;background-color:rgba(0,0,0,.8);padding:1.25em}
#footer-text{color:rgba(255,255,255,.8);line-height:1.44}
.sect1{padding-bottom:.625em}
@media only screen and (min-width:768px){.sect1{padding-bottom:1.25em}}
.sect1+.sect1{border-top:1px solid #efefed}
#content h1>a.anchor,h2>a.anchor,h3>a.anchor,#toctitle>a.anchor,.sidebarblock>.content>.title>a.anchor,h4>a.anchor,h5>a.anchor,h6>a.anchor{position:absolute;z-index:1001;width:1.5ex;margin-left:-1.5ex;display:block;text-decoration:none!important;visibility:hidden;text-align:center;font-weight:400}
#content h1>a.anchor:before,h2>a.anchor:before,h3>a.anchor:before,#toctitle>a.anchor:before,.sidebarblock>.content>.title>a.anchor:before,h4>a.anchor:before,h5>a.anchor:before,h6>a.anchor:before{content:"\00A7";font-size:.85em;display:block;padding-top:.1em}
#content h1:hover>a.anchor,#content h1>a.anchor:hover,h2:hover>a.anchor,h2>a.anchor:hover,h3:hover>a.anchor,#toctitle:hover>a.anchor,.sidebarblock>.content>.title:hover>a.anchor,h3>a.anchor:hover,#toctitle>a.anchor:hover,.sidebarblock>.content>.title>a.anchor:hover,h4:hover>a.anchor,h4>a.anchor:hover,h5:hover>a.anchor,h5>a.anchor:hover,h6:hover>a.anchor,h6>a.anchor:hover{visibility:visible}
#content h1>a.link,h2>a.link,h3>a.link,#toctitle>a.link,.sidebarblock>.content>.title>a.link,h4>a.link,h5>a.link,h6>a.link{color:#ba3925;text-decoration:none}
#content h1>a.link:hover,h2>a.link:hover,h3>a.link:hover,#toctitle>a.link:hover,.sidebarblock>.content>.title>a.link:hover,h4>a.link:hover,h5>a.link:hover,h6>a.link:hover{color:#a53221}
.audioblock,.imageblock,.literalblock,.listingblock,.stemblock,.videoblock{margin-bottom:1.25em}
.admonitionblock td.content>.title,.audioblock>.title,.exampleblock>.title,.imageblock>.title,.listingblock>.title,.literalblock>.title,.stemblock>.title,.openblock>.title,.paragraph>.title,.quoteblock>.title,table.tableblock>.title,.verseblock>.title,.videoblock>.title,.dlist>.title,.olist>.title,.ulist>.title,.qlist>.title,.hdlist>.title{text-rendering:optimizeLegibility;text-align:left;font-family:"Noto Serif","DejaVu Serif",serif;font-size:1rem;font-style:italic}
table.tableblock>caption.title{white-space:nowrap;overflow:visible;max-width:0}
.paragraph.lead>p,#preamble>.sectionbody>.paragraph:first-of-type p{color:rgba(0,0,0,.85)}
table.tableblock #preamble>.sectionbody>.paragraph:first-of-type p{font-size:inherit}
.admonitionblock>table{border-collapse:separate;border:0;background:none;width:100%}
.admonitionblock>table td.icon{text-align:center;width:80px}
.admonitionblock>table td.icon img{max-width:none}
.admonitionblock>table td.icon .title{font-weight:bold;font-family:"Open Sans","DejaVu Sans",sans-serif;text-transform:uppercase}
.admonitionblock>table td.content{padding-left:1.125em;padding-right:1.25em;border-left:1px solid #ddddd8;color:rgba(0,0,0,.6)}
.admonitionblock>table td.content>:last-child>:last-child{margin-bottom:0}
.exampleblock>.content{border-style:solid;border-width:1px;border-color:#e6e6e6;margin-bottom:1.25em;padding:1.25em;background:#fff;-webkit-border-radius:4px;border-radius:4px}
.exampleblock>.content>:first-child{margin-top:0}
.exampleblock>.content>:last-child{margin-bottom:0}
.sidebarblock{border-style:solid;border-width:1px;border-color:#e0e0dc;margin-bottom:1.25em;padding:1.25em;background:#f8f8f7;-webkit-border-radius:4px;border-radius:4px}
.sidebarblock>:first-child{margin-top:0}
.sidebarblock>:last-child{margin-bottom:0}
.sidebarblock>.content>.title{color:#7a2518;margin-top:0;text-align:center}
.exampleblock>.content>:last-child>:last-child,.exampleblock>.content .olist>ol>li:last-child>:last-child,.exampleblock>.content .ulist>ul>li:last-child>:last-child,.exampleblock>.content .qlist>ol>li:last-child>:last-child,.sidebarblock>.content>:last-child>:last-child,.sidebarblock>.content .olist>ol>li:last-child>:last-child,.sidebarblock>.content .ulist>ul>li:last-child>:last-child,.sidebarblock>.content .qlist>ol>li:last-child>:last-child{margin-bottom:0}
.literalblock pre,.listingblock pre:not(.highlight),.listingblock pre[class="highlight"],.listingblock pre[class^="highlight "],.listingblock pre.CodeRay,.listingblock pre.prettyprint{background:#f7f7f8}
.sidebarblock .literalblock pre,.sidebarblock .listingblock pre:not(.highlight),.sidebarblock .listingblock pre[class="highlight"],.sidebarblock .listingblock pre[class^="highlight "],.sidebarblock .listingblock pre.CodeRay,.sidebarblock .listingblock pre.prettyprint{background:#f2f1f1}
.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{-webkit-border-radius:4px;border-radius:4px;word-wrap:break-word;padding:1em;font-size:.8125em}
.literalblock pre.nowrap,.literalblock pre[class].nowrap,.listingblock pre.nowrap,.listingblock pre[class].nowrap{overflow-x:auto;white-space:pre;word-wrap:normal}
@media only screen and (min-width:768px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:.90625em}}
@media only screen and (min-width:1280px){.literalblock pre,.literalblock pre[class],.listingblock pre,.listingblock pre[class]{font-size:1em}}
.literalblock.output pre{color:#f7f7f8;background-color:rgba(0,0,0,.9)}
.listingblock pre.highlightjs{padding:0}
.listingblock pre.highlightjs>code{padding:1em;-webkit-border-radius:4px;border-radius:4px}
.listingblock pre.prettyprint{border-width:0}
.listingblock>.content{position:relative}
.listingblock code[data-lang]:before{display:none;content:attr(data-lang);position:absolute;font-size:.75em;top:.425rem;right:.5rem;line-height:1;text-transform:uppercase;color:#999}
.listingblock:hover code[data-lang]:before{display:block}
.listingblock.terminal pre .command:before{content:attr(data-prompt);padding-right:.5em;color:#999}
.listingblock.terminal pre .command:not([data-prompt]):before{content:"$"}
table.pyhltable{border-collapse:separate;border:0;margin-bottom:0;background:none}
table.pyhltable td{vertical-align:top;padding-top:0;padding-bottom:0;line-height:1.45}
table.pyhltable td.code{padding-left:.75em;padding-right:0}
pre.pygments .lineno,table.pyhltable td:not(.code){color:#999;padding-left:0;padding-right:.5em;border-right:1px solid #ddddd8}
pre.pygments .lineno{display:inline-block;margin-right:.25em}
table.pyhltable .linenodiv{background:none!important;padding-right:0!important}
.quoteblock{margin:0 1em 1.25em 1.5em;display:table}
.quoteblock>.title{margin-left:-1.5em;margin-bottom:.75em}
.quoteblock blockquote,.quoteblock blockquote p{color:rgba(0,0,0,.85);font-size:1.15rem;line-height:1.75;word-spacing:.1em;letter-spacing:0;font-style:italic;text-align:justify}
.quoteblock blockquote{margin:0;padding:0;border:0}
.quoteblock blockquote:before{content:"\201c";float:left;font-size:2.75em;font-weight:bold;line-height:.6em;margin-left:-.6em;color:#7a2518;text-shadow:0 1px 2px rgba(0,0,0,.1)}
.quoteblock blockquote>.paragraph:last-child p{margin-bottom:0}
.quoteblock .attribution{margin-top:.5em;margin-right:.5ex;text-align:right}
.quoteblock .quoteblock{margin-left:0;margin-right:0;padding:.5em 0;border-left:3px solid rgba(0,0,0,.6)}
.quoteblock .quoteblock blockquote{padding:0 0 0 .75em}
.quoteblock .quoteblock blockquote:before{display:none}
.verseblock{margin:0 1em 1.25em 1em}
.verseblock pre{font-family:"Open Sans","DejaVu Sans",sans;font-size:1.15rem;color:rgba(0,0,0,.85);font-weight:300;text-rendering:optimizeLegibility}
.verseblock pre strong{font-weight:400}
.verseblock .attribution{margin-top:1.25rem;margin-left:.5ex}
.quoteblock .attribution,.verseblock .attribution{font-size:.9375em;line-height:1.45;font-style:italic}
.quoteblock .attribution br,.verseblock .attribution br{display:none}
.quoteblock .attribution cite,.verseblock .attribution cite{display:block;letter-spacing:-.025em;color:rgba(0,0,0,.6)}
.quoteblock.abstract{margin:0 0 1.25em 0;display:block}
.quoteblock.abstract blockquote,.quoteblock.abstract blockquote p{text-align:left;word-spacing:0}
.quoteblock.abstract blockquote:before,.quoteblock.abstract blockquote p:first-of-type:before{display:none}
table.tableblock{max-width:100%;border-collapse:separate}
table.tableblock td>.paragraph:last-child p>p:last-child,table.tableblock th>p:last-child,table.tableblock td>p:last-child{margin-bottom:0}
table.tableblock,th.tableblock,td.tableblock{border:0 solid #dedede}
table.grid-all th.tableblock,table.grid-all td.tableblock{border-width:0 1px 1px 0}
table.grid-all tfoot>tr>th.tableblock,table.grid-all tfoot>tr>td.tableblock{border-width:1px 1px 0 0}
table.grid-cols th.tableblock,table.grid-cols td.tableblock{border-width:0 1px 0 0}
table.grid-all *>tr>.tableblock:last-child,table.grid-cols *>tr>.tableblock:last-child{border-right-width:0}
table.grid-rows th.tableblock,table.grid-rows td.tableblock{border-width:0 0 1px 0}
table.grid-all tbody>tr:last-child>th.tableblock,table.grid-all tbody>tr:last-child>td.tableblock,table.grid-all thead:last-child>tr>th.tableblock,table.grid-rows tbody>tr:last-child>th.tableblock,table.grid-rows tbody>tr:last-child>td.tableblock,table.grid-rows thead:last-child>tr>th.tableblock{border-bottom-width:0}
table.grid-rows tfoot>tr>th.tableblock,table.grid-rows tfoot>tr>td.tableblock{border-width:1px 0 0 0}
table.frame-all{border-width:1px}
table.frame-sides{border-width:0 1px}
table.frame-topbot{border-width:1px 0}
th.halign-left,td.halign-left{text-align:left}
th.halign-right,td.halign-right{text-align:right}
th.halign-center,td.halign-center{text-align:center}
th.valign-top,td.valign-top{vertical-align:top}
th.valign-bottom,td.valign-bottom{vertical-align:bottom}
th.valign-middle,td.valign-middle{vertical-align:middle}
table thead th,table tfoot th{font-weight:bold}
tbody tr th{display:table-cell;line-height:1.6;background:#f7f8f7}
tbody tr th,tbody tr th p,tfoot tr th,tfoot tr th p{color:rgba(0,0,0,.8);font-weight:bold}
p.tableblock>code:only-child{background:none;padding:0}
p.tableblock{font-size:1em}
td>div.verse{white-space:pre}
ol{margin-left:1.75em}
ul li ol{margin-left:1.5em}
dl dd{margin-left:1.125em}
dl dd:last-child,dl dd:last-child>:last-child{margin-bottom:0}
ol>li p,ul>li p,ul dd,ol dd,.olist .olist,.ulist .ulist,.ulist .olist,.olist .ulist{margin-bottom:.625em}
ul.unstyled,ol.unnumbered,ul.checklist,ul.none{list-style-type:none}
ul.unstyled,ol.unnumbered,ul.checklist{margin-left:.625em}
ul.checklist li>p:first-child>.fa-square-o:first-child,ul.checklist li>p:first-child>.fa-check-square-o:first-child{width:1em;font-size:.85em}
ul.checklist li>p:first-child>input[type="checkbox"]:first-child{width:1em;position:relative;top:1px}
ul.inline{margin:0 auto .625em auto;margin-left:-1.375em;margin-right:0;padding:0;list-style:none;overflow:hidden}
ul.inline>li{list-style:none;float:left;margin-left:1.375em;display:block}
ul.inline>li>*{display:block}
.unstyled dl dt{font-weight:400;font-style:normal}
ol.arabic{list-style-type:decimal}
ol.decimal{list-style-type:decimal-leading-zero}
ol.loweralpha{list-style-type:lower-alpha}
ol.upperalpha{list-style-type:upper-alpha}
ol.lowerroman{list-style-type:lower-roman}
ol.upperroman{list-style-type:upper-roman}
ol.lowergreek{list-style-type:lower-greek}
.hdlist>table,.colist>table{border:0;background:none}
.hdlist>table>tbody>tr,.colist>table>tbody>tr{background:none}
td.hdlist1,td.hdlist2{vertical-align:top;padding:0 .625em}
td.hdlist1{font-weight:bold;padding-bottom:1.25em}
.literalblock+.colist,.listingblock+.colist{margin-top:-.5em}
.colist>table tr>td:first-of-type{padding:0 .75em;line-height:1}
.colist>table tr>td:last-of-type{padding:.25em 0}
.thumb,.th{line-height:0;display:inline-block;border:solid 4px #fff;-webkit-box-shadow:0 0 0 1px #ddd;box-shadow:0 0 0 1px #ddd}
.imageblock.left,.imageblock[style*="float: left"]{margin:.25em .625em 1.25em 0}
.imageblock.right,.imageblock[style*="float: right"]{margin:.25em 0 1.25em .625em}
.imageblock>.title{margin-bottom:0}
.imageblock.thumb,.imageblock.th{border-width:6px}
.imageblock.thumb>.title,.imageblock.th>.title{padding:0 .125em}
.image.left,.image.right{margin-top:.25em;margin-bottom:.25em;display:inline-block;line-height:0}
.image.left{margin-right:.625em}
.image.right{margin-left:.625em}
a.image{text-decoration:none;display:inline-block}
a.image object{pointer-events:none}
sup.footnote,sup.footnoteref{font-size:.875em;position:static;vertical-align:super}
sup.footnote a,sup.footnoteref a{text-decoration:none}
sup.footnote a:active,sup.footnoteref a:active{text-decoration:underline}
#footnotes{padding-top:.75em;padding-bottom:.75em;margin-bottom:.625em}
#footnotes hr{width:20%;min-width:6.25em;margin:-.25em 0 .75em 0;border-width:1px 0 0 0}
#footnotes .footnote{padding:0 .375em 0 .225em;line-height:1.3334;font-size:.875em;margin-left:1.2em;text-indent:-1.05em;margin-bottom:.2em}
#footnotes .footnote a:first-of-type{font-weight:bold;text-decoration:none}
#footnotes .footnote:last-of-type{margin-bottom:0}
#content #footnotes{margin-top:-.625em;margin-bottom:0;padding:.75em 0}
.gist .file-data>table{border:0;background:#fff;width:100%;margin-bottom:0}
.gist .file-data>table td.line-data{width:99%}
div.unbreakable{page-break-inside:avoid}
.big{font-size:larger}
.small{font-size:smaller}
.underline{text-decoration:underline}
.overline{text-decoration:overline}
.line-through{text-decoration:line-through}
.aqua{color:#00bfbf}
.aqua-background{background-color:#00fafa}
.black{color:#000}
.black-background{background-color:#000}
.blue{color:#0000bf}
.blue-background{background-color:#0000fa}
.fuchsia{color:#bf00bf}
.fuchsia-background{background-color:#fa00fa}
.gray{color:#606060}
.gray-background{background-color:#7d7d7d}
.green{color:#006000}
.green-background{background-color:#007d00}
.lime{color:#00bf00}
.lime-background{background-color:#00fa00}
.maroon{color:#600000}
.maroon-background{background-color:#7d0000}
.navy{color:#000060}
.navy-background{background-color:#00007d}
.olive{color:#606000}
.olive-background{background-color:#7d7d00}
.purple{color:#600060}
.purple-background{background-color:#7d007d}
.red{color:#bf0000}
.red-background{background-color:#fa0000}
.silver{color:#909090}
.silver-background{background-color:#bcbcbc}
.teal{color:#006060}
.teal-background{background-color:#007d7d}
.white{color:#bfbfbf}
.white-background{background-color:#fafafa}
.yellow{color:#bfbf00}
.yellow-background{background-color:#fafa00}
span.icon>.fa{cursor:default}
.admonitionblock td.icon [class^="fa icon-"]{font-size:2.5em;text-shadow:1px 1px 2px rgba(0,0,0,.5);cursor:default}
.admonitionblock td.icon .icon-note:before{content:"\f05a";color:#19407c}
.admonitionblock td.icon .icon-tip:before{content:"\f0eb";text-shadow:1px 1px 2px rgba(155,155,0,.8);color:#111}
.admonitionblock td.icon .icon-warning:before{content:"\f071";color:#bf6900}
.admonitionblock td.icon .icon-caution:before{content:"\f06d";color:#bf3400}
.admonitionblock td.icon .icon-important:before{content:"\f06a";color:#bf0000}
.conum[data-value]{display:inline-block;color:#fff!important;background-color:rgba(0,0,0,.8);-webkit-border-radius:100px;border-radius:100px;text-align:center;font-size:.75em;width:1.67em;height:1.67em;line-height:1.67em;font-family:"Open Sans","DejaVu Sans",sans-serif;font-style:normal;font-weight:bold}
.conum[data-value] *{color:#fff!important}
.conum[data-value]+b{display:none}
.conum[data-value]:after{content:attr(data-value)}
pre .conum[data-value]{position:relative;top:-.125em}
b.conum *{color:inherit!important}
.conum:not([data-value]):empty{display:none}
dt,th.tableblock,td.content,div.footnote{text-rendering:optimizeLegibility}
h1,h2,p,td.content,span.alt{letter-spacing:-.01em}
p strong,td.content strong,div.footnote strong{letter-spacing:-.005em}
p,blockquote,dt,td.content,span.alt{font-size:1.0625rem}
p{margin-bottom:1.25rem}
.sidebarblock p,.sidebarblock dt,.sidebarblock td.content,p.tableblock{font-size:1em}
.exampleblock>.content{background-color:#fffef7;border-color:#e0e0dc;-webkit-box-shadow:0 1px 4px #e0e0dc;box-shadow:0 1px 4px #e0e0dc}
.print-only{display:none!important}
@media print{@page{margin:1.25cm .75cm}
*{-webkit-box-shadow:none!important;box-shadow:none!important;text-shadow:none!important}
a{color:inherit!important;text-decoration:underline!important}
a.bare,a[href^="#"],a[href^="mailto:"]{text-decoration:none!important}
a[href^="http:"]:not(.bare):after,a[href^="https:"]:not(.bare):after{content:"(" attr(href) ")";display:inline-block;font-size:.875em;padding-left:.25em}
abbr[title]:after{content:" (" attr(title) ")"}
pre,blockquote,tr,img,object,svg{page-break-inside:avoid}
thead{display:table-header-group}
svg{max-width:100%}
p,blockquote,dt,td.content{font-size:1em;orphans:3;widows:3}
h2,h3,#toctitle,.sidebarblock>.content>.title{page-break-after:avoid}
#toc,.sidebarblock,.exampleblock>.content{background:none!important}
#toc{border-bottom:1px solid #ddddd8!important;padding-bottom:0!important}
.sect1{padding-bottom:0!important}
.sect1+.sect1{border:0!important}
#header>h1:first-child{margin-top:1.25rem}
body.book #header{text-align:center}
body.book #header>h1:first-child{border:0!important;margin:2.5em 0 1em 0}
body.book #header .details{border:0!important;display:block;padding:0!important}
body.book #header .details span:first-child{margin-left:0!important}
body.book #header .details br{display:block}
body.book #header .details br+span:before{content:none!important}
body.book #toc{border:0!important;text-align:left!important;padding:0!important;margin:0!important}
body.book #toc,body.book #preamble,body.book h1.sect0,body.book .sect1>h2{page-break-before:always}
.listingblock code[data-lang]:before{display:block}
#footer{background:none!important;padding:0 .9375em}
#footer-text{color:rgba(0,0,0,.6)!important;font-size:.9em}
.hide-on-print{display:none!important}
.print-only{display:block!important}
.hide-for-print{display:none!important}
.show-for-print{display:inherit!important}}
</style>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
</head>
<body id="kudu_impala" class="book toc2 toc-left">
<div id="header">
<h1>Using Apache Kudu with Apache Impala (incubating)</h1>
<div class="details">
<span id="author" class="author">Kudu Team</span><br>
</div>
<div id="toc" class="toc2">
<div id="toctitle">Table of Contents</div>
<ul class="sectlevel1">
<li><a href="#_requirements_and_implications">Requirements and Implications</a></li>
<li><a href="#_installing_impala_kudu_using_cloudera_manager">Installing Impala_Kudu Using Cloudera Manager</a>
<ul class="sectlevel2">
<li><a href="#install_impala_kudu_parcels">Installing the Impala_Kudu Service Using Parcels</a></li>
<li><a href="#install_impala_kudu_packages">Installing Impala_Kudu Using Packages</a></li>
<li><a href="#_adding_impala_service_in_cloudera_manager">Adding Impala service in Cloudera Manager</a></li>
</ul>
</li>
<li><a href="#_installing_impala_kudu_without_cloudera_manager">Installing Impala_Kudu Without Cloudera Manager</a>
<ul class="sectlevel2">
<li><a href="#_starting_impala_kudu_services">Starting Impala_Kudu Services</a></li>
</ul>
</li>
<li><a href="#_using_the_impala_shell">Using the Impala Shell</a>
<ul class="sectlevel2">
<li><a href="#_internal_and_external_impala_tables">Internal and External Impala Tables</a></li>
<li><a href="#_querying_an_existing_kudu_table_in_impala">Querying an Existing Kudu Table In Impala</a></li>
<li><a href="#kudu_impala_create_table">Creating a New Kudu Table From Impala</a></li>
<li><a href="#_optimizing_performance_for_evaluating_sql_predicates">Optimizing Performance for Evaluating SQL Predicates</a></li>
<li><a href="#partitioning_tables">Partitioning Tables</a></li>
<li><a href="#_inserting_data_into_kudu_tables">Inserting Data Into Kudu Tables</a></li>
<li><a href="#_updating_a_row">Updating a Row</a></li>
<li><a href="#_deleting_a_row">Deleting a Row</a></li>
<li><a href="#impala_insertion_caveat">Failures During <code>INSERT</code>, <code>UPDATE</code>, and <code>DELETE</code> Operations</a></li>
<li><a href="#_altering_table_properties">Altering Table Properties</a></li>
<li><a href="#_dropping_a_kudu_table_using_impala">Dropping a Kudu Table Using Impala</a></li>
</ul>
</li>
<li><a href="#_what_s_next">What&#8217;s Next?</a></li>
</ul>
</div>
</div>
<div id="content">
<div id="preamble">
<div class="sectionbody">
<div class="paragraph">
<p>Kudu has tight integration with Impala, allowing you to use Impala
to insert, query, update, and delete data from Kudu tablets using Impala&#8217;s SQL
syntax, as an alternative to using the <a href="installation.html#view_api">Kudu APIs</a>
to build a custom Kudu application. In addition, you can use JDBC or ODBC to connect
existing or new applications written in any language, framework, or business intelligence
tool to your Kudu data, using Impala as the broker.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
The following instructions assume a
<a href="http://www.cloudera.com/content/www/en-us/products/cloudera-manager.html">Cloudera Manager</a>
deployment. However, you can use Kudu with Impala without Cloudera Manager.
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_requirements_and_implications"><a class="link" href="#_requirements_and_implications">Requirements and Implications</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>This integration relies on features that released versions of Impala do not have yet.
In the interim, you need
to install a fork of Impala, which this document will refer to as <em>Impala_Kudu</em>.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>You can install Impala_Kudu using parcels or packages.</p>
</li>
<li>
<p>Kudu itself requires CDH 5.4.3 or later. To use Cloudera Manager with Impala_Kudu,
you need Cloudera Manager 5.4.3 or later. Cloudera Manager 5.4.7 is recommended, as
it adds support for collecting metrics from Kudu.</p>
</li>
<li>
<p>If you have an existing Impala instance on your cluster, you can install Impala_Kudu
alongside the existing Impala instance <strong>if you use parcels</strong>. The new instance does
not share configurations with the existing instance and is completely independent.
A script is provided to automate this type of installation. See <a href="#install_impala_kudu_parcels_side_by_side">Manual Installation</a>.</p>
</li>
<li>
<p>It is especially important that the cluster has adequate
unreserved RAM for the Impala_Kudu instance.</p>
</li>
<li>
<p>Consider shutting down the original Impala service when testing Impala_Kudu if you
want to be sure it is not impacted.</p>
</li>
<li>
<p>Before installing Impala_Kudu, you must have already installed and configured
services for HDFS (though it is not used by Kudu), the Hive Metastore (where Impala
stores its metadata), and <a href="installation.html">Kudu</a>. You may need HBase, YARN,
Sentry, and ZooKeeper services as well. Meeting the Impala installation requirements
is out of the scope of this document. See
<a href="http://www.cloudera.com/content/www/en-us/documentation/enterprise/latest/topics/impala_prereqs.html">Impala Prequisites</a>
in the official Impala documentation for more information.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_installing_impala_kudu_using_cloudera_manager"><a class="link" href="#_installing_impala_kudu_using_cloudera_manager">Installing Impala_Kudu Using Cloudera Manager</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>If you use Cloudera Manager, you can install Impala_Kudu using
<a href="#install_impala_kudu_parcels">parcels</a> or
<a href="#install_impala_kudu_packages">packages</a>. However, if you have an existing Impala
instance, you must use parcels and you should use the instructions provided in
<a href="#install_impala_kudu_parcels_side_by_side">procedure</a>, rather than these instructions.</p>
</div>
<div class="sect2">
<h3 id="install_impala_kudu_parcels"><a class="link" href="#install_impala_kudu_parcels">Installing the Impala_Kudu Service Using Parcels</a></h3>
<div class="sect3">
<h4 id="install_impala_kudu_parcels_side_by_side"><a class="link" href="#install_impala_kudu_parcels_side_by_side">Manual Installation</a></h4>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Manual installation of Impala_Kudu is only supported where there is no other Impala
service already running in the cluster, and when you use parcels.
</td>
</tr>
</table>
</div>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Obtain the Impala_Kudu parcel either by using the parcel repository or downloading it manually.</p>
<div class="ulist">
<ul>
<li>
<p>To use the parcel repository:</p>
<div class="ulist">
<ul>
<li>
<p>Go to <strong>Hosts / Parcels</strong>.</p>
</li>
<li>
<p>Click <strong>Edit Settings</strong>. Add <a href="http://archive.cloudera.com/beta/impala-kudu/parcels/latest/" class="bare">http://archive.cloudera.com/beta/impala-kudu/parcels/latest/</a>
as a <strong>Remote Parcel Repository URL</strong>. Click <strong>Save Changes</strong>.</p>
</li>
</ul>
</div>
</li>
<li>
<p>To download the parcel manually:</p>
<div class="ulist">
<ul>
<li>
<p>Download the parcel for your operating system from
<a href="http://archive.cloudera.com/beta/impala-kudu/parcels/latest/" class="bare">http://archive.cloudera.com/beta/impala-kudu/parcels/latest/</a> and upload
it to <code>/opt/cloudera/parcel-repo/</code> on the Cloudera Manager server.</p>
</li>
<li>
<p>Create a SHA1 file for the parcel. Cloudera Manager expects the SHA1 to be named
with the exact same name as the parcel, with a <code>.sha</code> ending added, and to only
contain the SHA1 itself, not the name of the parcel.</p>
<div class="listingblock">
<div class="content">
<pre>sha1sum &lt;name_of_parcel_file&gt; | awk {'print $1'} &gt; &lt;name_of_parcel_file&gt;.sha</pre>
</div>
</div>
</li>
</ul>
</div>
</li>
</ul>
</div>
</li>
<li>
<p>Go to <strong>Hosts / Parcels</strong>. Click <strong>Check for New Parcels.</strong> Verify that <strong>Impala_Kudu</strong>
is in the list.</p>
</li>
<li>
<p>Download (if necessary), distribute, and activate the <strong>Impala_Kudu</strong> parcel.</p>
</li>
<li>
<p>Add a new Impala service. This service will use the Impala_Kudu parcel.</p>
<div class="ulist">
<ul>
<li>
<p>Go to the cluster and click <strong>Actions / Add a Service</strong>.</p>
</li>
<li>
<p>Choose one host to run the Catalog Server, one to run the StateServer, and one
or more to run Impala Daemon instances. Click <strong>Continue</strong>.</p>
</li>
<li>
<p>Choose one or more Impala scratch directories. Click <strong>Continue</strong>. The Impala service
starts. <strong>However, the features that Impala needs in order to work with Kudu are not
enabled yet.</strong></p>
</li>
</ul>
</div>
</li>
<li>
<p>Enable the features that allow Impala to work with Kudu.</p>
<div class="ulist">
<ul>
<li>
<p>Go to the new Impala service. Click <strong>Configuration</strong>.</p>
</li>
<li>
<p>Search for the <strong>Impala Service Environment Advanced Configuration Snippet (Safety
Valve)</strong> configuration item. Add the following to the text field and save your changes:
<code>IMPALA_KUDU=1</code></p>
</li>
<li>
<p>Restart the Impala service.</p>
</li>
<li>
<p>You can verify that the Kudu features are available to Impala by running the following
query in Impala Shell:</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">select if(version() like '%KUDU%', "all set to go!", "check your configs") as s;
Query: select if(version() like '%KUDU%', "all set to go!", "check your configs") as s
+----------------+
| s |
+----------------+
| all set to go! |
+----------------+
Fetched 1 row(s) in 0.02s</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you do not 'all set to go!', carefully review the previous instructions to be sure
that you have not missed a step.</p>
</div>
</li>
</ul>
</div>
</li>
</ol>
</div>
</div>
<div class="sect3">
<h4 id="_installation_using_the_code_deploy_py_code_script"><a class="link" href="#_installation_using_the_code_deploy_py_code_script">Installation using the <code>deploy.py</code> Script</a></h4>
<div class="paragraph">
<p>If you use parcels, Cloudera recommends using the included <code>deploy.py</code> script to
install and deploy the Impala_Kudu service into your cluster. If your cluster does
not have an existing Impala instance, the script is optional. However, if you do
have an existing Impala instance and want to install Impala_Kudu side-by-side,
you must use the script.</p>
</div>
<div class="ulist">
<div class="title">Prerequisites</div>
<ul>
<li>
<p>The script depends upon the Cloudera Manager API Python bindings. Install the bindings
using <code>sudo pip install cm-api</code> (or as an unprivileged user, with the <code>--user</code>
option to <code>pip</code>), or see <a href="http://cloudera.github.io/cm_api/docs/python-client/" class="bare">http://cloudera.github.io/cm_api/docs/python-client/</a>
for more details.</p>
</li>
<li>
<p>You need the following information to run the script:</p>
<div class="ulist">
<ul>
<li>
<p>The IP address or fully-qualified domain name of the Cloudera Manager server.</p>
</li>
<li>
<p>The IP address or fully-qualified domain name of the host that should run the Kudu
master process, if different from the Cloudera Manager server.</p>
</li>
<li>
<p>The cluster name, if Cloudera Manager manages multiple clusters.</p>
</li>
<li>
<p>If you have an existing Impala service and want to clone its configuration, you
need to know the name of the existing service.</p>
</li>
<li>
<p>If your cluster has more than one instance of a HDFS, Hive, HBase, or other CDH
service that this Impala_Kudu service depends upon, the name of the service this new
Impala_Kudu service should use.</p>
</li>
<li>
<p>A name for the new Impala service.</p>
</li>
<li>
<p>A user name and password with <strong>Full Administrator</strong> privileges in Cloudera Manager.</p>
</li>
<li>
<p>The IP address or host name of the host where the new Impala_Kudu service&#8217;s master role
should be deployed, if not the Cloudera Manager server.</p>
</li>
<li>
<p>A comma-separated list of local (not HDFS) scratch directories which the new
Impala_Kudu service should use, if you are not cloning an existing Impala service.</p>
</li>
</ul>
</div>
</li>
<li>
<p>Your Cloudera Manager server needs network access to reach the parcel repository
hosted on <code>cloudera.com</code>.</p>
</li>
</ul>
</div>
<div class="ulist">
<div class="title">Procedure</div>
<ul>
<li>
<p>Download the <code>deploy.py</code> from <a href="https://github.com/apache/incubator-impala/blob/master/infra/deploy/deploy.py" class="bare">https://github.com/apache/incubator-impala/blob/master/infra/deploy/deploy.py</a>
using <code>curl</code> or another utility of your choice.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">$ curl -O https://raw.githubusercontent.com/apache/incubator-impala/master/infra/deploy/deploy.py</code></pre>
</div>
</div>
</li>
<li>
<p>Run the <code>deploy.py</code> script. The syntax below creates a standalone IMPALA_KUDU
service called <code>IMPALA_KUDU-1</code> on a cluster called <code>Cluster 1</code>. Exactly one HDFS, Hive,
and HBase service exist in Cluster 1, so service dependencies are not required.
The cluster should not already have an Impala instance.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">$ python deploy.py create IMPALA_KUDU-1 --cluster 'Cluster 1' \
--master_host &lt;FQDN_of_Kudu_master_server&gt; \
--host &lt;FQDN_of_cloudera_manager_server&gt;</code></pre>
</div>
</div>
</li>
</ul>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
If you do not specify <code>--master_host</code>, the Kudu master is configured to run
on the Cloudera Manager server (the value specified by the <code>--host</code> parameter).
</td>
</tr>
</table>
</div>
<div class="ulist">
<ul>
<li>
<p>If two HDFS services are available, called <code>HDFS-1</code> and <code>HDFS-2</code>, use the following
syntax to create the same <code>IMPALA_KUDU-1</code> service using <code>HDFS-2</code>. You can specify
multiple types of dependencies; use the <code>deploy.py create -h</code> command for details.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">$ python deploy.py create IMPALA_KUDU-1 --cluster 'Cluster 1' --hdfs_dependency HDFS-2 \
--host &lt;FQDN_of_cloudera_manager_server&gt;</code></pre>
</div>
</div>
</li>
<li>
<p>Run the <code>deploy.py</code> script with the following syntax to clone an existing IMPALA
service called <code>IMPALA-1</code> to a new IMPALA_KUDU service called <code>IMPALA_KUDU-1</code>, where
Cloudera Manager only manages a single cluster. This new <code>IMPALA_KUDU-1</code> service
can run side by side with the <code>IMPALA-1</code> service if there is sufficient RAM for both.
<code>IMPALA_KUDU-1</code> should be given at least 16 GB of RAM and possibly more depending
on the complexity of the workload and the query concurrency level.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">$ python deploy.py clone IMPALA_KUDU-1 IMPALA-1 --host &lt;FQDN_of_cloudera_manager_server&gt;</code></pre>
</div>
</div>
</li>
<li>
<p>Additional parameters are available for <code>deploy.py</code>. To view them, use the <code>-h</code>
argument. You can also use commands such as <code>deploy.py create -h</code> or
<code>deploy.py clone -h</code> to get information about additional arguments for individual operations.</p>
</li>
<li>
<p>The service is created <strong>but not started</strong>. Review the configuration in Cloudera Manager
and start the service.</p>
</li>
</ul>
</div>
</div>
</div>
<div class="sect2">
<h3 id="install_impala_kudu_packages"><a class="link" href="#install_impala_kudu_packages">Installing Impala_Kudu Using Packages</a></h3>
<div class="paragraph">
<p>Before installing Impala_Kudu packages, you need to uninstall any existing Impala
packages, using operating system utilities. For this reason, you cannot use Impala_Kudu
alongside another Impala instance if you use packages.</p>
</div>
<table id="impala_kudu_package_locations" class="tableblock frame-all grid-all spread">
<caption class="title">Table 1. Impala_Kudu Package Locations</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-right valign-top">OS</th>
<th class="tableblock halign-left valign-top">Repository</th>
<th class="tableblock halign-left valign-top">Individual Packages</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-right valign-top"><p class="tableblock"><strong>RHEL or CentOS</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/redhat/6/x86_64/impala-kudu/cloudera-impala-kudu.repo">RHEL 6 or CentOS 6</a>,
<a href="http://archive.cloudera.com/beta/impala-kudu/redhat/7/x86_64/impala-kudu/cloudera-impala-kudu.repo">RHEL 7 or CentOS 7</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/redhat/6/x86_64/impala-kudu/0/RPMS/x86_64/">RHEL 6 or CentOS 6</a>,
<a href="http://archive.cloudera.com/beta/impala-kudu/redhat/7/x86_64/impala-kudu/0/RPMS/x86_64/">RHEL 7 or CentOS 7</a></p></td>
</tr>
<tr>
<td class="tableblock halign-right valign-top"><p class="tableblock"><strong>Ubuntu</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/ubuntu/trusty/amd64/impala-kudu/cloudera.list">Trusty</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/ubuntu/trusty/amd64/impala-kudu/pool/contrib/i/impala-kudu/">Trusty</a></p></td>
</tr>
</tbody>
</table>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Download and configure the Impala_Kudu repositories for your operating system, or manually
download individual RPMs, the appropriate link from <a href="#impala_kudu_package_locations">Impala_Kudu Package Locations</a>.</p>
</li>
<li>
<p>An Impala cluster has at least one <code>impala-kudu-server</code> and at most one <code>impala-kudu-catalog</code>
and <code>impala-kudu-state-store</code>. To connect to Impala from the command line, install
the <code>impala-kudu-shell</code> package.</p>
</li>
</ol>
</div>
</div>
<div class="sect2">
<h3 id="_adding_impala_service_in_cloudera_manager"><a class="link" href="#_adding_impala_service_in_cloudera_manager">Adding Impala service in Cloudera Manager</a></h3>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Add a new Impala service in Cloudera Manager.</p>
<div class="ulist">
<ul>
<li>
<p>Go to the cluster and click <strong>Actions / Add a Service</strong>.</p>
</li>
<li>
<p>Choose one host to run the Catalog Server, one to run the Statestore, and at
least three to run Impala Daemon instances. Click <strong>Continue</strong>.</p>
</li>
<li>
<p>Choose one or more Impala scratch directories. Click <strong>Continue</strong>.</p>
</li>
</ul>
</div>
</li>
<li>
<p>The Impala service starts.</p>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_installing_impala_kudu_without_cloudera_manager"><a class="link" href="#_installing_impala_kudu_without_cloudera_manager">Installing Impala_Kudu Without Cloudera Manager</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>Before installing Impala_Kudu packages, you need to uninstall any existing Impala
packages, using operating system utilities. For this reason, you cannot use Impala_Kudu
alongside another Impala instance if you use packages.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
Do not use these command-line instructions if you use Cloudera Manager.
Instead, follow <a href="#install_impala_kudu_packages">Installing Impala_Kudu Using Packages</a>.
</td>
</tr>
</table>
</div>
<table id="impala_kudu_non-cm_locations" class="tableblock frame-all grid-all spread">
<caption class="title">Table 2. Impala_Kudu Package Locations</caption>
<colgroup>
<col style="width: 33.3333%;">
<col style="width: 33.3333%;">
<col style="width: 33.3334%;">
</colgroup>
<thead>
<tr>
<th class="tableblock halign-right valign-top">OS</th>
<th class="tableblock halign-left valign-top">Repository</th>
<th class="tableblock halign-left valign-top">Individual Packages</th>
</tr>
</thead>
<tbody>
<tr>
<td class="tableblock halign-right valign-top"><p class="tableblock"><strong>RHEL or CentOS</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/redhat/6/x86_64/impala-kudu/cloudera-impala-kudu.repo">RHEL 6 or CentOS 6</a>,
<a href="http://archive.cloudera.com/beta/impala-kudu/redhat/7/x86_64/impala-kudu/cloudera-impala-kudu.repo">RHEL 7 or CentOS 7</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/redhat/6/x86_64/impala-kudu/0/RPMS/x86_64/">RHEL 6 or CentOS 6</a>,
<a href="http://archive.cloudera.com/beta/impala-kudu/redhat/7/x86_64/impala-kudu/0/RPMS/x86_64/">RHEL 7 or CentOS 7</a></p></td>
</tr>
<tr>
<td class="tableblock halign-right valign-top"><p class="tableblock"><strong>Ubuntu</strong></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/ubuntu/trusty/amd64/impala-kudu/cloudera.list">Trusty</a></p></td>
<td class="tableblock halign-left valign-top"><p class="tableblock"><a href="http://archive.cloudera.com/beta/impala-kudu/ubuntu/trusty/amd64/impala-kudu/pool/contrib/i/impala-kudu/">Trusty</a></p></td>
</tr>
</tbody>
</table>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Download and configure the Impala_Kudu repositories for your operating system, or manually
download individual RPMs, the appropriate link from <a href="#impala_kudu_non-cm_locations">Impala_Kudu Package Locations</a>.</p>
</li>
<li>
<p>An Impala cluster has at least one <code>impala-kudu-server</code> and at most one <code>impala-kudu-catalog</code>
and <code>impala-kudu-state-store</code>. To connect to Impala from the command line, install
the <code>impala-kudu-shell</code> package.</p>
</li>
</ol>
</div>
<div class="sect2">
<h3 id="_starting_impala_kudu_services"><a class="link" href="#_starting_impala_kudu_services">Starting Impala_Kudu Services</a></h3>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Use the Impala start-up scripts to start each service on the relevant hosts:</p>
<div class="listingblock">
<div class="content">
<pre>$ sudo service impala-state-store start
$ sudo service impala-catalog start
$ sudo service impala-server start</pre>
</div>
</div>
</li>
</ol>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_using_the_impala_shell"><a class="link" href="#_using_the_impala_shell">Using the Impala Shell</a></h2>
<div class="sectionbody">
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
This is only a small sub-set of Impala Shell functionality. For more details, see the
<a href="http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_impala_shell.html">Impala Shell</a> documentation.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Neither Kudu nor Impala need special configuration in order for you to use the Impala
Shell or the Impala API to insert, update, delete, or query Kudu data using Impala.
However, you do need to create a mapping between the Impala and Kudu tables. Kudu
provides the Impala query to map to an existing Kudu table in the web UI.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Be sure you are using the <code>impala-shell</code> binary provided by the Impala_Kudu package,
rather than the default CDH Impala binary. The following shows how to verify this
using the <code>alternatives</code> command on a RHEL or CentOS host.</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-bash" data-lang="bash">$ sudo alternatives --display impala-shell
impala-shell - status is auto.
link currently points to /opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.1007/bin/impala-shell
/opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.1007/bin/impala-shell - priority 10
/opt/cloudera/parcels/IMPALA_KUDU-2.3.0-1.cdh5.5.0.p0.119/bin/impala-shell - priority 5
Current `best' version is /opt/cloudera/parcels/CDH-5.5.0-1.cdh5.5.0.p0.1007/bin/impala-shell.
$ sudo alternatives --set impala-shell /opt/cloudera/parcels/IMPALA_KUDU-2.3.0-1.cdh5.5.0.p0.119/bin/impala-shell</code></pre>
</div>
</div>
</li>
<li>
<p>Start Impala Shell using the <code>impala-shell</code> command. By default, <code>impala-shell</code>
attempts to connect to the Impala daemon on <code>localhost</code> on port 21000. To connect
to a different host,, use the <code>-i &lt;host:port&gt;</code> option. To automatically connect to
a specific Impala database, use the <code>-d &lt;database&gt;</code> option. For instance, if all your
Kudu tables are in Impala in the database <code>impala_kudu</code>, use <code>-d impala_kudu</code> to use
this database.</p>
</li>
<li>
<p>To quit the Impala Shell, use the following command: <code>quit;</code></p>
</li>
</ul>
</div>
<div class="sect2">
<h3 id="_internal_and_external_impala_tables"><a class="link" href="#_internal_and_external_impala_tables">Internal and External Impala Tables</a></h3>
<div class="paragraph">
<p>When creating a new Kudu table using Impala, you can create the table as an internal
table or an external table.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Internal</dt>
<dd>
<p>An internal table is managed by Impala, and when you drop it from Impala,
the data and the table truly are dropped. When you create a new table using Impala,
it is generally a internal table.</p>
</dd>
<dt class="hdlist1">External</dt>
<dd>
<p>An external table (created by <code>CREATE EXTERNAL TABLE</code>) is not managed by
Impala, and dropping such a table does not drop the table from its source location
(here, Kudu). Instead, it only removes the mapping between Impala and Kudu. This is
the mode used in the syntax provided by Kudu for mapping an existing table to Impala.</p>
</dd>
</dl>
</div>
<div class="paragraph">
<p>See the <a href="http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_tables.html">Impala documentation</a> for more information about internal and external tables.</p>
</div>
</div>
<div class="sect2">
<h3 id="_querying_an_existing_kudu_table_in_impala"><a class="link" href="#_querying_an_existing_kudu_table_in_impala">Querying an Existing Kudu Table In Impala</a></h3>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>Go to <a href="http://kudu-master.example.com:8051/tables/" class="bare">http://kudu-master.example.com:8051/tables/</a>, where <em>kudu-master.example.com</em>
is the address of your Kudu master.</p>
</li>
<li>
<p>Click the table ID for the relevant table.</p>
</li>
<li>
<p>Scroll to the bottom of the page, or search for <code>Impala CREATE TABLE statement</code>.
Copy the entire statement.</p>
</li>
<li>
<p>Paste the statement into Impala. Impala now has a mapping to your Kudu table.</p>
</li>
</ol>
</div>
</div>
<div class="sect2">
<h3 id="kudu_impala_create_table"><a class="link" href="#kudu_impala_create_table">Creating a New Kudu Table From Impala</a></h3>
<div class="paragraph">
<p>Creating a new table in Kudu from Impala is similar to mapping an existing Kudu table
to an Impala table, except that you need to write the <code>CREATE</code> statement yourself.
Use the following example as a guideline. Impala first creates the table, then creates
the mapping.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
When creating a new Kudu table, you are strongly encouraged to specify
a distribution scheme. If you do not, your table will consist of a single tablet,
and thus load will not be distributed across your cluster. See
<a href="#partitioning_tables">Partitioning Tables</a>. The table creation example below is distributed into 16
buckets by hashing the <code>id</code> column, for simplicity. See
<a href="#partitioning_rules_of_thumb">Partitioning Rules of Thumb</a> for guidelines on partitioning.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE my_first_table
(
id BIGINT,
name STRING
)
DISTRIBUTE BY HASH INTO 16 BUCKETS
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'my_first_table',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'id'
);</code></pre>
</div>
</div>
<div class="paragraph">
<p>In the <code>CREATE TABLE</code> statement, the columns that comprise the primary key must
be listed first. Additionally, primary key columns are implicitly marked <code>NOT NULL</code>.</p>
</div>
<div class="paragraph">
<p>The following table properties are required, and the <code>kudu.key_columns</code> property must
contain at least one column.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1"><code>storage_handler</code></dt>
<dd>
<p>the mechanism used by Impala to determine the type of data source.
For Kudu tables, this must be <code>com.cloudera.kudu.hive.KuduStorageHandler</code>.</p>
</dd>
<dt class="hdlist1"><code>kudu.table_name</code></dt>
<dd>
<p>the name of the table that Impala will create (or map to) in Kudu.</p>
</dd>
<dt class="hdlist1"><code>kudu.master_addresses</code></dt>
<dd>
<p>the list of Kudu masters Impala should communicate with.</p>
</dd>
<dt class="hdlist1"><code>kudu.key_columns</code></dt>
<dd>
<p>the comma-separated list of primary key columns, whose contents
should not be nullable.</p>
</dd>
</dl>
</div>
<div class="sect3">
<h4 id="__code_create_table_as_select_code"><a class="link" href="#__code_create_table_as_select_code"><code>CREATE TABLE AS SELECT</code></a></h4>
<div class="paragraph">
<p>You can create a table by querying any other table or tables in Impala, using a <code>CREATE
TABLE &#8230;&#8203; AS SELECT</code> statement. The following example imports all rows from an existing table
<code>old_table</code> into a Kudu table <code>new_table</code>. The columns in <code>new_table</code> will have the
same names and types as the columns in <code>old_table</code>, but you need to populate the <code>kudu.key_columns</code>
property. In this example, the primary key columns are <code>ts</code> and <code>name</code>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE new_table
DISTRIBUTE BY HASH INTO 16 BUCKETS
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'new_table',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'ts, name'
)
AS SELECT * FROM old_table;</code></pre>
</div>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="paragraph">
<p>For <code>CREATE TABLE &#8230;&#8203; AS SELECT</code> we currently require that the first columns that are
projected in the <code>SELECT</code> statement correspond to the Kudu table keys and are in the
same order (<code>ts</code> then <code>name</code> in the example above). If the default projection generated by <code><strong></code>
does not meet this requirement, the user should avoid using <code></strong></code> and explicitly mention
the columns to project, in the correct order.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>You can refine the <code>SELECT</code> statement to only match the rows and columns you want
to be inserted into the new table. You can also rename the columns by using syntax
like <code>SELECT name as new_name</code>.</p>
</div>
</div>
<div class="sect3">
<h4 id="_pre_splitting_tables"><a class="link" href="#_pre_splitting_tables">Pre-Splitting Tables</a></h4>
<div class="paragraph">
<p>Tables are divided into tablets which are each served by one or more tablet
servers. Ideally, tablets should split a table&#8217;s data relatively equally. Kudu currently
has no mechanism for automatically (or manually) splitting a pre-existing tablet.
Until this feature has been implemented, <strong>you must pre-split your table when you create
it</strong>. When designing your table schema, consider primary keys that will allow you to
pre-split your table into tablets which grow at similar rates. You can provide split
points using a <code>DISTRIBUTE BY</code> clause when creating a table using Impala:</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Impala keywords, such as <code>group</code>, are enclosed by back-tick characters when
they are not used in their keyword sense.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE cust_behavior (
_id BIGINT,
salary STRING,
edu_level INT,
usergender STRING,
`group` STRING,
city STRING,
postcode STRING,
last_purchase_price FLOAT,
last_purchase_date BIGINT,
category STRING,
sku STRING,
rating INT,
fulfilled_date BIGINT
)
DISTRIBUTE BY RANGE (_id)
SPLIT ROWS((1439560049342),
(1439566253755),
(1439572458168),
(1439578662581),
(1439584866994),
(1439591071407))
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'cust_behavior',
'kudu.master_addresses' = 'a1216.halxg.cloudera.com:7051',
'kudu.key_columns' = '_id',
'kudu.num_tablet_replicas' = '3'
);</code></pre>
</div>
</div>
<div class="paragraph">
<p>If you have multiple primary key columns, you can specify split points by separating
them with commas within the inner brackets: <code>(('va',1), ('ab',2))</code>. The expression
must be valid JSON.</p>
</div>
</div>
<div class="sect3">
<h4 id="_impala_databases_and_kudu"><a class="link" href="#_impala_databases_and_kudu">Impala Databases and Kudu</a></h4>
<div class="paragraph">
<p>Impala uses a database containment model. In Impala, you can create a table within a specific
scope, referred to as a <em>database</em>. To create the database, use a <code>CREATE DATABASE</code>
statement. To use the database for further Impala operations such as <code>CREATE TABLE</code>,
use the <code>USE</code> statement. For example, to create a table in a database called <code>impala_kudu</code>,
use the following statements:</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Impala uses a namespace mechanism to allow for tables to be created within different
scopes, called <code>databases</code>. To create a database, use a <code>CREATE DATABASE</code>
statement. To use the database for further Impala operations such as <code>CREATE TABLE</code>,
use the <code>USE</code> statement. For example, to create a table in a database called <code>impala_kudu</code>,
use the following SQL:
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE DATABASE impala_kudu;
USE impala_kudu;
CREATE TABLE my_first_table (
id BIGINT,
name STRING
)
DISTRIBUTE BY HASH INTO 4 BUCKETS
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'my_first_table',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'id'
);</code></pre>
</div>
</div>
<div class="paragraph">
<p>The <code>my_first_table</code> table is created within the <code>impala_kudu</code> database. To refer
to this database in the future, without using a specific <code>USE</code> statement, you can
refer to the table using <code>&lt;database&gt;.&lt;table&gt;</code> syntax. For example, to specify the
<code>my_first_table</code> table in database <code>impala_kudu</code>, as opposed to any other table with
the same name in another database, use <code>impala_kudu.my_first_table</code>. This also applies
to <code>INSERT</code>, <code>UPDATE</code>, <code>DELETE</code>, and <code>DROP</code> statements.</p>
</div>
<div class="admonitionblock warning">
<table>
<tr>
<td class="icon">
<i class="fa icon-warning" title="Warning"></i>
</td>
<td class="content">
Currently, Kudu does not encode the Impala database into the table name
in any way. This means that even though you can create Kudu tables within Impala databases,
the actual Kudu tables need to be unique within Kudu. For example, if you create <code>database_1.my_kudu_table</code>
and <code>database_2.my_kudu_table</code>, you will have a naming collision within Kudu, even
though this would not cause a problem in Impala. This can be resolved by specifying
a unique Kudu table name in the <code>kudu.table_name</code> property.
</td>
</tr>
</table>
</div>
</div>
<div class="sect3">
<h4 id="_impala_keywords_not_supported_for_kudu_tables"><a class="link" href="#_impala_keywords_not_supported_for_kudu_tables">Impala Keywords Not Supported for Kudu Tables</a></h4>
<div class="paragraph">
<p>The following Impala keywords are not supported when creating Kudu tables:
- <code>PARTITIONED</code>
- <code>STORED AS</code>
- <code>LOCATION</code>
- <code>ROWFORMAT</code></p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_optimizing_performance_for_evaluating_sql_predicates"><a class="link" href="#_optimizing_performance_for_evaluating_sql_predicates">Optimizing Performance for Evaluating SQL Predicates</a></h3>
<div class="paragraph">
<p>If the <code>WHERE</code> clause of your query includes comparisons with the operators
<code>=</code>, <code>&lt;=</code>, or <code>&gt;=</code>, Kudu evaluates the condition directly and only returns the
relevant results. This provides optimum performance, because Kudu only returns the
relevant results to Impala. For predicates <code>&lt;</code>, <code>&gt;</code>, <code>!=</code>, or any other predicate
type supported by Impala, Kudu does not evaluate the predicates directly, but returns
all results to Impala and relies on Impala to evaluate the remaining predicates and
filter the results accordingly. This may cause differences in performance, depending
on the delta of the result set before and after evaluating the <code>WHERE</code> clause.</p>
</div>
<div class="paragraph">
<p>In the <code>CREATE TABLE</code> statement, the first column must be the primary key. Additionally,
the primary key can never be NULL when inserting or updating a row.</p>
</div>
<div class="paragraph">
<p>All properties in the <code>TBLPROPERTIES</code> statement are required, and the <code>kudu.key_columns</code>
must contain at least one column.</p>
</div>
</div>
<div class="sect2">
<h3 id="partitioning_tables"><a class="link" href="#partitioning_tables">Partitioning Tables</a></h3>
<div class="paragraph">
<p>Tables are partitioned into tablets according to a partition schema on the primary
key columns. Each tablet is served by at least one tablet server. Ideally, a table
should be split into tablets that are distributed across a number of tablet servers
to maximize parallel operations. The details of the partitioning schema you use
will depend entirely on the type of data you store and how you access it. For a full
discussion of schema design in Kudu, see <a href="schema_design.html">Schema Design</a>.</p>
</div>
<div class="paragraph">
<p>Kudu currently has no mechanism for splitting or merging tablets after the table has
been created. Until this feature has been implemented, you must provide a partition
schema for your table when you create it. When designing your tables, consider using
primary keys that will allow you to partition your table into tablets which grow
at similar rates.</p>
</div>
<div class="paragraph">
<p>You can partition your table using Impala&#8217;s <code>DISTRIBUTE BY</code> keyword, which
supports distribution by <code>RANGE</code> or <code>HASH</code>. The partition scheme can contain zero
or more <code>HASH</code> definitions, followed by an optional <code>RANGE</code> definition. The <code>RANGE</code>
definition can refer to one or more primary key columns.
Examples of <a href="#basic_partitioning">basic</a> and <a href="#advanced_partitioning">advanced</a>
partitioning are shown below.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Impala keywords, such as <code>group</code>, are enclosed by back-tick characters when
they are used as identifiers, rather than as keywords.
</td>
</tr>
</table>
</div>
<div class="sect3">
<h4 id="basic_partitioning"><a class="link" href="#basic_partitioning">Basic Partitioning</a></h4>
<div class="paragraph">
<div class="title"><code>DISTRIBUTE BY RANGE</code></div>
<p>You can specify split rows for one or more primary key columns that contain integer
or string values. Range partitioning in Kudu allows splitting a table based based
on the lexicographic order of its primary keys. This allows you to balance parallelism
in writes with scan efficiency.</p>
</div>
<div class="paragraph">
<p>The split row does not need to exist. It defines an exclusive bound in the form of:
<code>(START_KEY, SplitRow), [SplitRow, STOP_KEY)</code> In other words, the split row, if
it exists, is included in the tablet after the split point. For instance, if you
specify a split row <code>abc</code>, a row <code>abca</code> would be in the second tablet, while a row
<code>abb</code> would be in the first.</p>
</div>
<div class="paragraph">
<p>Suppose you have a table that has columns <code>state</code>, <code>name</code>, and <code>purchase_count</code>. The
following example creates 50 tablets, one per US state.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<div class="title">Monotonically Increasing Values</div>
<div class="paragraph">
<p>If you partition by range on a column whose values are monotonically increasing,
the last tablet will grow much larger than the others. Additionally, all data
being inserted will be written to a single tablet at a time, limiting the scalability
of data ingest. In that case, consider distributing by <code>HASH</code> instead of, or in
addition to, <code>RANGE</code>.</p>
</div>
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE customers (
state STRING,
name STRING,
purchase_count int32,
)
DISTRIBUTE BY RANGE (state)
SPLIT ROWS (('al'),
('ak'),
('ar'),
...
('wv'),
('wy'))
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'customers',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'state, name'
);</code></pre>
</div>
</div>
<div id="distribute_by_hash" class="paragraph">
<div class="title"><code>DISTRIBUTE BY HASH</code></div>
<p>Instead of distributing by an explicit range, or in combination with range distribution,
you can distribute into a specific number of 'buckets' by hash. You specify the primary
key columns you want to partition by, and the number of buckets you want to use. Rows are
distributed by hashing the specified key columns. Assuming that the values being
hashed do not themselves exhibit significant skew, this will serve to distribute
the data evenly across buckets.</p>
</div>
<div class="paragraph">
<p>You can specify multiple definitions, and you can specify definitions which
use compound primary keys. However, one column cannot be mentioned in multiple hash
definitions. Consider two columns, <code>a</code> and <code>b</code>:
* <span class="icon green"><i class="fa fa-check fa-pro"></i></span> <code>HASH(a)</code>, <code>HASH(b)</code>
* <span class="icon green"><i class="fa fa-check fa-pro"></i></span> <code>HASH(a,b)</code>
* <span class="icon red"><i class="fa fa-times fa-pro"></i></span> <code>HASH(a), HASH(a,b)</code></p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
<code>DISTRIBUTE BY HASH</code> with no column specified is a shortcut to create the desired
number of buckets by hashing all primary key columns.
</td>
</tr>
</table>
</div>
<div class="paragraph">
<p>Hash partitioning is a reasonable approach if primary key values are evenly
distributed in their domain and no data skew is apparent, such as timestamps or
serial IDs.</p>
</div>
<div class="paragraph">
<p>The following example creates 16 tablets by hashing the <code>id</code> column. This spreads
writes across all 16 tablets. In this example, a query for a range of <code>sku</code> values
is likely to need to read all 16 tablets, so this may not be the optimum schema for
this table. See <a href="#advanced_partitioning">Advanced Partitioning</a> for an extended example.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE cust_behavior (
id BIGINT,
sku STRING,
salary STRING,
edu_level INT,
usergender STRING,
`group` STRING,
city STRING,
postcode STRING,
last_purchase_price FLOAT,
last_purchase_date BIGINT,
category STRING,
rating INT,
fulfilled_date BIGINT
)
DISTRIBUTE BY HASH INTO 16 BUCKETS
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'cust_behavior',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'id, sku'
);</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="advanced_partitioning"><a class="link" href="#advanced_partitioning">Advanced Partitioning</a></h4>
<div class="paragraph">
<p>You can combine <code>HASH</code> and <code>RANGE</code> partitioning to create more complex partition schemas.
You can specify zero or more <code>HASH</code> definitions, followed by zero or one <code>RANGE</code> definitions.
Each definition can encompass one or more columns. While enumerating every possible distribution
schema is out of the scope of this document, a few examples illustrate some of the
possibilities.</p>
</div>
<div class="paragraph">
<div class="title"><code>DISTRIBUTE BY RANGE</code> Using Compound Split Rows</div>
<p>This example creates 100 tablets, two for each US state. Per state, the first tablet
holds names starting with characters before 'm', and the second tablet holds names
starting with 'm'-'z'. Writes are spread across at least 50 tablets, and possibly
up to 100. A query for a range of names in a given state is likely to only need to read from
one tablet, while a query for a range of names across every state will likely
read from at most 50 tablets.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE customers (
state STRING,
name STRING,
purchase_count int32,
)
DISTRIBUTE BY RANGE (state, name)
SPLIT ROWS (('al', ''),
('al', 'm'),
('ak', ''),
('ak', 'm'),
...
('wy', ''),
('wy', 'm'))
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'customers',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'state, name'
);</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="__code_distribute_by_hash_code_and_code_range_code"><a class="link" href="#__code_distribute_by_hash_code_and_code_range_code"><code>DISTRIBUTE BY HASH</code> and <code>RANGE</code></a></h4>
<div class="paragraph">
<p>Consider the <a href="#distribute_by_hash">simple hashing</a> example above, If you often query for a range of <code>sku</code>
values, you can optimize the example by combining hash partitioning with range partitioning.</p>
</div>
<div class="paragraph">
<p>The following example still creates 16 tablets, by first hashing the <code>id</code> column into 4
buckets, and then applying range partitioning to split each bucket into four tablets,
based upon the value of the <code>sku</code> string. Writes are spread across at least four tablets
(and possibly up to 16). When you query for a contiguous range of <code>sku</code> values, you have a
good chance of only needing to read from a quarter of the tablets to fulfill the query.</p>
</div>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
By default, the entire primary key is hashed when you use <code>DISTRIBUTE BY HASH</code>.
To hash on only part of the primary key, specify it by using syntax like <code>DISTRIBUTE
BY HASH (id, sku)</code>.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE cust_behavior (
id BIGINT,
sku STRING,
salary STRING,
edu_level INT,
usergender STRING,
`group` STRING,
city STRING,
postcode STRING,
last_purchase_price FLOAT,
last_purchase_date BIGINT,
category STRING,
rating INT,
fulfilled_date BIGINT
)
DISTRIBUTE BY HASH (id) INTO 4 BUCKETS,
RANGE (sku)
SPLIT ROWS (('g'),
('o'),
('u'))
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'cust_behavior',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'id, sku'
);</code></pre>
</div>
</div>
<div class="paragraph">
<div class="title">Multiple <code>DISTRIBUTE BY HASH</code> Definitions</div>
<p>Again expanding the example above, suppose that the query pattern will be unpredictable,
but you want to ensure that writes are spread across a large number of tablets
You can achieve maximum distribution across the entire primary key by hashing on
both primary key columns.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">CREATE TABLE cust_behavior (
id BIGINT,
sku STRING,
salary STRING,
edu_level INT,
usergender STRING,
`group` STRING,
city STRING,
postcode STRING,
last_purchase_price FLOAT,
last_purchase_date BIGINT,
category STRING,
rating INT,
fulfilled_date BIGINT
)
DISTRIBUTE BY HASH (id) INTO 4 BUCKETS,
HASH (sku) INTO 4 BUCKETS
TBLPROPERTIES(
'storage_handler' = 'com.cloudera.kudu.hive.KuduStorageHandler',
'kudu.table_name' = 'cust_behavior',
'kudu.master_addresses' = 'kudu-master.example.com:7051',
'kudu.key_columns' = 'id, sku'
);</code></pre>
</div>
</div>
<div class="paragraph">
<p>The example creates 16 buckets. You could also use <code>HASH (id, sku) INTO 16 BUCKETS</code>.
However, a scan for <code>sku</code> values would almost always impact all 16 buckets, rather
than possibly being limited to 4.</p>
</div>
</div>
<div class="sect3">
<h4 id="partitioning_rules_of_thumb"><a class="link" href="#partitioning_rules_of_thumb">Partitioning Rules of Thumb</a></h4>
<div class="ulist">
<ul>
<li>
<p>For large tables, such as fact tables, aim for as many tablets as you have
cores in the cluster.</p>
</li>
<li>
<p>For small tables, such as dimension tables, aim for a large enough number of tablets
that each tablet is at least 1 GB in size.</p>
</li>
</ul>
</div>
<div class="paragraph">
<p>In general, be mindful the number of tablets limits the parallelism of reads,
in the current implementation. Increasing the number of tablets significantly
beyond the number of cores is likely to have diminishing returns.</p>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_inserting_data_into_kudu_tables"><a class="link" href="#_inserting_data_into_kudu_tables">Inserting Data Into Kudu Tables</a></h3>
<div class="paragraph">
<p>Impala allows you to use standard SQL syntax to insert data into Kudu.</p>
</div>
<div class="sect3">
<h4 id="_inserting_single_values"><a class="link" href="#_inserting_single_values">Inserting Single Values</a></h4>
<div class="paragraph">
<p>This example inserts a single row.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">INSERT INTO my_first_table VALUES (99, "sarah");</code></pre>
</div>
</div>
<div class="paragraph">
<p>This example inserts three rows using a single statement.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">INSERT INTO my_first_table VALUES (1, "john"), (2, "jane"), (3, "jim");</code></pre>
</div>
</div>
</div>
<div class="sect3">
<h4 id="kudu_impala_insert_bulk"><a class="link" href="#kudu_impala_insert_bulk">Inserting In Bulk</a></h4>
<div class="paragraph">
<p>When inserting in bulk, there are at least three common choices. Each may have advantages
and disadvantages, depending on your data and circumstances.</p>
</div>
<div class="dlist">
<dl>
<dt class="hdlist1">Multiple single <code>INSERT</code> statements</dt>
<dd>
<p>This approach has the advantage of being easy to
understand and implement. This approach is likely to be inefficient because Impala
has a high query start-up cost compared to Kudu&#8217;s insertion performance. This will
lead to relatively high latency and poor throughput.</p>
</dd>
<dt class="hdlist1">Single <code>INSERT</code> statement with multiple <code>VALUES</code></dt>
<dd>
<p>If you include more
than 1024 <code>VALUES</code> statements, Impala batches them into groups of 1024 (or the value
of <code>batch_size</code>) before sending the requests to Kudu. This approach may perform
slightly better than multiple sequential <code>INSERT</code> statements by amortizing the query start-up
penalties on the Impala side. To set the batch size for the current Impala
Shell session, use the following syntax: <code>set batch_size=10000;</code></p>
<div class="admonitionblock note">
<table>
<tr>
<td class="icon">
<i class="fa icon-note" title="Note"></i>
</td>
<td class="content">
Increasing the Impala batch size causes Impala to use more memory. You should
verify the impact on your cluster and tune accordingly.
</td>
</tr>
</table>
</div>
</dd>
<dt class="hdlist1">Batch Insert</dt>
<dd>
<p>The approach that usually performs best, from the standpoint of
both Impala and Kudu, is usually to import the data using a <code>SELECT FROM</code> statement
in Impala.</p>
<div class="olist arabic">
<ol class="arabic">
<li>
<p>If your data is not already in Impala, one strategy is to
<a href="http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_txtfile.html">import it from a text file</a>,
such as a TSV or CSV file.</p>
</li>
<li>
<p><a href="#kudu_impala_create_table">Create the Kudu table</a>, being mindful that the columns
designated as primary keys cannot have null values.</p>
</li>
<li>
<p>Insert values into the Kudu table by querying the table containing the original
data, as in the following example:</p>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">INSERT INTO my_kudu_table
SELECT * FROM legacy_data_import_table;</code></pre>
</div>
</div>
</li>
</ol>
</div>
</dd>
<dt class="hdlist1">Ingest using the C++ or Java API</dt>
<dd>
<p>In many cases, the appropriate ingest path is to
use the C++ or Java API to insert directly into Kudu tables. Unlike other Impala tables,
data inserted into Kudu tables via the API becomes available for query in Impala without
the need for any <code>INVALIDATE METADATA</code> statements or other statements needed for other
Impala storage types.</p>
</dd>
</dl>
</div>
</div>
<div class="sect3">
<h4 id="insert_ignore"><a class="link" href="#insert_ignore"><code>INSERT</code> and the <code>IGNORE</code> Keyword</a></h4>
<div class="paragraph">
<p>Normally, if you try to insert a row that has already been inserted, the insertion
will fail because the primary key would be duplicated. See <a href="#impala_insertion_caveat">Failures During <code>INSERT</code>, <code>UPDATE</code>, and <code>DELETE</code> Operations</a>.
If an insert fails part of the way through, you can re-run the insert, using the
<code>IGNORE</code> keyword, which will ignore only those errors returned from Kudu indicating
a duplicate key..</p>
</div>
<div class="paragraph">
<p>The first example will cause an error if a row with the primary key <code>99</code> already exists.
The second example will still not insert the row, but will ignore any error and continue
on to the next SQL statement.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">INSERT INTO my_first_table VALUES (99, "sarah");
INSERT IGNORE INTO my_first_table VALUES (99, "sarah");</code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_updating_a_row"><a class="link" href="#_updating_a_row">Updating a Row</a></h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">UPDATE my_first_table SET name="bob" where id = 3;</code></pre>
</div>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
The <code>UPDATE</code> statement only works in Impala when the target table is in
Kudu.
</td>
</tr>
</table>
</div>
<div class="sect3">
<h4 id="_updating_in_bulk"><a class="link" href="#_updating_in_bulk">Updating In Bulk</a></h4>
<div class="paragraph">
<p>You can update in bulk using the same approaches outlined in
<a href="#kudu_impala_insert_bulk">Inserting In Bulk</a>.</p>
</div>
</div>
<div class="sect3">
<h4 id="__code_update_code_and_the_code_ignore_code_keyword"><a class="link" href="#__code_update_code_and_the_code_ignore_code_keyword"><code>UPDATE</code> and the <code>IGNORE</code> Keyword</a></h4>
<div class="paragraph">
<p>Similarly to <a href="#insert_ignore"><code>INSERT</code> and the <code>IGNORE</code> Keyword</a>, you can use the <code>IGNORE</code> operation to ignore an <code>UPDATE</code>
which would otherwise fail. For instance, a row may be deleted while you are
attempting to update it. In Impala, this would cause an error. The <code>IGNORE</code>
keyword causes the error to be ignored.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">UPDATE IGNORE my_first_table SET name="bob" where id = 3;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_deleting_a_row"><a class="link" href="#_deleting_a_row">Deleting a Row</a></h3>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">DELETE FROM my_first_table WHERE id &lt; 3;</code></pre>
</div>
</div>
<div class="paragraph">
<p>You can also delete using more complex syntax. A comma in the <code>FROM</code> sub-clause is
one way that Impala specifies a join query. For more information about Impala joins,
see <a href="http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_joins.html" class="bare">http://www.cloudera.com/content/cloudera/en/documentation/core/latest/topics/impala_joins.html</a>.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">DELETE c FROM my_second_table c, stock_symbols s WHERE c.name = s.symbol;</code></pre>
</div>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
The <code>DELETE</code> statement only works in Impala when the target table is in
Kudu.
</td>
</tr>
</table>
</div>
<div class="sect3">
<h4 id="_deleting_in_bulk"><a class="link" href="#_deleting_in_bulk">Deleting In Bulk</a></h4>
<div class="paragraph">
<p>You can delete in bulk using the same approaches outlined in
<a href="#kudu_impala_insert_bulk">Inserting In Bulk</a>.</p>
</div>
</div>
<div class="sect3">
<h4 id="__code_delete_code_and_the_code_ignore_code_keyword"><a class="link" href="#__code_delete_code_and_the_code_ignore_code_keyword"><code>DELETE</code> and the <code>IGNORE</code> Keyword</a></h4>
<div class="paragraph">
<p>Similarly to <a href="#insert_ignore"><code>INSERT</code> and the <code>IGNORE</code> Keyword</a>, you can use the <code>IGNORE</code> operation to ignore an <code>DELETE</code>
which would otherwise fail. For instance, a row may be deleted by another process
while you are attempting to delete it. In Impala, this would cause an error. The
<code>IGNORE</code> keyword causes the error to be ignored.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">DELETE IGNORE FROM my_first_table WHERE id &lt; 3;</code></pre>
</div>
</div>
</div>
</div>
<div class="sect2">
<h3 id="impala_insertion_caveat"><a class="link" href="#impala_insertion_caveat">Failures During <code>INSERT</code>, <code>UPDATE</code>, and <code>DELETE</code> Operations</a></h3>
<div class="paragraph">
<p><code>INSERT</code>, <code>UPDATE</code>, and <code>DELETE</code> statements cannot be considered transactional as
a whole. If one of these operations fails part of the way through, the keys may
have already been created (in the case of <code>INSERT</code>) or the records may have already
been modified or removed by another process (in the case of <code>UPDATE</code> or <code>DELETE</code>).
You should design your application with this in mind. See <a href="#insert_ignore"><code>INSERT</code> and the <code>IGNORE</code> Keyword</a>.</p>
</div>
</div>
<div class="sect2">
<h3 id="_altering_table_properties"><a class="link" href="#_altering_table_properties">Altering Table Properties</a></h3>
<div class="paragraph">
<p>You can change Impala&#8217;s metadata relating to a given Kudu table by altering the table&#8217;s
properties. These properties include the table name, the list of Kudu master addresses,
and whether the table is managed by Impala (internal) or externally. You cannot modify
a table&#8217;s split rows after table creation.</p>
</div>
<div class="admonitionblock important">
<table>
<tr>
<td class="icon">
<i class="fa icon-important" title="Important"></i>
</td>
<td class="content">
Altering table properties only changes Impala&#8217;s metadata about the table,
not the underlying table itself. These statements do not modify any table metadata
in Kudu.
</td>
</tr>
</table>
</div>
<div class="listingblock">
<div class="title">Rename a Table</div>
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">ALTER TABLE my_table RENAME TO my_new_table;</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">Change the Kudu Master Address</div>
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">ALTER TABLE my_table
SET TBLPROPERTIES('kudu.master_addresses' = 'kudu-new-master.example.com:7051');</code></pre>
</div>
</div>
<div class="listingblock">
<div class="title">Change an Internally-Managed Table to External</div>
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">ALTER TABLE my_table SET TBLPROPERTIES('EXTERNAL' = 'TRUE');</code></pre>
</div>
</div>
</div>
<div class="sect2">
<h3 id="_dropping_a_kudu_table_using_impala"><a class="link" href="#_dropping_a_kudu_table_using_impala">Dropping a Kudu Table Using Impala</a></h3>
<div class="paragraph">
<p>If the table was created as an internal table in Impala, using <code>CREATE TABLE</code>, the
standard <code>DROP TABLE</code> syntax drops the underlying Kudu table and all its data. If
the table was created as an external table, using <code>CREATE EXTERNAL TABLE</code>, the mapping
between Impala and Kudu is dropped, but the Kudu table is left intact, with all its
data.</p>
</div>
<div class="listingblock">
<div class="content">
<pre class="highlight"><code class="language-sql" data-lang="sql">DROP TABLE my_first_table;</code></pre>
</div>
</div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_what_s_next"><a class="link" href="#_what_s_next">What&#8217;s Next?</a></h2>
<div class="sectionbody">
<div class="paragraph">
<p>The examples above have only explored a fraction of what you can do with Impala Shell.</p>
</div>
<div class="ulist">
<ul>
<li>
<p>Learn about the <a href="http://impala.io">Impala project</a>.</p>
</li>
<li>
<p>Read the <a href="http://www.cloudera.com/content/www/en-us/documentation/enterprise/latest/topics/impala.html">Impala documentation</a>.</p>
</li>
<li>
<p>View the <a href="http://www.cloudera.com/content/www/en-us/documentation/enterprise/latest/topics/impala_langref.html">Impala SQL reference</a>.</p>
</li>
<li>
<p>Read about Impala internals or learn how to contribute to Impala on the <a href="https://github.com/cloudera/Impala/wiki">Impala Wiki</a>.</p>
</li>
<li>
<p>Read about the native <a href="installation.html#view_api">Kudu APIs</a>.</p>
</li>
</ul>
</div>
</div>
</div>
</div>
<div id="footer">
<div id="footer-text">
Last updated 2016-09-22 11:48:23 EDT
</div>
</div>
</body>
</html>