You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pr@cassandra.apache.org by GitBox <gi...@apache.org> on 2021/12/20 05:33:53 UTC

[GitHub] [cassandra-website] ErickRamirezAU commented on a change in pull request #84: CASSANDRA-17219: December 2021 blog post "Using Arithmetic Operators in Cassandra 4.0"

ErickRamirezAU commented on a change in pull request #84:
URL: https://github.com/apache/cassandra-website/pull/84#discussion_r772062304



##########
File path: site-content/source/modules/ROOT/pages/blog/Using-Arithmetic-Operators-in-Cassandra-4.0.adoc
##########
@@ -0,0 +1,158 @@
+= Using Arithmetic Operators in Cassandra 4.0
+:page-layout: single-post
+:page-role: blog-post
+:page-post-date: December 21, 2021
+:page-post-author: Benjamin Lerer
+:description: The Apache Cassandra Community
+:keywords: 
+
+image:blog/using-arithmetic-operators-in-cassandra-4.0-unsplash-bekky-bekks.jpg[operations]
+
+Support for arithmetic operators was added to CQL in Cassandra 4.0 and this blog post describes the important things to know about CQL arithmetics operators, and how we addressed the non-trivial challenges around return types and types inference.
+
+=== Operations on Numbers
+Cassandra supports five arithmetic operators on numbers:
+// adding a table and assuming symbols aren’t an issue. Fingers crossed.
+.Arithmetic Operators in 4.0

Review comment:
       The table title doesn't render correctly. I have a feeling there needs to be an empty line before the title:
   
   ```suggestion
   
   .Arithmetic Operators in 4.0
   ```

##########
File path: site-content/source/modules/ROOT/pages/blog/Using-Arithmetic-Operators-in-Cassandra-4.0.adoc
##########
@@ -0,0 +1,158 @@
+= Using Arithmetic Operators in Cassandra 4.0
+:page-layout: single-post
+:page-role: blog-post
+:page-post-date: December 21, 2021
+:page-post-author: Benjamin Lerer
+:description: The Apache Cassandra Community
+:keywords: 
+
+image:blog/using-arithmetic-operators-in-cassandra-4.0-unsplash-bekky-bekks.jpg[operations]
+
+Support for arithmetic operators was added to CQL in Cassandra 4.0 and this blog post describes the important things to know about CQL arithmetics operators, and how we addressed the non-trivial challenges around return types and types inference.
+
+=== Operations on Numbers
+Cassandra supports five arithmetic operators on numbers:
+// adding a table and assuming symbols aren’t an issue. Fingers crossed.
+.Arithmetic Operators in 4.0
+[cols="1,1"]
+|===
+|Operator |Description
+|+ |addition 
+|- |negates operand/substraction
+|* |multiplication
+|/ |division
+|% |returns the remainder of a division
+|===
+Those operators can be used in the `SELECT` `INSERT`, `UPDATE,` and `DELETE` statements to perform some computations. For example, if you wish to know the percentage of completion of the currently running compactions, you can query the *sstable_tasks* system view using the following query:

Review comment:
       ```suggestion
   Those operators can be used in the `SELECT` `INSERT`, `UPDATE,` and `DELETE` statements to perform some computations. For example, if you wish to know the percentage of completion of the currently running compactions, you can query the `sstable_tasks` system view using the following query:
   ```

##########
File path: site-content/source/modules/ROOT/pages/blog/Using-Arithmetic-Operators-in-Cassandra-4.0.adoc
##########
@@ -0,0 +1,158 @@
+= Using Arithmetic Operators in Cassandra 4.0
+:page-layout: single-post
+:page-role: blog-post
+:page-post-date: December 21, 2021
+:page-post-author: Benjamin Lerer
+:description: The Apache Cassandra Community
+:keywords: 
+
+image:blog/using-arithmetic-operators-in-cassandra-4.0-unsplash-bekky-bekks.jpg[operations]
+
+Support for arithmetic operators was added to CQL in Cassandra 4.0 and this blog post describes the important things to know about CQL arithmetics operators, and how we addressed the non-trivial challenges around return types and types inference.
+
+=== Operations on Numbers
+Cassandra supports five arithmetic operators on numbers:
+// adding a table and assuming symbols aren’t an issue. Fingers crossed.
+.Arithmetic Operators in 4.0
+[cols="1,1"]
+|===
+|Operator |Description
+|+ |addition 
+|- |negates operand/substraction
+|* |multiplication
+|/ |division
+|% |returns the remainder of a division
+|===
+Those operators can be used in the `SELECT` `INSERT`, `UPDATE,` and `DELETE` statements to perform some computations. For example, if you wish to know the percentage of completion of the currently running compactions, you can query the *sstable_tasks* system view using the following query:
+[source,java]
+---- 
+SELECT keyspace_name,
+table_name,
+Task_id,
+(progress * 100) / total AS percentage_of_completion
+FROM system_views.sstable_tasks
+WHERE kind = 'compaction'
+ALLOW FILTERING;
+----
+=== The Important Role of Return Types
+An important thing to take into account when using operators is the return type of the operation. In Cassandra the return type is based on the type of the operands and can be determined using the following table:
+.Return Type Based on Operand in Apache Cassandra

Review comment:
       Similar to line 16 above, the table title doesn't render and I think requires a blank line before it:
   
   ```suggestion
   
   .Return Type Based on Operand in Apache Cassandra
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: pr-unsubscribe@cassandra.apache.org
For additional commands, e-mail: pr-help@cassandra.apache.org