blob: cff762533e196bbe1c1fc584177513bb2a0dd281 [file] [log] [blame]
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<title>Developing the Avatica Go Client</title>
<meta name="viewport" content="width=device-width,initial-scale=1">
<meta name="generator" content="Jekyll v3.7.3">
<link rel="stylesheet" href="//fonts.googleapis.com/css?family=Lato:300,300italic,400,400italic,700,700italic,900">
<link rel="stylesheet" href="/avatica/css/screen.css">
<link rel="icon" type="image/x-icon" href="/avatica/favicon.ico">
<!--[if lt IE 9]>
<script src="/js/html5shiv.min.js"></script>
<script src="/js/respond.min.js"></script>
<![endif]-->
</head>
<body class="wrap">
<header role="banner">
<nav class="mobile-nav show-on-mobiles">
<ul>
<li class="">
<a href="/avatica/">Home</a>
</li>
<li class="">
<a href="/avatica/downloads/">Download</a>
</li>
<li class="">
<a href="/avatica/community/">Community</a>
</li>
<li class="current">
<a href="/avatica/develop/">Develop</a>
</li>
<li class="">
<a href="/avatica/news/">News</a>
</li>
<li class="">
<a href="/avatica/docs/">Docs</a>
</li>
</ul>
</nav>
<div class="grid">
<div class="unit one-third center-on-mobiles">
<h1>
<a href="/avatica/">
<span class="sr-only">Apache Calcite Avatica</span>
<img src="/avatica/img/logo.png" width="226" height="140" alt="Calcite Logo">
</a>
</h1>
</div>
<nav class="main-nav unit two-thirds hide-on-mobiles">
<ul>
<li class="">
<a href="/avatica/">Home</a>
</li>
<li class="">
<a href="/avatica/downloads/">Download</a>
</li>
<li class="">
<a href="/avatica/community/">Community</a>
</li>
<li class="current">
<a href="/avatica/develop/">Develop</a>
</li>
<li class="">
<a href="/avatica/news/">News</a>
</li>
<li class="">
<a href="/avatica/docs/">Docs</a>
</li>
</ul>
</nav>
</div>
</header>
<section class="standalone">
<div class="grid">
<div class="unit whole">
<article>
<h1>Developing the Avatica Go Client</h1>
<!--
-->
<ul id="markdown-toc">
<li><a href="#issues" id="markdown-toc-issues">Issues</a></li>
<li><a href="#updating-protobuf-definitions" id="markdown-toc-updating-protobuf-definitions">Updating protobuf definitions</a></li>
<li><a href="#live-reload-during-development" id="markdown-toc-live-reload-during-development">Live reload during development</a> <ul>
<li><a href="#set-up" id="markdown-toc-set-up">Set up</a></li>
</ul>
</li>
<li><a href="#testing" id="markdown-toc-testing">Testing</a> <ul>
<li><a href="#easy-way" id="markdown-toc-easy-way">Easy way</a></li>
<li><a href="#manual-set-up" id="markdown-toc-manual-set-up">Manual set up</a></li>
</ul>
</li>
</ul>
<h2 id="issues">Issues</h2>
<p>To file issues, please use the <a href="https://issues.apache.org/jira/projects/CALCITE/issues">Calcite JIRA</a> and select <code class="highlighter-rouge">avatica-go</code>
as the component.</p>
<h2 id="updating-protobuf-definitions">Updating protobuf definitions</h2>
<ol>
<li>Install <a href="https://docs.docker.com/install/">docker</a> and <a href="https://docs.docker.com/compose/install/">docker-compose</a>.</li>
<li>From the root of the repository, run <code class="highlighter-rouge">docker-compose run compile-protobuf</code></li>
</ol>
<h2 id="live-reload-during-development">Live reload during development</h2>
<p>It is possible to reload the code in real-time during development. This executes the test suite every time a <code class="highlighter-rouge">.go</code> or
<code class="highlighter-rouge">.mod</code> file is updated. The test suite takes a while to run, so the tests will not complete instantly, but live-reloading
during development allows us to not have to manually execute the test suite on save.</p>
<h3 id="set-up">Set up</h3>
<ol>
<li>
<p>Install <a href="https://docs.docker.com/install/">docker</a> and <a href="https://docs.docker.com/compose/install/">docker-compose</a>.</p>
</li>
<li>
<p>From the root of the repository, run <code class="highlighter-rouge">docker-compose run dev</code>.</p>
</li>
<li>
<p>After terminating the container, stop all the containers and remove them using: <code class="highlighter-rouge">docker-compose down</code></p>
</li>
</ol>
<h2 id="testing">Testing</h2>
<p>The test suite takes around 4 minutes to run if you run both the Avatica HSQLDB and Apache Phoenix tests.</p>
<h3 id="easy-way">Easy way</h3>
<ol>
<li>
<p>Install <a href="https://docs.docker.com/install/">docker</a> and <a href="https://docs.docker.com/compose/install/">docker-compose</a>.</p>
</li>
<li>
<p>From the root of the repository, run <code class="highlighter-rouge">docker-compose run test</code>.</p>
</li>
<li>
<p>After the tests complete, stop all the containers and remove them using: <code class="highlighter-rouge">docker-compose down</code></p>
</li>
</ol>
<h3 id="manual-set-up">Manual set up</h3>
<ol>
<li>Install <a href="https://golang.org/doc/install">Go</a>.</li>
</ol>
<p>For Go 1.10 and below, install the dependencies (skip these steps if using Go 1.11 and above):
1a. Install <a href="https://github.com/golang/dep">dep</a>: <code class="highlighter-rouge">go get -u github.com/golang/dep/cmd/dep</code></p>
<p>1b. Install dependencies by running <code class="highlighter-rouge">dep ensure -v</code> from the root of the repository.</p>
<ol>
<li>The test suite requires access to an instance of Avatica running HSQLDB and an instance of Apache Phoenix running the
Phoenix Query Server.</li>
</ol>
<p>You should then set the <code class="highlighter-rouge">HSQLDB_HOST</code> and <code class="highlighter-rouge">PHOENIX_HOST</code> environment variables. For example:</p>
<figure class="highlight"><pre><code class="language-shell" data-lang="shell">HSQLDB_HOST: http://hsqldb:8765
PHOENIX_HOST: http://phoenix:8765</code></pre></figure>
<ol>
<li>
<p>To select the test suite, export <code class="highlighter-rouge">AVATICA_FLAVOR=HSQLDB</code> for Avatica HSQLDB or <code class="highlighter-rouge">AVATICA_FLAVOR=PHOENIX</code> for Phoenix.</p>
</li>
<li>
<p>Then run <code class="highlighter-rouge">go test -v ./...</code> from the root of the repository to execute the test suite.</p>
</li>
</ol>
</article>
</div>
<div class="clear"></div>
</div>
</section>
<footer role="contentinfo">
<div id="poweredby">
<a href="http://www.apache.org/">
<span class="sr-only">Apache</span>
<img src="/avatica/img/feather.png" width="190" height="77" alt="Apache Logo"></a>
</div>
<div id="copyright">
<p>The contents of this website are &copy;&nbsp;2019
<a href="https://www.apache.org/">Apache Software Foundation</a>
under the terms of
the <a href="https://www.apache.org/licenses/LICENSE-2.0.html">
Apache&nbsp;License&nbsp;v2</a>. Apache Calcite and its logo are
trademarks of the Apache Software Foundation.</p>
</div>
</footer>
<script>
var anchorForId = function (id) {
var anchor = document.createElement("a");
anchor.className = "header-link";
anchor.href = "#" + id;
anchor.innerHTML = "<span class=\"sr-only\">Permalink</span><i class=\"fa fa-link\"></i>";
anchor.title = "Permalink";
return anchor;
};
var linkifyAnchors = function (level, containingElement) {
var headers = containingElement.getElementsByTagName("h" + level);
for (var h = 0; h < headers.length; h++) {
var header = headers[h];
if (typeof header.id !== "undefined" && header.id !== "") {
header.appendChild(anchorForId(header.id));
}
}
};
document.onreadystatechange = function () {
if (this.readyState === "complete") {
var contentBlock = document.getElementsByClassName("docs")[0] || document.getElementsByClassName("news")[0];
if (!contentBlock) {
return;
}
for (var level = 1; level <= 6; level++) {
linkifyAnchors(level, contentBlock);
}
}
};
</script>
</body>
</html>