Skip to content

Instantly share code, notes, and snippets.

@doanduyhai
doanduyhai / cassandra-training-resources.md
Last active December 3, 2016 08:05
Cassandra training resources
@doanduyhai
doanduyhai / Type Annotations on VariableElement
Last active August 29, 2015 14:21
Type Annotations on VariableElement
public static class SimpleEntityCodecFactoryTest {
private Map<@JSON Integer,Map<@Frozen Integer,@Enumerated(value = Enumerated.Encoding.NAME, test = "123") String>> map;
}
final TypeElement typeElement = elementUtils.getTypeElement(SimpleEntityCodecFactoryTest.class.getCanonicalName());
final List<VariableElement> els = ElementFilter.fieldsIn(typeElement.getEnclosedElements());
final VariableElement mapElt = els.stream().filter(x -> x.getSimpleName().contentEquals("map")).findFirst().get();
final com.sun.tools.javac.util.List<Attribute.TypeCompound> typeAttributes = ((Symbol.VarSymbol) mapElt).getMetadata().getTypeAttributes();
@doanduyhai
doanduyhai / Spark-Cassandra-Zeppelin-instructions.md
Last active March 13, 2017 21:21
Instructions to use Zeppelin with Spark and Cassandra

This procedure is for Spark running in a stand-alone deployment mode

Please follow those instructions:

  1. Clone Zeppelin project from [master branch] on Github

  2. If you use DSE 4.8 (thus Spark 1.4) edit the file $ZEPPELIN_HOME/spark-dependencies/pom.xml. Duplicate the Maven profile cassandra-spark-1.3 to cassandra-spark-1.4 and update the spark-cassandra-connector version to 1.4.0

@doanduyhai
doanduyhai / CassandraInterpreterV2TestData.cql
Created January 5, 2016 22:53
Cassandra Interpreter V2 Test data
CREATE KEYSPACE IF NOT EXISTS test WITH REPLICATION = {
'class' : 'org.apache.cassandra.locator.SimpleStrategy',
'replication_factor': '1' }
AND DURABLE_WRITES = true;
CREATE TABLE IF NOT EXISTS test.test_max (
id int,
val1 int,
val2 int,
PRIMARY KEY (id)
@doanduyhai
doanduyhai / sasi_bug.md
Last active February 5, 2016 10:32
SASI Bug
CREATE KEYSPACE music WITH replication = {'class': 'SimpleStrategy', 'replication_factor': '1'}  AND durable_writes = true;

CREATE FUNCTION music.show_me_space(val text)
    RETURNS NULL ON NULL INPUT
    RETURNS text
    LANGUAGE java
    AS $$ return "_" + val + "_"; $$;
    
CREATE TABLE music.albums (
diff --git a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java
index d9b93f2..00df966 100644
--- a/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java
+++ b/zeppelin-interpreter/src/main/java/org/apache/zeppelin/scheduler/Job.java
@@ -103,11 +103,16 @@ public abstract class Job {
this(jobName, listener, JobProgressPoller.DEFAULT_INTERVAL_MSEC);
}
+ public Job(String jobId, String jobName, JobListener listener) {
+ this(jobId, jobName, listener, JobProgressPoller.DEFAULT_INTERVAL_MSEC);
commit a1cd27e406b2671fd43600ab3bed060197348844
Author: DuyHai DOAN <doanduyhai@gmail.com>
Date: Sat Apr 23 22:56:37 2016 +0200
Debug SASI OnDiskIndex structure
diff --git a/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java b/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java
index 9a1f7f1..d874467 100644
--- a/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java
+++ b/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java
commit c0fd82ca3555586767307456fd5d52ad1f70e666
Author: DuyHai DOAN <doanduyhai@gmail.com>
Date: Thu Jun 23 11:41:54 2016 +0200
Cassandra 3.7 patch for SASI debug
diff --git a/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java b/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java
index 9a1f7f1..fe34073 100644
--- a/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java
+++ b/src/java/org/apache/cassandra/index/sasi/disk/AbstractTokenTreeBuilder.java