Skip to content

Instantly share code, notes, and snippets.

View cvybhu's full-sized avatar

Jan Ciołek cvybhu

View GitHub Profile
@cvybhu
cvybhu / CqlParser.cpp
Created April 26, 2023 10:25
CqlParser generated by antlr3
This file has been truncated, but you can view the full file.
using ExceptionBaseType = int;
/** \file
* This C++ source file was generated by $ANTLR version 3.5.3
*
* - From the grammar source file : build/dev/gen/cql3/Cql.g
* - for the parser : CqlParserParser
*
* Editing it, at least manually, is not wise.
*
* C++ language generator and runtime by Gokulakannan Somasundaram ( heavy lifting from C Run-time by Jim Idle )
@cvybhu
cvybhu / docker-compose.yml
Created March 3, 2023 08:48
docker-compose for a 64-node Scylla cluster
# docker-compose file for a 64 node Scylla cluster.
version: "3.7"
networks:
public:
name: scylla_cluster_network
driver: bridge
ipam:
driver: default
@cvybhu
cvybhu / cqlvalues.md
Created March 15, 2022 13:18
CQL values

CQL has 4 types of values:

  • Normal value: 1, 2, 3, "abc"
  • NULL: Described as null
  • Empty value: Value that has 0 bytes, but is not null. For example a 0 byte int value.
  • Unset value: Sent from the driver to specify that some value shouldn't be modified.
cqlsh:ks> CREATE TABLE t (p int primary key, i int);
@cvybhu
cvybhu / intests.py
Last active August 27, 2021 11:20
IN tests
import cassandra
from cassandra.cluster import Cluster
from cassandra.util import Duration
session = Cluster().connect()
session.execute("CREATE KEYSPACE IF NOT EXISTS ks WITH replication = {'class': 'SimpleStrategy', 'replication_factor': 1}")
session.execute("CREATE TABLE IF NOT EXISTS ks.t3 (p int, a int, b int, primary key (p, a, b))")
def try1():
session.execute("SELECT * FROM ks.t3 WHERE p = 0 AND (a, b) IN ((1, 2), null)")
@cvybhu
cvybhu / indexes.txt
Created July 13, 2021 11:04
Resources about indexes in Cassandra and Scylla
Links:
https://www.datastax.com/blog/cassandra-native-secondary-index-deep-dive
https://www.scylladb.com/2019/07/23/global-or-localsecondary-indexes-in-scylla-the-choice-is-now-yours/
https://docs.scylladb.com/using-scylla/secondary-indexes/
https://docs.scylladb.com/using-scylla/local-secondary-indexes/
In Scylla:
Global index of column c:
Index table:
partition key = c