Modified: cassandra/site/publish/doc/4.0/cql/functions.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/functions.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/functions.html (original) +++ cassandra/site/publish/doc/4.0/cql/functions.html Tue May 16 02:01:22 2017 @@ -30,7 +30,7 @@ <link rel="stylesheet" href="./../../../css/sphinx.css"> - <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="The Cassandra Query Language (CQL)" href="index.html"/> <link rel="next" title="JSON Support" href="json.html"/> <link rel="prev" title="Security" href="security.html"/> + <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="The Cassandra Query Language (CQL)" href="index.html"/> <link rel="next" title="Arithmetic Operators" href="operators.html"/> <link rel="prev" title="Security" href="security.html"/> </head> <body> @@ -140,6 +140,7 @@ <li class="toctree-l3"><a class="reference internal" href="#aggregate-functions">Aggregate functions</a></li> </ul> </li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -150,7 +151,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> @@ -306,13 +307,14 @@ the partitioner in use:</p> <span id="id3"></span><h4>Timeuuid functions<a class="headerlink" href="#timeuuid-functions" title="Permalink to this headline">¶</a></h4> <div class="section" id="now"> <h5><code class="docutils literal"><span class="pre">now</span></code><a class="headerlink" href="#now" title="Permalink to this headline">¶</a></h5> -<p>The <code class="docutils literal"><span class="pre">now</span></code> function takes no arguments and generates, on the coordinator node, a new unique timeuuid (at the time where -the statement using it is executed). Note that this method is useful for insertion but is largely non-sensical in +<p>The <code class="docutils literal"><span class="pre">now</span></code> function takes no arguments and generates, on the coordinator node, a new unique timeuuid at the +time the function is invoked. Note that this method is useful for insertion but is largely non-sensical in <code class="docutils literal"><span class="pre">WHERE</span></code> clauses. For instance, a query of the form:</p> <div class="highlight-cql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">myTable</span> <span class="k">WHERE</span> <span class="n">t</span> <span class="o">=</span> <span class="n">now</span><span class="p">()</span> </pre></div> </div> <p>will never return any result by design, since the value returned by <code class="docutils literal"><span class="pre">now()</span></code> is guaranteed to be unique.</p> +<p><code class="docutils literal"><span class="pre">currentTimeUUID</span></code> is an alias of <code class="docutils literal"><span class="pre">now</span></code>.</p> </div> <div class="section" id="mintimeuuid-and-maxtimeuuid"> <h5><code class="docutils literal"><span class="pre">minTimeuuid</span></code> and <code class="docutils literal"><span class="pre">maxTimeuuid</span></code><a class="headerlink" href="#mintimeuuid-and-maxtimeuuid" title="Permalink to this headline">¶</a></h5> @@ -337,8 +339,43 @@ for querying (as in the example above). </div> </div> </div> +<div class="section" id="datetime-functions"> +<h4>Datetime functions<a class="headerlink" href="#datetime-functions" title="Permalink to this headline">¶</a></h4> +<div class="section" id="retrieving-the-current-date-time"> +<h5>Retrieving the current date/time<a class="headerlink" href="#retrieving-the-current-date-time" title="Permalink to this headline">¶</a></h5> +<p>The following functions can be used to retrieve the date/time at the time where the function is invoked:</p> +<table border="1" class="docutils"> +<colgroup> +<col width="58%" /> +<col width="42%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Function name</th> +<th class="head">Output type</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">currentTimestamp</span></code></td> +<td><code class="docutils literal"><span class="pre">timestamp</span></code></td> +</tr> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">currentDate</span></code></td> +<td><code class="docutils literal"><span class="pre">date</span></code></td> +</tr> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">currentTime</span></code></td> +<td><code class="docutils literal"><span class="pre">time</span></code></td> +</tr> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">currentTimeUUID</span></code></td> +<td><code class="docutils literal"><span class="pre">timeUUID</span></code></td> +</tr> +</tbody> +</table> +<p>For example the last 2 days of data can be retrieved using:</p> +<div class="highlight-cql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">myTable</span> <span class="k">WHERE</span> <span class="nb">date</span> <span class="o">>=</span> <span class="n">currentDate</span><span class="p">()</span> <span class="o">-</span> <span class="mf">2</span><span class="n">d</span> +</pre></div> +</div> +</div> <div class="section" id="time-conversion-functions"> -<h4>Time conversion functions<a class="headerlink" href="#time-conversion-functions" title="Permalink to this headline">¶</a></h4> +<h5>Time conversion functions<a class="headerlink" href="#time-conversion-functions" title="Permalink to this headline">¶</a></h5> <p>A number of functions are provided to âconvertâ a <code class="docutils literal"><span class="pre">timeuuid</span></code>, a <code class="docutils literal"><span class="pre">timestamp</span></code> or a <code class="docutils literal"><span class="pre">date</span></code> into another <code class="docutils literal"><span class="pre">native</span></code> type.</p> <table border="1" class="docutils"> @@ -393,6 +430,7 @@ type.</p> </tbody> </table> </div> +</div> <div class="section" id="blob-conversion-functions"> <h4>Blob conversion functions<a class="headerlink" href="#blob-conversion-functions" title="Permalink to this headline">¶</a></h4> <p>A number of functions are provided to âconvertâ the native types into binary data (<code class="docutils literal"><span class="pre">blob</span></code>). For every @@ -720,7 +758,7 @@ function with the signature does not exi <div class="doc-prev-next-links" role="navigation" aria-label="footer navigation"> - <a href="json.html" class="btn btn-default pull-right " role="button" title="JSON Support" accesskey="n">Next <span class="glyphicon glyphicon-circle-arrow-right" aria-hidden="true"></span></a> + <a href="operators.html" class="btn btn-default pull-right " role="button" title="Arithmetic Operators" accesskey="n">Next <span class="glyphicon glyphicon-circle-arrow-right" aria-hidden="true"></span></a> <a href="security.html" class="btn btn-default" role="button" title="Security" accesskey="p"><span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Previous</a>
Modified: cassandra/site/publish/doc/4.0/cql/index.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/index.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/index.html (original) +++ cassandra/site/publish/doc/4.0/cql/index.html Tue May 16 02:01:22 2017 @@ -134,6 +134,7 @@ <li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -144,7 +145,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> @@ -166,8 +167,7 @@ the languages. However, the <a class="reference external" href="#changes">changes</a> section provides the diff between the different versions of CQL.</p> <p>CQL offers a model close to SQL in the sense that data is put in <em>tables</em> containing <em>rows</em> of <em>columns</em>. For that reason, when used in this document, these terms (tables, rows and columns) have the same definition than they have -in SQL. But please note that as such, they do <strong>not</strong> refer to the concept of rows and columns found in the deprecated -thrift API (and earlier version 1 and 2 of CQL).</p> +in SQL.</p> <div class="toctree-wrapper compound"> <ul> <li class="toctree-l1"><a class="reference internal" href="definitions.html">Definitions</a><ul> @@ -185,6 +185,7 @@ thrift API (and earlier version 1 and 2 <li class="toctree-l2"><a class="reference internal" href="types.html#working-with-timestamps">Working with timestamps</a></li> <li class="toctree-l2"><a class="reference internal" href="types.html#working-with-dates">Working with dates</a></li> <li class="toctree-l2"><a class="reference internal" href="types.html#working-with-times">Working with times</a></li> +<li class="toctree-l2"><a class="reference internal" href="types.html#working-with-durations">Working with durations</a></li> <li class="toctree-l2"><a class="reference internal" href="types.html#collections">Collections</a></li> <li class="toctree-l2"><a class="reference internal" href="types.html#user-defined-types">User-Defined Types</a></li> <li class="toctree-l2"><a class="reference internal" href="types.html#tuples">Tuples</a></li> @@ -233,6 +234,11 @@ thrift API (and earlier version 1 and 2 <li class="toctree-l2"><a class="reference internal" href="functions.html#aggregate-functions">Aggregate functions</a></li> </ul> </li> +<li class="toctree-l1"><a class="reference internal" href="operators.html">Arithmetic Operators</a><ul> +<li class="toctree-l2"><a class="reference internal" href="operators.html#id2">Number Arithmetic</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html#id4">Datetime Arithmetic</a></li> +</ul> +</li> <li class="toctree-l1"><a class="reference internal" href="json.html">JSON Support</a><ul> <li class="toctree-l2"><a class="reference internal" href="json.html#select-json">SELECT JSON</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html#insert-json">INSERT JSON</a></li> @@ -252,26 +258,28 @@ thrift API (and earlier version 1 and 2 </ul> </li> <li class="toctree-l1"><a class="reference internal" href="changes.html">Changes</a><ul> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id1">3.4.3</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id2">3.4.2</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id3">3.4.1</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id4">3.4.0</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id5">3.3.1</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id6">3.3.0</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id7">3.2.0</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id8">3.1.7</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id9">3.1.6</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id10">3.1.5</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id11">3.1.4</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id12">3.1.3</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id13">3.1.2</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id14">3.1.1</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id15">3.1.0</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id16">3.0.5</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id17">3.0.4</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id18">3.0.3</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id19">3.0.2</a></li> -<li class="toctree-l2"><a class="reference internal" href="changes.html#id20">3.0.1</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id1">3.4.5</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id2">3.4.4</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id3">3.4.3</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id6">3.4.2</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id7">3.4.1</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id8">3.4.0</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id9">3.3.1</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id10">3.3.0</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id11">3.2.0</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id12">3.1.7</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id13">3.1.6</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id14">3.1.5</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id15">3.1.4</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id16">3.1.3</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id17">3.1.2</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id18">3.1.1</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id19">3.1.0</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id20">3.0.5</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id21">3.0.4</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id22">3.0.3</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id23">3.0.2</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html#id24">3.0.1</a></li> <li class="toctree-l2"><a class="reference internal" href="changes.html#versioning">Versioning</a></li> </ul> </li> Modified: cassandra/site/publish/doc/4.0/cql/indexes.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/indexes.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/indexes.html (original) +++ cassandra/site/publish/doc/4.0/cql/indexes.html Tue May 16 02:01:22 2017 @@ -140,6 +140,7 @@ <li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -150,7 +151,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> Modified: cassandra/site/publish/doc/4.0/cql/json.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/json.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/json.html (original) +++ cassandra/site/publish/doc/4.0/cql/json.html Tue May 16 02:01:22 2017 @@ -30,7 +30,7 @@ <link rel="stylesheet" href="./../../../css/sphinx.css"> - <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="The Cassandra Query Language (CQL)" href="index.html"/> <link rel="next" title="Triggers" href="triggers.html"/> <link rel="prev" title="Functions" href="functions.html"/> + <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="The Cassandra Query Language (CQL)" href="index.html"/> <link rel="next" title="Triggers" href="triggers.html"/> <link rel="prev" title="Arithmetic Operators" href="operators.html"/> </head> <body> @@ -136,6 +136,7 @@ <li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">JSON Support</a><ul> <li class="toctree-l3"><a class="reference internal" href="#select-json">SELECT JSON</a></li> <li class="toctree-l3"><a class="reference internal" href="#insert-json">INSERT JSON</a></li> @@ -153,7 +154,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> @@ -372,7 +373,7 @@ in the selection clause of a <code class <a href="triggers.html" class="btn btn-default pull-right " role="button" title="Triggers" accesskey="n">Next <span class="glyphicon glyphicon-circle-arrow-right" aria-hidden="true"></span></a> - <a href="functions.html" class="btn btn-default" role="button" title="Functions" accesskey="p"><span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Previous</a> + <a href="operators.html" class="btn btn-default" role="button" title="Arithmetic Operators" accesskey="p"><span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Previous</a> </div> Modified: cassandra/site/publish/doc/4.0/cql/mvs.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/mvs.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/mvs.html (original) +++ cassandra/site/publish/doc/4.0/cql/mvs.html Tue May 16 02:01:22 2017 @@ -141,6 +141,7 @@ </li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -151,7 +152,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> Added: cassandra/site/publish/doc/4.0/cql/operators.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/operators.html?rev=1795259&view=auto ============================================================================== --- cassandra/site/publish/doc/4.0/cql/operators.html (added) +++ cassandra/site/publish/doc/4.0/cql/operators.html Tue May 16 02:01:22 2017 @@ -0,0 +1,451 @@ +<!DOCTYPE html> +<html> + + + + + + + + + + +<head> + <meta charset="utf-8"> + <meta http-equiv="X-UA-Compatible" content="IE=edge"> + <meta name="viewport" content="width=device-width, initial-scale=1"> + <meta name="description" content="The Apache Cassandra database is the right choice when you need scalability and high availability without compromising performance. Linear scalability and proven fault-tolerance on commodity hardware or cloud infrastructure make it the perfect platform for mission-critical data. Cassandra's support for replicating across multiple datacenters is best-in-class, providing lower latency for your users and the peace of mind of knowing that you can survive regional outages. +"> + <meta name="keywords" content="cassandra, apache, apache cassandra, distributed storage, key value store, scalability, bigtable, dynamo" /> + <meta name="robots" content="index,follow" /> + <meta name="language" content="en" /> + + <title>Documentation</title> + + <link rel="canonical" href="http://cassandra.apache.org/doc/4.0/cql/operators.html"> + + <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" integrity="sha384-1q8mTJOASx8j1Au+a5WDVnPi2lkFfwwEAa8hDDdjZlpLegxhjVME1fgjWPGmkzs7" crossorigin="anonymous"> + <link rel="stylesheet" href="./../../../css/style.css"> + + <link rel="stylesheet" href="./../../../css/sphinx.css"> + + + <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="The Cassandra Query Language (CQL)" href="index.html"/> <link rel="next" title="JSON Support" href="json.html"/> <link rel="prev" title="Functions" href="functions.html"/> +</head> + + <body> + <!-- breadcrumbs --> +<div class="topnav"> + <div class="container breadcrumb-container"> + <ul class="breadcrumb"> + <li> + <div class="dropdown"> + <img class="asf-logo" src="./../../../img/asf_feather.png" /> + <a data-toggle="dropdown" href="#">Apache Software Foundation <span class="caret"></span></a> + <ul class="dropdown-menu" role="menu" aria-labelledby="dLabel"> + <li><a href="http://www.apache.org">Apache Homepage</a></li> + <li><a href="http://www.apache.org/licenses/">License</a></li> + <li><a href="http://www.apache.org/foundation/sponsorship.html">Sponsorship</a></li> + <li><a href="http://www.apache.org/foundation/thanks.html">Thanks</a></li> + <li><a href="http://www.apache.org/security/">Security</a></li> + </ul> + </div> + </li> + + + <li><a href="./../../../">Apache Cassandra</a></li> + + + + + <li><a href="./../../../doc">Documentation</a></li> + + + + + <li><a href="./">The Cassandra Query Language (CQL)</a></li> + + + + <li>Arithmetic Operators</li> + + </ul> + </div> + + <!-- navbar --> + <nav class="navbar navbar-default navbar-static-top" role="navigation"> + <div class="container"> + <div class="navbar-header"> + <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#cassandra-menu" aria-expanded="false"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + <a class="navbar-brand" href="./../../../"><img src="./../../../img/cassandra_logo.png" alt="Apache Cassandra logo" /></a> + </div><!-- /.navbar-header --> + + <div id="cassandra-menu" class="collapse navbar-collapse"> + <ul class="nav navbar-nav navbar-right"> + <li><a href="./../../../">Home</a></li> + <li><a href="./../../../download/">Download</a></li> + <li><a href="./../../../doc/">Documentation</a></li> + <li><a href="./../../../community/">Community</a></li> + </ul> + </div><!-- /#cassandra-menu --> + + + </div> + </nav><!-- /.navbar --> +</div><!-- /.topnav --> + + <div class="container-fluid"> + <div class="row"> + <div class="col-md-2"> + <div class="doc-navigation"> + <div class="doc-menu" role="navigation"> + <div class="navbar-header"> + <button type="button" class="pull-left navbar-toggle" data-toggle="collapse" data-target=".sidebar-navbar-collapse"> + <span class="sr-only">Toggle navigation</span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + <span class="icon-bar"></span> + </button> + </div> + <div class="navbar-collapse collapse sidebar-navbar-collapse"> + <form id="doc-search-form" class="navbar-form" action="../search.html" method="get" role="search"> + <div class="form-group"> + <input type="text" size="30" class="form-control input-sm" name="q" placeholder="Search docs"> + <input type="hidden" name="check_keywords" value="yes" /> + <input type="hidden" name="area" value="default" /> + </div> + </form> + + + + <ul class="current"> +<li class="toctree-l1"><a class="reference internal" href="../getting_started/index.html">Getting Started</a></li> +<li class="toctree-l1"><a class="reference internal" href="../architecture/index.html">Architecture</a></li> +<li class="toctree-l1"><a class="reference internal" href="../data_modeling/index.html">Data Modeling</a></li> +<li class="toctree-l1 current"><a class="reference internal" href="index.html">The Cassandra Query Language (CQL)</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="definitions.html">Definitions</a></li> +<li class="toctree-l2"><a class="reference internal" href="types.html">Data Types</a></li> +<li class="toctree-l2"><a class="reference internal" href="ddl.html">Data Definition</a></li> +<li class="toctree-l2"><a class="reference internal" href="dml.html">Data Manipulation</a></li> +<li class="toctree-l2"><a class="reference internal" href="indexes.html">Secondary Indexes</a></li> +<li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> +<li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> +<li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2 current"><a class="current reference internal" href="#">Arithmetic Operators</a><ul> +<li class="toctree-l3"><a class="reference internal" href="#id2">Number Arithmetic</a></li> +<li class="toctree-l3"><a class="reference internal" href="#id4">Datetime Arithmetic</a></li> +</ul> +</li> +<li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> +<li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> +<li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> +<li class="toctree-l2"><a class="reference internal" href="changes.html">Changes</a></li> +</ul> +</li> +<li class="toctree-l1"><a class="reference internal" href="../configuration/index.html">Configuring Cassandra</a></li> +<li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> +<li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> +<li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> +<li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> +<li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> +<li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> +</ul> + + + + </div><!--/.nav-collapse --> + </div> + </div> + </div> + <div class="col-md-8"> + <div class="content doc-content"> + <div class="container"> + + <div class="section" id="datetime-arithmetic"> +<span id="number-arithmetic"></span><span id="arithmetic-operators"></span><span id="id1"></span><h1>Arithmetic Operators<a class="headerlink" href="#datetime-arithmetic" title="Permalink to this headline">¶</a></h1> +<p>CQL supports the following operators:</p> +<table border="1" class="docutils"> +<colgroup> +<col width="13%" /> +<col width="87%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">Operator</th> +<th class="head">Description</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td>- (unary)</td> +<td>Negates operand</td> +</tr> +<tr class="row-odd"><td>+</td> +<td>Addition</td> +</tr> +<tr class="row-even"><td>-</td> +<td>Substraction</td> +</tr> +<tr class="row-odd"><td>*</td> +<td>Multiplication</td> +</tr> +<tr class="row-even"><td>/</td> +<td>Division</td> +</tr> +<tr class="row-odd"><td>%</td> +<td>Returns the remainder of a division</td> +</tr> +</tbody> +</table> +<div class="section" id="id2"> +<span id="id3"></span><h2>Number Arithmetic<a class="headerlink" href="#id2" title="Permalink to this headline">¶</a></h2> +<p>All arithmetic operations are supported on numeric types or counters.</p> +<p>The return type of the operation will be based on the operand types:</p> +<table border="1" class="docutils"> +<colgroup> +<col width="13%" /> +<col width="11%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +<col width="10%" /> +</colgroup> +<thead valign="bottom"> +<tr class="row-odd"><th class="head">left/right</th> +<th class="head">tinyint</th> +<th class="head">smallint</th> +<th class="head">int</th> +<th class="head">bigint</th> +<th class="head">counter</th> +<th class="head">float</th> +<th class="head">double</th> +<th class="head">varint</th> +<th class="head">decimal</th> +</tr> +</thead> +<tbody valign="top"> +<tr class="row-even"><td><strong>tinyint</strong></td> +<td>tinyint</td> +<td>smallint</td> +<td>int</td> +<td>bigint</td> +<td>bigint</td> +<td>float</td> +<td>double</td> +<td>varint</td> +<td>decimal</td> +</tr> +<tr class="row-odd"><td><strong>smallint</strong></td> +<td>smallint</td> +<td>smallint</td> +<td>int</td> +<td>bigint</td> +<td>bigint</td> +<td>float</td> +<td>double</td> +<td>varint</td> +<td>decimal</td> +</tr> +<tr class="row-even"><td><strong>int</strong></td> +<td>int</td> +<td>int</td> +<td>int</td> +<td>bigint</td> +<td>bigint</td> +<td>float</td> +<td>double</td> +<td>varint</td> +<td>decimal</td> +</tr> +<tr class="row-odd"><td><strong>bigint</strong></td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>double</td> +<td>double</td> +<td>varint</td> +<td>decimal</td> +</tr> +<tr class="row-even"><td><strong>counter</strong></td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>bigint</td> +<td>double</td> +<td>double</td> +<td>varint</td> +<td>decimal</td> +</tr> +<tr class="row-odd"><td><strong>float</strong></td> +<td>float</td> +<td>float</td> +<td>float</td> +<td>double</td> +<td>double</td> +<td>float</td> +<td>double</td> +<td>decimal</td> +<td>decimal</td> +</tr> +<tr class="row-even"><td><strong>double</strong></td> +<td>double</td> +<td>double</td> +<td>double</td> +<td>double</td> +<td>double</td> +<td>double</td> +<td>double</td> +<td>decimal</td> +<td>decimal</td> +</tr> +<tr class="row-odd"><td><strong>varint</strong></td> +<td>varint</td> +<td>varint</td> +<td>varint</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +</tr> +<tr class="row-even"><td><strong>decimal</strong></td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +<td>decimal</td> +</tr> +</tbody> +</table> +<p><code class="docutils literal"><span class="pre">*</span></code>, <code class="docutils literal"><span class="pre">/</span></code> and <code class="docutils literal"><span class="pre">%</span></code> operators have a higher precedence level than <code class="docutils literal"><span class="pre">+</span></code> and <code class="docutils literal"><span class="pre">-</span></code> operator. By consequence, +they will be evaluated before. If two operator in an expression have the same precedence level, they will be evaluated +left to right based on their position in the expression.</p> +</div> +<div class="section" id="id4"> +<span id="id5"></span><h2>Datetime Arithmetic<a class="headerlink" href="#id4" title="Permalink to this headline">¶</a></h2> +<p>A <code class="docutils literal"><span class="pre">duration</span></code> can be added (+) or substracted (-) from a <code class="docutils literal"><span class="pre">timestamp</span></code> or a <code class="docutils literal"><span class="pre">date</span></code> to create a new +<code class="docutils literal"><span class="pre">timestamp</span></code> or <code class="docutils literal"><span class="pre">date</span></code>. So for instance:</p> +<div class="highlight-cql"><div class="highlight"><pre><span class="k">SELECT</span> <span class="o">*</span> <span class="k">FROM</span> <span class="n">myTable</span> <span class="k">WHERE</span> <span class="n">t</span> <span class="o">=</span> <span class="s1">'2017-01-01'</span> <span class="o">-</span> <span class="mf">2</span><span class="n">d</span> +</pre></div> +</div> +<p>will select all the records with a value of <code class="docutils literal"><span class="pre">t</span></code> which is in the last 2 days of 2016.</p> +</div> +</div> + + + + + <div class="doc-prev-next-links" role="navigation" aria-label="footer navigation"> + + <a href="json.html" class="btn btn-default pull-right " role="button" title="JSON Support" accesskey="n">Next <span class="glyphicon glyphicon-circle-arrow-right" aria-hidden="true"></span></a> + + + <a href="functions.html" class="btn btn-default" role="button" title="Functions" accesskey="p"><span class="glyphicon glyphicon-circle-arrow-left" aria-hidden="true"></span> Previous</a> + + </div> + + </div> + </div> + </div> + <div class="col-md-2"> + </div> + </div> +</div> + + <footer> + <div class="container"> + <div class="col-md-4 social-blk"> + <span class="social"> + <a href="https://twitter.com/cassandra" + class="twitter-follow-button" + data-show-count="false" data-size="large">Follow @cassandra</a> + <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> + <a href="https://twitter.com/intent/tweet?button_hashtag=cassandra" + class="twitter-hashtag-button" + data-size="large" + data-related="ApacheCassandra">Tweet #cassandra</a> + <script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');</script> + </span> + </div> + + <div class="col-md-8 trademark"> + <p>© 2016 <a href="http://apache.org">The Apache Software Foundation</a>. + Apache, the Apache feather logo, and Apache Cassandra are trademarks of The Apache Software Foundation. + <p> + </div> + </div><!-- /.container --> +</footer> + +<!-- Javascript. Placed here so pages load faster --> +<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script> +<script src="./../../../js/underscore-min.js"></script> +<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/js/bootstrap.min.js" integrity="sha384-0mSbJDEHialfmuBBQP6A4Qrprq5OVfW37PRR3j5ELqxss1yVqOtnepnHVP9aJ7xS" crossorigin="anonymous"></script> + + +<script src="./../../../js/doctools.js"></script> +<script src="./../../../js/searchtools.js"></script> + + <script type="text/javascript"> var DOCUMENTATION_OPTIONS = { URL_ROOT: "", VERSION: "", COLLAPSE_INDEX: false, FILE_SUFFIX: ".html", HAS_SOURCE: false, SOURCELINK_SUFFIX: "" }; </script> + +<script type="text/javascript"> +$(function() { + // Stick the #nav to the top of the window + var nav = $('.doc-navigation'); + var navHomeY = nav.offset().top; + var isFixed = false; + var $w = $(window); + $w.scroll(function() { + var scrollTop = $w.scrollTop(); + var shouldBeFixed = $w.width() > 991 && scrollTop >= navHomeY - 10; + if (shouldBeFixed && !isFixed) { + nav.css({ + position: 'fixed', + top: 0, + left: nav.offset().left, + width: nav.width(), + }); + nav.addClass('fixed-navigation'); + isFixed = true; + } + else if (!shouldBeFixed && isFixed) + { + nav.css({ + position: 'static' + }); + nav.removeClass('fixed-navigation'); + isFixed = false; + } + }); +}); +</script> + + +<script type="text/javascript"> + var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www."); + document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E")); + + try { + var pageTracker = _gat._getTracker("UA-11583863-1"); + pageTracker._trackPageview(); + } catch(err) {} +</script> + + + </body> +</html> Modified: cassandra/site/publish/doc/4.0/cql/security.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/security.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/security.html (original) +++ cassandra/site/publish/doc/4.0/cql/security.html Tue May 16 02:01:22 2017 @@ -141,6 +141,7 @@ </ul> </li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -151,7 +152,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> Modified: cassandra/site/publish/doc/4.0/cql/triggers.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/triggers.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/triggers.html (original) +++ cassandra/site/publish/doc/4.0/cql/triggers.html Tue May 16 02:01:22 2017 @@ -136,6 +136,7 @@ <li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2 current"><a class="current reference internal" href="#">Triggers</a><ul> <li class="toctree-l3"><a class="reference internal" href="#create-trigger">CREATE TRIGGER</a></li> @@ -150,7 +151,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> Modified: cassandra/site/publish/doc/4.0/cql/types.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/cql/types.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/cql/types.html (original) +++ cassandra/site/publish/doc/4.0/cql/types.html Tue May 16 02:01:22 2017 @@ -134,6 +134,7 @@ <li class="toctree-l3"><a class="reference internal" href="#working-with-timestamps">Working with timestamps</a></li> <li class="toctree-l3"><a class="reference internal" href="#working-with-dates">Working with dates</a></li> <li class="toctree-l3"><a class="reference internal" href="#working-with-times">Working with times</a></li> +<li class="toctree-l3"><a class="reference internal" href="#working-with-durations">Working with durations</a></li> <li class="toctree-l3"><a class="reference internal" href="#collections">Collections</a></li> <li class="toctree-l3"><a class="reference internal" href="#user-defined-types">User-Defined Types</a></li> <li class="toctree-l3"><a class="reference internal" href="#tuples">Tuples</a></li> @@ -146,6 +147,7 @@ <li class="toctree-l2"><a class="reference internal" href="mvs.html">Materialized Views</a></li> <li class="toctree-l2"><a class="reference internal" href="security.html">Security</a></li> <li class="toctree-l2"><a class="reference internal" href="functions.html">Functions</a></li> +<li class="toctree-l2"><a class="reference internal" href="operators.html">Arithmetic Operators</a></li> <li class="toctree-l2"><a class="reference internal" href="json.html">JSON Support</a></li> <li class="toctree-l2"><a class="reference internal" href="triggers.html">Triggers</a></li> <li class="toctree-l2"><a class="reference internal" href="appendices.html">Appendices</a></li> @@ -156,7 +158,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> @@ -192,6 +194,7 @@ types</span></a>:</p> | DATE | DECIMAL | DOUBLE + | DURATION | FLOAT | INET | INT @@ -254,58 +257,62 @@ types</span></a>:</p> <a class="reference internal" href="definitions.html#grammar-token-float"><code class="xref std std-token docutils literal"><span class="pre">float</span></code></a></td> <td>64-bit IEEE-754 floating point</td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">float</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">duration</span></code></td> +<td><code class="xref std std-token docutils literal"><span class="pre">duration</span></code>,</td> +<td>A duration with nanosecond precision. See <a class="reference internal" href="#durations"><span class="std std-ref">Working with durations</span></a> below for details</td> +</tr> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">float</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a>, <a class="reference internal" href="definitions.html#grammar-token-float"><code class="xref std std-token docutils literal"><span class="pre">float</span></code></a></td> <td>32-bit IEEE-754 floating point</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">inet</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">inet</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-string"><code class="xref std std-token docutils literal"><span class="pre">string</span></code></a></td> <td>An IP address, either IPv4 (4 bytes long) or IPv6 (16 bytes long). Note that there is no <code class="docutils literal"><span class="pre">inet</span></code> constant, IP address should be input as strings</td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">int</span></code></td> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">int</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a></td> <td>32-bit signed int</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">smallint</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">smallint</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a></td> <td>16-bit signed int</td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">text</span></code></td> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">text</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-string"><code class="xref std std-token docutils literal"><span class="pre">string</span></code></a></td> <td>UTF8 encoded string</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">time</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">time</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a>, <a class="reference internal" href="definitions.html#grammar-token-string"><code class="xref std std-token docutils literal"><span class="pre">string</span></code></a></td> <td>A time (with no corresponding date value) with nanosecond precision. See <a class="reference internal" href="#times"><span class="std std-ref">Working with times</span></a> below for details</td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">timestamp</span></code></td> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">timestamp</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a>, <a class="reference internal" href="definitions.html#grammar-token-string"><code class="xref std std-token docutils literal"><span class="pre">string</span></code></a></td> <td>A timestamp (date and time) with millisecond precision. See <a class="reference internal" href="#timestamps"><span class="std std-ref">Working with timestamps</span></a> below for details</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">timeuuid</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">timeuuid</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-uuid"><code class="xref std std-token docutils literal"><span class="pre">uuid</span></code></a></td> <td>Version 1 <a class="reference external" href="https://en.wikipedia.org/wiki/Universally_unique_identifier">UUID</a>, generally used as a âconflict-freeâ timestamp. Also see <a class="reference internal" href="functions.html#timeuuid-functions"><span class="std std-ref">Timeuuid functions</span></a></td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">tinyint</span></code></td> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">tinyint</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a></td> <td>8-bit signed int</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">uuid</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">uuid</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-uuid"><code class="xref std std-token docutils literal"><span class="pre">uuid</span></code></a></td> <td>A <a class="reference external" href="https://en.wikipedia.org/wiki/Universally_unique_identifier">UUID</a> (of any version)</td> </tr> -<tr class="row-even"><td><code class="docutils literal"><span class="pre">varchar</span></code></td> +<tr class="row-odd"><td><code class="docutils literal"><span class="pre">varchar</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-string"><code class="xref std std-token docutils literal"><span class="pre">string</span></code></a></td> <td>UTF8 encoded string</td> </tr> -<tr class="row-odd"><td><code class="docutils literal"><span class="pre">varint</span></code></td> +<tr class="row-even"><td><code class="docutils literal"><span class="pre">varint</span></code></td> <td><a class="reference internal" href="definitions.html#grammar-token-integer"><code class="xref std std-token docutils literal"><span class="pre">integer</span></code></a></td> <td>Arbitrary-precision integer</td> </tr> @@ -377,6 +384,50 @@ time:</p> <li><code class="docutils literal"><span class="pre">'08:12:54.123456789'</span></code></li> </ul> </div> +<div class="section" id="working-with-durations"> +<span id="durations"></span><h2>Working with durations<a class="headerlink" href="#working-with-durations" title="Permalink to this headline">¶</a></h2> +<p>Values of the <code class="docutils literal"><span class="pre">duration</span></code> type are encoded as 3 signed integer of variable lengths. The first integer represents the +number of months, the second the number of days and the third the number of nanoseconds. This is due to the fact that +the number of days in a month can change, and a day can have 23 or 25 hours depending on the daylight saving. +Internally, the number of months and days are decoded as 32 bits integers whereas the number of nanoseconds is decoded +as a 64 bits integer.</p> +<p>A duration can be input as:</p> +<blockquote> +<div><ol class="arabic"> +<li><p class="first"><code class="docutils literal"><span class="pre">(quantity</span> <span class="pre">unit)+</span></code> like <code class="docutils literal"><span class="pre">12h30m</span></code> where the unit can be:</p> +<blockquote> +<div><ul class="simple"> +<li><code class="docutils literal"><span class="pre">y</span></code>: years (12 months)</li> +<li><code class="docutils literal"><span class="pre">mo</span></code>: months (1 month)</li> +<li><code class="docutils literal"><span class="pre">w</span></code>: weeks (7 days)</li> +<li><code class="docutils literal"><span class="pre">d</span></code>: days (1 day)</li> +<li><code class="docutils literal"><span class="pre">h</span></code>: hours (3,600,000,000,000 nanoseconds)</li> +<li><code class="docutils literal"><span class="pre">m</span></code>: minutes (60,000,000,000 nanoseconds)</li> +<li><code class="docutils literal"><span class="pre">s</span></code>: seconds (1,000,000,000 nanoseconds)</li> +<li><code class="docutils literal"><span class="pre">ms</span></code>: milliseconds (1,000,000 nanoseconds)</li> +<li><code class="docutils literal"><span class="pre">us</span></code> or <code class="docutils literal"><span class="pre">µs</span></code> : microseconds (1000 nanoseconds)</li> +<li><code class="docutils literal"><span class="pre">ns</span></code>: nanoseconds (1 nanosecond)</li> +</ul> +</div></blockquote> +</li> +<li><p class="first">ISO 8601 format: <code class="docutils literal"><span class="pre">P[n]Y[n]M[n]DT[n]H[n]M[n]S</span> <span class="pre">or</span> <span class="pre">P[n]W</span></code></p> +</li> +<li><p class="first">ISO 8601 alternative format: <code class="docutils literal"><span class="pre">P[YYYY]-[MM]-[DD]T[hh]:[mm]:[ss]</span></code></p> +</li> +</ol> +</div></blockquote> +<p>For example:</p> +<div class="highlight-cql"><div class="highlight"><pre><span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">RiderResults</span> <span class="p">(</span><span class="n">rider</span><span class="p">,</span> <span class="n">race</span><span class="p">,</span> <span class="n">result</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="s1">'Christopher Froome'</span><span class="p">,</span> <span class="s1">'Tour de France'</span><span class="p">,</span> <span class="mf">89</span><span class="n">h4m48s</span><span class="p">);</span> +<span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">RiderResults</span> <span class="p">(</span><span class="n">rider</span><span class="p">,</span> <span class="n">race</span><span class="p">,</span> <span class="n">result</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="s1">'BARDET Romain'</span><span class="p">,</span> <span class="s1">'Tour de France'</span><span class="p">,</span> <span class="n">PT89H8M53S</span><span class="p">);</span> +<span class="k">INSERT</span> <span class="k">INTO</span> <span class="n">RiderResults</span> <span class="p">(</span><span class="n">rider</span><span class="p">,</span> <span class="n">race</span><span class="p">,</span> <span class="n">result</span><span class="p">)</span> <span class="k">VALUES</span> <span class="p">(</span><span class="s1">'QUINTANA Nairo'</span><span class="p">,</span> <span class="s1">'Tour de France'</span><span class="p">,</span> <span class="n">P0000</span><span class="o">-</span><span class="mf">00</span><span class="o">-</span><span class="mf">00</span><span class="n">T89</span><span class="p">:</span><span class="mf">09</span><span class="p">:</span><span class="mf">09</span><span class="p">);</span> +</pre></div> +</div> +<p id="duration-limitation">Duration columns cannot be used in a table’s <code class="docutils literal"><span class="pre">PRIMARY</span> <span class="pre">KEY</span></code>. This limitation is due to the fact that +durations cannot be ordered. It is effectively not possible to know if <code class="docutils literal"><span class="pre">1mo</span></code> is greater than <code class="docutils literal"><span class="pre">29d</span></code> without a date +context.</p> +<p>A <code class="docutils literal"><span class="pre">1d</span></code> duration is not equals to a <code class="docutils literal"><span class="pre">24h</span></code> one as the duration type has been created to be able to support daylight +saving.</p> +</div> <div class="section" id="collections"> <span id="id4"></span><h2>Collections<a class="headerlink" href="#collections" title="Permalink to this headline">¶</a></h2> <p>CQL supports 3 kind of collections: <a class="reference internal" href="#maps"><span class="std std-ref">Maps</span></a>, <a class="reference internal" href="#sets"><span class="std std-ref">Sets</span></a> and <a class="reference internal" href="#lists"><span class="std std-ref">Lists</span></a>. The types of those collections is defined @@ -632,14 +683,11 @@ For instance, one could insert into the <p>An existing user-defined type can be modified using an <code class="docutils literal"><span class="pre">ALTER</span> <span class="pre">TYPE</span></code> statement:</p> <pre> <strong id="grammar-token-alter_type_statement">alter_type_statement </strong> ::= ALTER TYPE <a class="reference internal" href="#grammar-token-udt_name"><code class="xref docutils literal"><span class="pre">udt_name</span></code></a> <a class="reference internal" href="#grammar-token-alter_type_modification"><code class="xref docutils literal"><span class="pre">alter_type_modification</span></code></a> -<strong id="grammar-token-alter_type_modification">alter_type_modification</strong> ::= ALTER <a class="reference internal" href="definitions.html#grammar-token-identifier"><code class="xref docutils literal"><span class="pre">identifier</span></code></a> TYPE <a class="reference internal" href="#grammar-token-cql_type"><code class="xref docutils literal"><span class="pre">cql_type</span></code></a> - | ADD <a class="reference internal" href="#grammar-token-field_definition"><code class="xref docutils literal"><span class="pre">field_definition</span></code></a> +<strong id="grammar-token-alter_type_modification">alter_type_modification</strong> ::= ADD <a class="reference internal" href="#grammar-token-field_definition"><code class="xref docutils literal"><span class="pre">field_definition</span></code></a> | RENAME <a class="reference internal" href="definitions.html#grammar-token-identifier"><code class="xref docutils literal"><span class="pre">identifier</span></code></a> TO <a class="reference internal" href="definitions.html#grammar-token-identifier"><code class="xref docutils literal"><span class="pre">identifier</span></code></a> ( <a class="reference internal" href="definitions.html#grammar-token-identifier"><code class="xref docutils literal"><span class="pre">identifier</span></code></a> TO <a class="reference internal" href="definitions.html#grammar-token-identifier"><code class="xref docutils literal"><span class="pre">identifier</span></code></a> )* </pre> <p>You can:</p> <ul class="simple"> -<li>modify the type of particular field (<code class="docutils literal"><span class="pre">ALTER</span> <span class="pre">TYPE</span> <span class="pre">address</span> <span class="pre">ALTER</span> <span class="pre">zip</span> <span class="pre">TYPE</span> <span class="pre">bigint</span></code>). The restrictions for such change -are the same than when <a class="reference internal" href="ddl.html#alter-table-statement"><span class="std std-ref">altering the type of column</span></a>.</li> <li>add a new field to the type (<code class="docutils literal"><span class="pre">ALTER</span> <span class="pre">TYPE</span> <span class="pre">address</span> <span class="pre">ADD</span> <span class="pre">country</span> <span class="pre">text</span></code>). That new field will be <code class="docutils literal"><span class="pre">null</span></code> for any values of the type created before the addition.</li> <li>rename the fields of the type (<code class="docutils literal"><span class="pre">ALTER</span> <span class="pre">TYPE</span> <span class="pre">address</span> <span class="pre">RENAME</span> <span class="pre">zip</span> <span class="pre">TO</span> <span class="pre">zipcode</span></code>).</li> Modified: cassandra/site/publish/doc/4.0/data_modeling/index.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/data_modeling/index.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/data_modeling/index.html (original) +++ cassandra/site/publish/doc/4.0/data_modeling/index.html Tue May 16 02:01:22 2017 @@ -130,7 +130,7 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Cassandra Development</a></li> +<li class="toctree-l1"><a class="reference internal" href="../development/index.html">Contributing to Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> <li class="toctree-l1"><a class="reference internal" href="../bugs.html">Reporting Bugs and Contributing</a></li> <li class="toctree-l1"><a class="reference internal" href="../contactus.html">Contact us</a></li> Modified: cassandra/site/publish/doc/4.0/development/code_style.html URL: http://svn.apache.org/viewvc/cassandra/site/publish/doc/4.0/development/code_style.html?rev=1795259&r1=1795258&r2=1795259&view=diff ============================================================================== --- cassandra/site/publish/doc/4.0/development/code_style.html (original) +++ cassandra/site/publish/doc/4.0/development/code_style.html Tue May 16 02:01:22 2017 @@ -30,7 +30,7 @@ <link rel="stylesheet" href="./../../../css/sphinx.css"> - <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="Cassandra Development" href="index.html"/> <link rel="next" title="Review Checklist" href="how_to_review.html"/> <link rel="prev" title="Contributing Code Changes" href="patches.html"/> + <link rel="top" title="Apache Cassandra Documentation v4.0" href="../index.html"/> <link rel="up" title="Contributing to Cassandra" href="index.html"/> <link rel="next" title="Review Checklist" href="how_to_review.html"/> <link rel="prev" title="Contributing Code Changes" href="patches.html"/> </head> <body> @@ -63,7 +63,7 @@ - <li><a href="./">Cassandra Development</a></li> + <li><a href="./">Contributing to Cassandra</a></li> @@ -132,7 +132,8 @@ <li class="toctree-l1"><a class="reference internal" href="../operating/index.html">Operating Cassandra</a></li> <li class="toctree-l1"><a class="reference internal" href="../tools/index.html">Cassandra Tools</a></li> <li class="toctree-l1"><a class="reference internal" href="../troubleshooting/index.html">Troubleshooting</a></li> -<li class="toctree-l1 current"><a class="reference internal" href="index.html">Cassandra Development</a><ul class="current"> +<li class="toctree-l1 current"><a class="reference internal" href="index.html">Contributing to Cassandra</a><ul class="current"> +<li class="toctree-l2"><a class="reference internal" href="gettingstarted.html">Getting Started</a></li> <li class="toctree-l2"><a class="reference internal" href="ide.html">Building and IDE Integration</a></li> <li class="toctree-l2"><a class="reference internal" href="testing.html">Testing</a></li> <li class="toctree-l2"><a class="reference internal" href="patches.html">Contributing Code Changes</a></li> @@ -148,6 +149,7 @@ </li> <li class="toctree-l2"><a class="reference internal" href="how_to_review.html">Review Checklist</a></li> <li class="toctree-l2"><a class="reference internal" href="how_to_commit.html">How-to Commit</a></li> +<li class="toctree-l2"><a class="reference internal" href="documentation.html">Working on Documentation</a></li> </ul> </li> <li class="toctree-l1"><a class="reference internal" href="../faq/index.html">Frequently Asked Questions</a></li> --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
