Your SlideShare is downloading. ×
0
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
CQL In Cassandra 1.0 (and beyond)
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

CQL In Cassandra 1.0 (and beyond)

5,324

Published on

CQL, past, present, and future, presented to Big Data DC on October 17, 2011

CQL, past, present, and future, presented to Big Data DC on October 17, 2011

Published in: Technology
0 Comments
4 Likes
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total Views
5,324
On Slideshare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
Downloads
44
Comments
0
Likes
4
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. CQL In Cassandra 1.0 (and beyond) Big Data DC Meetup #5 October 17, 2011 Eric Evans eric@acunu.com @jericevans, @acunu
  • 2. ● Overview, history, motivation● Changes in CQL 2.0 (Cassandra 1.0)● Coming soon (?)● Drivers status
  • 3. What?● Cassandra Query Language ● aka CQL ● aka /ˈsēkwəl/● Exactly like SQL (except where its not)● Introduced in Cassandra 0.8.0● Ready for production use
  • 4. SQL? Almost.–- Inserts or updatesINSERT INTO Standard1 (KEY, col0, col1)VALUES (key, value0, value1) vs.–- Inserts or updatesUPDATE Standard1SET col0=value0, col1=value1 WHERE KEY=key
  • 5. SQL? Almost.–- Get columns for a rowSELECT col0,col1 FROM Standard1 WHERE KEY=key–- Range of columns for a rowSELECT col0..colN FROM Standard1 WHERE KEY=key–- First 10 results from a range of columnsSELECT FIRST 10 col0..colN FROM Standard1 WHERE KEY=key–- Invert the sorting of resultsSELECT REVERSED col0..colN FROM Standard1 WHERE KEY=key
  • 6. Why?
  • 7. Interface Instability
  • 8. (Un)ease of useColumn col = new Column(ByteBuffer.wrap(“name”.getBytes()));col.setValue(ByteBuffer.wrap(“value”.getBytes()));col.setTimestamp(System.currentTimeMillis());ColumnOrSuperColumn cosc = new ColumnOrSuperColumn();cosc.setColumn(col);Mutation mutation = new Mutation();Mutation.setColumnOrSuperColumn(cosc);List mutations = new ArrayList<Mutation>();mutations.add(mutation);Map mutations_map = new HashMap<ByteBuffer, Map<String, List<Mutation>>>();Map cf_map = new HashMap<String, List<Mutation>>();cf_map.set(“Standard1”, mutations);mutations.put(ByteBuffer.wrap(“key”.getBytes()), cf_map)
  • 9. CQLINSERT INTO Standard1 (KEY, col0) VALUES (key, value0)
  • 10. Why? How about...● Better stability guarantees● Easier to use (you already know it)● Better code readability / maintainability
  • 11. Why? How about...● Better stability guarantees● Easier to use (you already know it)● Better code readability / maintainability● Irritates the NoSQL purists
  • 12. Why? How about...● Better stability guarantees● Easier to use (you already know it)● Better code readability / maintainability● Irritates the NoSQL purists● (Still )irritates the SQL purists
  • 13. CQL 2.0
  • 14. Wait, 2.0? You call that stable?Yes yes, but... ● We had a few FUBARs in the first pass ● Not the norm, honest ● Its a mulligan ● Look, cats!
  • 15. Changed in 2.0● SELECT count(...) FROM now returns row, not column count● Terms / Types ● bytea became blob ● int became 4-bytes (was arbitrary precision) ● date became timestamp
  • 16. Also new (but not breaking)● Named keys (virtual columns)● Counters● Complete DDL support● Timestamps and TTLs
  • 17. Named Keys–- An unnamed key uses the KEY keywordCREATE TABLE Standard1 (KEY text PRIMARY KEY)–- But you can also name one like so...CREATE TABLE Standard1 (username text PRIMARY KEY)–- The name will also be used in results!SELECT email FROM Standard1 WHERE username = jericevans
  • 18. Counters–- Counter incrementUPDATE Standard1SET acount = acount + 1 WHERE KEY = key–- Counter decrementUPDATE Standard1SET acount = acount - 1 WHERE KEY = key–- 1 not enough? Go nuts.UPDATE Standard1SET acount = acount + 9 WHERE KEY = key
  • 19. Timestamps and TTLs–- Inserts or updatesUPDATE CFam USING TIMESTAMP 131851901600SET col0=value0, col1=value1 WHERE KEY=key–- Inserts or updatesUPDATE CFam USING TTL 86400SET col0=value0, col1=value1 WHERE KEY=key
  • 20. Coming Soon(ish)
  • 21. Roadmap● Prepared statements (CASSANDRA-2475)● Compound columns (CASSANDRA-2474)● Custom transport / protocol (CASSANDRA-2478)● Performance testing (CASSANDRA-2268)● Schema introspection (CASSANDRA-2477)● Multiget support (CASSANDRA-3069)
  • 22. Drivers
  • 23. Drivers● Hosted on Apache Extras (Google Code)● Tagged cassandra and cql● Licensed using Apache License 2.0● Conforming to a standard for database connectivity (if applicable)● Coming soon, automated testing and acceptance criteria
  • 24. DriversDriver Platform Statuscassandra-jdbc Java Goodcassandra-dbapi2 Python Goodcassandra-ruby Ruby Newcassandra-pdo PHP Newcassandra-node Node.js Goodhttp://code.google.com/a/apache-extras.org/hosting/search?q=label%3aCassandra
  • 25. The End

×