Successfully reported this slideshow.
Your SlideShare is downloading. ×

Apache Cassandra Lunch #99: CQL Arithmetic Operators

Ad

Version 1.0
CQL Arithmetic Operators
In Cassandra Lunch #99, Arpan Patel will discuss the CQL
Arithmetic Operators that ar...

Ad

Arithmetic Operators in Cassandra 4.0
● Cassandra supports five arithmetic
operators on numbers:
○ +
○ -
○ *
○ /
○ %
● Ope...

Ad

Return Types
● An important thing to take into account when using operators is the return type of the operation

Ad

Ad

Ad

Ad

Ad

Ad

Ad

Check these out next

1 of 10 Ad
1 of 10 Ad

Apache Cassandra Lunch #99: CQL Arithmetic Operators

Download to read offline

In Cassandra Lunch #99, Arpan Patel will discuss the CQL Arithmetic Operators that are now supported in Cassandra 4.0!

Accompanying Blog: Coming Soon!

Accompanying YouTube: https://youtu.be/SJfkoIE1scw

Sign Up For Our Newsletter: http://eepurl.com/grdMkn

Join Cassandra Lunch Weekly at 12 PM EST Every Wednesday: https://www.meetup.com/Cassandra-DataStax-DC/events/

Cassandra.Link:
https://cassandra.link/

Follow Us and Reach Us At:

Anant:
https://www.anant.us/

Awesome Cassandra:
https://github.com/Anant/awesome-cassandra

Cassandra.Lunch:
https://github.com/Anant/Cassandra.Lunch

Email:
solutions@anant.us

LinkedIn:
https://www.linkedin.com/company/anant/

Twitter:
https://twitter.com/anantcorp

Eventbrite:
https://www.eventbrite.com/o/anant-1072927283

Facebook:
https://www.facebook.com/AnantCorp/

Join The Anant Team:
https://www.careers.anant.us

In Cassandra Lunch #99, Arpan Patel will discuss the CQL Arithmetic Operators that are now supported in Cassandra 4.0!

Accompanying Blog: Coming Soon!

Accompanying YouTube: https://youtu.be/SJfkoIE1scw

Sign Up For Our Newsletter: http://eepurl.com/grdMkn

Join Cassandra Lunch Weekly at 12 PM EST Every Wednesday: https://www.meetup.com/Cassandra-DataStax-DC/events/

Cassandra.Link:
https://cassandra.link/

Follow Us and Reach Us At:

Anant:
https://www.anant.us/

Awesome Cassandra:
https://github.com/Anant/awesome-cassandra

Cassandra.Lunch:
https://github.com/Anant/Cassandra.Lunch

Email:
solutions@anant.us

LinkedIn:
https://www.linkedin.com/company/anant/

Twitter:
https://twitter.com/anantcorp

Eventbrite:
https://www.eventbrite.com/o/anant-1072927283

Facebook:
https://www.facebook.com/AnantCorp/

Join The Anant Team:
https://www.careers.anant.us

Advertisement
Advertisement

More Related Content

More from Anant Corporation (20)

Advertisement

Apache Cassandra Lunch #99: CQL Arithmetic Operators

  1. 1. Version 1.0 CQL Arithmetic Operators In Cassandra Lunch #99, Arpan Patel will discuss the CQL Arithmetic Operators that are now supported in Cassandra 4.0! Arpan Patel Engineer @ Anant
  2. 2. Arithmetic Operators in Cassandra 4.0 ● Cassandra supports five arithmetic operators on numbers: ○ + ○ - ○ * ○ / ○ % ● Operators can be used in the SELECT INSERT, UPDATE, and DELETE statements to perform some computations ● Works on DataStax Astra as well
  3. 3. Return Types ● An important thing to take into account when using operators is the return type of the operation
  4. 4. Type Inference ● Cassandra will try to infer the type of the literals to determine how the operation must be performed ● If the literal is an integer, C* will look at it and consider it as an int, a bigint or a varint if the type can hold this value ● For floats, C* will consider them as either doubles or decimals ● Now, in some cases, Cassandra knows the return type of the expression and can use it to infer the type of the literals
  5. 5. Hints / Casting ● A type hint is a way to explicitly tell Cassandra what will be the type of the parameter ● Type hints can also be used to control the type of a literal ● Can also cast into type of literal
  6. 6. Operator Precedence ● *, /, and % operators have a higher precedence level than + and - operator ● If two operators in an expression have the same precedence level, they will be evaluated left to right based on their positions in the expression ● Parentheses can be used to modify the order in which the operations must be performed within an expression ● Everything within parentheses will be evaluated first to yield a single value before that value can be used by any operator outside the parentheses
  7. 7. Operations on Timestamps and Dates ● Addition or subtraction of durations from timestamps and dates is supported ● As UTC does not change with a change of seasons arithmetic operations on timestamps and dates are safe and will always return the expected results ● However, be aware that the Java libraries used internally by Cassandra, ignore leap seconds.
  8. 8. Demo ● https://github.com/Anant/example-CQL-arithmetic-operators ● Spin up Cassandra on Docker ● Run through addition, subtraction, division, multiplication, and arithmetic operator + aggregate function examples
  9. 9. Resources ● https://cassandra.apache.org/_/blog/Using-Arithmetic-Operators-in- Cassandra-4.0.html ● https://cassandra.apache.org/doc/latest/cassandra/cql/operators.ht ml ● https://medium.com/building-the-open-data-stack/arithmetic- operators-in-apache-cassandra-4-0-c5a3185d683
  10. 10. Strategy: Scalable Fast Data Architecture: Cassandra, Spark, Kafka Engineering: Node, Python, JVM,CLR Operations: Cloud, Container Rescue: Downtime!! I need help. www.anant.us | solutions@anant.us | (855) 262-6826 3 Washington Circle, NW | Suite 301 | Washington, DC 20037

×