You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@zeppelin.apache.org by al...@apache.org on 2020/07/20 08:27:49 UTC
[zeppelin] branch master updated: [ZEPPELIN-4939] More cleanup on
Cassandra interpreter
This is an automated email from the ASF dual-hosted git repository.
alexott pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/zeppelin.git
The following commit(s) were added to refs/heads/master by this push:
new 305ce28 [ZEPPELIN-4939] More cleanup on Cassandra interpreter
305ce28 is described below
commit 305ce282b3bc1ef377d99224099830bb6e97e8ce
Author: Alex Ott <al...@gmail.com>
AuthorDate: Sun Jul 12 14:11:04 2020 +0200
[ZEPPELIN-4939] More cleanup on Cassandra interpreter
### What is this PR for?
This PR contains additional cleanup of the Cassandra interpreter
- Update help & interpreter documentation
- Fix warnings in Cassandra interpreter code
- Fix warnings in the tests
### What type of PR is it?
Refactoring
### What is the Jira issue?
https://issues.apache.org/jira/browse/ZEPPELIN-4939
### How should this be tested?
* https://travis-ci.org/github/alexott/zeppelin/builds/707349769
* tested manually
### Questions:
* Does the licenses files need update? No
* Is there breaking changes for older versions? No
* Does this needs documentation? No
Author: Alex Ott <al...@gmail.com>
Closes #3856 from alexott/ZEPPELIN-4939 and squashes the following commits:
d09d64497 [Alex Ott] [ZEPPELIN-4939] Fix warnings in the tests
77b0f6f25 [Alex Ott] [ZEPPELIN-4939] Fix warnings in Cassandra interpreter code
6672cf1d2 [Alex Ott] [ZEPPELIN-4939] Update help & interpreter documentation
---
.../zeppelin/cassandra/CassandraInterpreter.java | 2 +-
cassandra/src/main/resources/scalate/helpMenu.ssp | 40 ++++--------
.../apache/zeppelin/cassandra/CqlFormatter.scala | 7 +--
.../apache/zeppelin/cassandra/DisplaySystem.scala | 13 ++--
.../zeppelin/cassandra/EnhancedSession.scala | 22 +++----
.../zeppelin/cassandra/InterpreterLogic.scala | 26 ++++----
.../zeppelin/cassandra/ParagraphParser.scala | 6 +-
.../zeppelin/cassandra/TextBlockHierarchy.scala | 3 +-
.../cassandra/CassandraInterpreterTest.java | 71 +++++++++++-----------
.../zeppelin/cassandra/InterpreterLogicTest.java | 60 +++++++++---------
cassandra/src/test/resources/scalate/Help.html | 2 +-
.../zeppelin/cassandra/CqlFormatterTest.scala | 6 +-
.../zeppelin/cassandra/ParagraphParserTest.scala | 2 +-
docs/interpreter/cassandra.md | 17 ++----
14 files changed, 121 insertions(+), 156 deletions(-)
diff --git a/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java b/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java
index 7d397e5..3a00448 100644
--- a/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java
+++ b/cassandra/src/main/java/org/apache/zeppelin/cassandra/CassandraInterpreter.java
@@ -152,7 +152,7 @@ public class CassandraInterpreter extends Interpreter {
public static final String DEFAULT_TCP_NO_DELAY = "true";
public static final String DEFAULT_MAX_SCHEMA_AGREEMENT_WAIT_SECONDS = "12";
- static final List NO_COMPLETION = new ArrayList<>();
+ static final List<InterpreterCompletion> NO_COMPLETION = new ArrayList<>();
public static final String DATASTAX_JAVA_DRIVER_PREFIX = "datastax-java-driver.";
public static final String MILLISECONDS_STR = " milliseconds";
public static final String SECONDS_STR = " seconds";
diff --git a/cassandra/src/main/resources/scalate/helpMenu.ssp b/cassandra/src/main/resources/scalate/helpMenu.ssp
index 2883b86..5e1224d 100644
--- a/cassandra/src/main/resources/scalate/helpMenu.ssp
+++ b/cassandra/src/main/resources/scalate/helpMenu.ssp
@@ -139,7 +139,7 @@
</a>
</h4>
</div>
- <div id="${basicCommandsId}" class="panel-collapse collapse in" role="tabpanel">
+ <div id="${basicCommandsId}" class="panel-collapse collapse" role="tabpanel">
<div class="panel-body">
<div class="panel panel-default">
@@ -150,7 +150,6 @@
<div class="row">
<div class="col-md-6 col-md-offset-3">
<pre>
-
INSERT INTO users(login,name) VALUES('jdoe','John DOE');
SELECT * FROM users WHERE login='jdoe';
</pre>
@@ -166,7 +165,6 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<pre>
-
USE spark_demo;
SELECT * FROM albums_by_country LIMIT 1; SELECT * FROM countries LIMIT 1;
@@ -185,7 +183,6 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<pre>
-
BEGIN BATCH
INSERT INTO users(login,name) VALUES('jdoe','John DOE');
INSERT INTO users_preferences(login,account_type) VALUES('jdoe','BASIC');
@@ -206,7 +203,6 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<pre>
-
INSERT INTO users(login,name) VALUES('jdoe','John DOE');
Insert into users(login,name) vAlues('hsue','Helen SUE');
</pre>
@@ -239,21 +235,13 @@
</td>
</tr>
<tr>
- <td><strong>2.1 & 2.0</strong></td>
+ <td><strong>2.1</strong></td>
<td>
<a href="http://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html" target="_blank">
http://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html
</a>
</td>
</tr>
- <tr>
- <td><strong>1.2</strong></td>
- <td>
- <a href="http://docs.datastax.com/en/cql/3.0/cql/aboutCQL.html" target="_blank">
- http://docs.datastax.com/en/cql/3.0/cql/aboutCQL.html
- </a>
- </td>
- </tr>
</tbody>
</table>
</div>
@@ -272,7 +260,6 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<pre>
-
# Single line comment style 1
INSERT INTO users(login,name) VALUES('jdoe','John DOE');
@@ -530,7 +517,6 @@
<div class="row">
<div class="col-md-8 col-md-offset-2">
<pre>
-
CREATE TABLE IF NOT EXISTS spark_demo.ts(
key int PRIMARY KEY,
value text
@@ -722,7 +708,6 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
<div class="row">
<div class="col-md-10 col-md-offset-1">
<pre>
-
@prepare[statement-name]=...
@bind[statement-name]=’text’, 1223, ’2015-07-30 12:00:01’, null, true, [‘list_item1’, ’list_item2’]
@@ -759,7 +744,6 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
<div class="row">
<div class="col-md-10 col-md-offset-1">
<pre>
-
@prepare[select]=SELECT * FROM spark_demo.albums LIMIT ?
@prepare[select]=SELECT * FROM spark_demo.artists LIMIT ?
@@ -783,7 +767,6 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
<div class="row">
<div class="col-md-10 col-md-offset-1">
<pre>
-
@bind[select_first]=10
</pre>
</div>
@@ -881,7 +864,6 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
<div class="row">
<div class="col-md-10 col-md-offset-1">
<pre>
-
#Secondary index on performer style
SELECT name, country, performer
FROM spark_demo.performers
@@ -978,11 +960,11 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
</tr>
<tr>
<td>cassandra.pooling.core.connection.per.host.local</td>
- <td><strong>Protocol V2 and below: 2, V3 and above: 1</strong></td>
+ <td><strong>V3 and above: 1</strong></td>
</tr>
<tr>
<td>cassandra.pooling.core.connection.per.host.remote</td>
- <td><strong>Protocol V2 and below: 1, V3 and above: 1</strong></td>
+ <td><strong>V3 and above: 1</strong></td>
</tr>
<tr>
<td>cassandra.pooling.heartbeat.interval.seconds</td>
@@ -994,27 +976,27 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
</tr>
<tr>
<td>cassandra.pooling.max.connection.per.host.local</td>
- <td><strong>Protocol V2 and below: 8, V3 and above: 1</strong></td>
+ <td><strong>V3 and above: 1</strong></td>
</tr>
<tr>
<td>cassandra.pooling.max.connection.per.host.remote</td>
- <td><strong>Protocol V2 and below: 2, V3 and above: 1</strong></td>
+ <td><strong>V3 and above: 1</strong></td>
</tr>
<tr>
<td>cassandra.pooling.max.request.per.connection.local</td>
- <td><strong>Protocol V2 and below: 128, V3 and above: 1024</strong></td>
+ <td><strong>V3 and above: 1024</strong></td>
</tr>
<tr>
<td>cassandra.pooling.max.request.per.connection.remote</td>
- <td><strong>Protocol V2 and below: 128, V3 and above: 256</strong></td>
+ <td><strong>V3 and above: 256</strong></td>
</tr>
<tr>
<td>cassandra.pooling.new.connection.threshold.local</td>
- <td><strong>Protocol V2 and below: 100, V3 and above: 800</strong></td>
+ <td><strong>V3 and above: 800</strong></td>
</tr>
<tr>
<td>cassandra.pooling.new.connection.threshold.remote</td>
- <td><strong>Protocol V2 and below: 100, V3 and above: 200</strong></td>
+ <td><strong>V3 and above: 200</strong></td>
</tr>
<tr>
<td>cassandra.pooling.pool.timeout.millisecs</td>
@@ -1122,7 +1104,7 @@ select id, double, float, text, date, time, timestamp from zep.test_format;
<strong>4.0</strong> :
<br/>
<ul>
- <li>Migrate to DataStax Java driver 4.x that supports both Cassandra and DSE. This contains breaking changes, like, deprecation of <code>@retryPolicy</code></li>
+ <li>Migrate to DataStax Java driver 4.x that supports both Cassandra and DSE. This contains breaking changes, like, deprecation of <code>@retryPolicy</code>, dropped support for Cassandra 1.2/2.0</li>
<li>Fix schema disagreement that could arise when executing multiple DDL statements</li>
<li>Added support for <code>--</code> comment style</li>
<li>Added options for formatting of output (interpreter and cell level)</li>
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/CqlFormatter.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/CqlFormatter.scala
index ff15e82..fe4d4ac 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/CqlFormatter.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/CqlFormatter.scala
@@ -22,11 +22,10 @@ import java.text.DecimalFormat
import java.text.NumberFormat
import java.time.{Instant, LocalDate, LocalTime, ZoneId}
import java.time.format.DateTimeFormatter
-import java.util.concurrent.ConcurrentHashMap
import java.util.{Locale, Properties, TimeZone}
import com.datastax.oss.driver.api.core.`type`.codec.TypeCodec
-import com.datastax.oss.driver.api.core.`type`.{DataType, DataTypes}
+import com.datastax.oss.driver.api.core.`type`.DataType
import com.datastax.oss.driver.api.core.cql.Row
import com.datastax.oss.driver.api.core.data.{TupleValue, UdtValue}
import io.netty.buffer.ByteBufUtil
@@ -169,7 +168,7 @@ class CqlFormatter(val outputFormat: String = CqlFormatter.DEFAULT_FORMAT,
(0 until u.size()).map(i => names.get(i).asInternal + ": " + formatHuman(u.getObject(i)))
.mkString("{", ", ", "}")
- case _ => obj.toString()
+ case _ => obj.toString
}
}
}
@@ -191,7 +190,7 @@ class CqlFormatter(val outputFormat: String = CqlFormatter.DEFAULT_FORMAT,
}
}
- override def toString = s"CqlFormatter(format=$outputFormat, fp=$floatPrecision, dp=$doublePrecision, " +
+ override def toString: String = s"CqlFormatter(format=$outputFormat, fp=$floatPrecision, dp=$doublePrecision, " +
s"tsFormat=$timestampFormat, tmFormat=$timeFormat, dtFormat=$dateFormat, " +
s"timeozone=$timeZoneId, locale=$localeStr)"
}
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/DisplaySystem.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/DisplaySystem.scala
index 18137d3..f7500a6 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/DisplaySystem.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/DisplaySystem.scala
@@ -16,7 +16,6 @@
*/
package org.apache.zeppelin.cassandra
-import java.io.InputStream
import java.util.{Properties, UUID}
import org.apache.zeppelin.cassandra.MetaDataHierarchy._
@@ -156,7 +155,7 @@ object DisplaySystem {
private def formatCQLQuery(cql: String): String = {
cql.replaceAll(""" WITH REPLICATION = \{""", " WITH REPLICATION = \\{")
.replaceAll("('[^']+'\\s*:\\s+'[^']+',?)", "\n\t$1")
- .replaceAll(""" \} AND DURABLE_WRITES = """, " \\}\nAND DURABLE_WRITES = ")
+ .replaceAll(""" } AND DURABLE_WRITES = """, " \\}\nAND DURABLE_WRITES = ")
}
protected[cassandra] def formatKeyspaceOnly(meta: KeyspaceMetadata, withCaption: Boolean): String = {
@@ -207,11 +206,7 @@ object DisplaySystem {
}
}
- // cluster is explicitly passed because of the limitations of the driver.
- // TODO(alex): remove it after driver is fixed
object ClusterDisplay {
-
-
def formatClusterOnly(statement: String, meta: Metadata,
withMenu: Boolean = true): String = {
val partitioner: String = if (meta.getTokenMap.isPresent)
@@ -311,7 +306,7 @@ object DisplaySystem {
.map(ks => {
((Uuids.timeBased(), ks.getName.asCql(true)),
ks.getFunctions.asScala
- .map { case (sig, meta) => MetaDataConverter.functionMetaToFunctionSummary(sig, meta) }
+ .map { case (_, meta) => MetaDataConverter.functionMetaToFunctionSummary(meta) }
.toSeq
.sortBy(_.name))
}).toMap
@@ -347,7 +342,7 @@ object DisplaySystem {
}.toMap
val keyspaceDetails: List[(UUID, String, String)] = allAggregates
- .keySet.toList.sortBy { case (id, ksName) => ksName }
+ .keySet.toList.sortBy { case (_, ksName) => ksName }
.map { case (id, ksName) => (id, ksName, "") }
val clusterContent: ClusterContent = ClusterContent(clusterName(meta), "", keyspaceDetails)
@@ -494,7 +489,7 @@ object MetaDataConverter {
function.describe(true))
}
- def functionMetaToFunctionSummary(signature: FunctionSignature, function: FunctionMetadata): FunctionSummary = {
+ def functionMetaToFunctionSummary(function: FunctionMetadata): FunctionSummary = {
val signature = function.getSignature
FunctionSummary(function.getKeyspace.asCql(true),
signature.getName.asCql(true),
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/EnhancedSession.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/EnhancedSession.scala
index 46ce83e..1ee4cbd 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/EnhancedSession.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/EnhancedSession.scala
@@ -36,21 +36,21 @@ import scala.compat.java8.OptionConverters._
* to describe schema
*/
class EnhancedSession(val session: CqlSession) {
- val clusterDisplay = DisplaySystem.ClusterDisplay
- val keyspaceDisplay = DisplaySystem.KeyspaceDisplay
- val tableDisplay = DisplaySystem.TableDisplay
- val udtDisplay = DisplaySystem.UDTDisplay
- val functionDisplay = DisplaySystem.FunctionDisplay
- val aggregateDisplay = DisplaySystem.AggregateDisplay
- val materializedViewDisplay = DisplaySystem.MaterializedViewDisplay
- val helpDisplay = DisplaySystem.HelpDisplay
+ val clusterDisplay: DisplaySystem.ClusterDisplay.type = DisplaySystem.ClusterDisplay
+ val keyspaceDisplay: DisplaySystem.KeyspaceDisplay.type = DisplaySystem.KeyspaceDisplay
+ val tableDisplay: DisplaySystem.TableDisplay.type = DisplaySystem.TableDisplay
+ val udtDisplay: DisplaySystem.UDTDisplay.type = DisplaySystem.UDTDisplay
+ val functionDisplay: DisplaySystem.FunctionDisplay.type = DisplaySystem.FunctionDisplay
+ val aggregateDisplay: DisplaySystem.AggregateDisplay.type = DisplaySystem.AggregateDisplay
+ val materializedViewDisplay: DisplaySystem.MaterializedViewDisplay.type = DisplaySystem.MaterializedViewDisplay
+ val helpDisplay: DisplaySystem.HelpDisplay.type = DisplaySystem.HelpDisplay
+
private val noResultDisplay = DisplaySystem.NoResultDisplay
private val DEFAULT_CHECK_TIME: Int = 200
private val MAX_SCHEMA_AGREEMENT_WAIT: Int = 120000 // 120 seconds
private val defaultDDLTimeout: Duration = Duration.ofSeconds(MAX_SCHEMA_AGREEMENT_WAIT / 10000)
private val LOGGER = LoggerFactory.getLogger(classOf[EnhancedSession])
-
val HTML_MAGIC = "%html \n"
val displayNoResult: String = HTML_MAGIC + noResultDisplay.formatNoResult
@@ -209,7 +209,7 @@ class EnhancedSession(val session: CqlSession) {
try {
Thread.sleep(DEFAULT_CHECK_TIME)
} catch {
- case x: InterruptedException => None
+ case _: InterruptedException => None
}
val sinceStart = (System.currentTimeMillis() - startTime) / 1000
if (sinceStart > MAX_SCHEMA_AGREEMENT_WAIT) {
@@ -278,7 +278,7 @@ object EnhancedSession {
else if (batchType == BatchType.UNLOGGED) "UNLOGGED "
else ""
- "BEGIN " + batchTypeStr + "BATCH" + timestampStr + "\n"
+ "BEGIN " + batchTypeStr + "BATCH" + timestampStr + "\n" +
x.iterator().asScala.toSeq.map {
case t: BoundStatement => t.getPreparedStatement.getQuery
case t: SimpleStatement => t.getQuery
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/InterpreterLogic.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/InterpreterLogic.scala
index 2e45eb0..3fba775 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/InterpreterLogic.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/InterpreterLogic.scala
@@ -64,9 +64,9 @@ case class CassandraQueryOptions(consistency: Option[ConsistencyLevel],
object InterpreterLogic {
val CHOICES_SEPARATOR : String = """\|"""
- val VARIABLE_PATTERN: Regex = """\{\{[^}]+\}\}""".r
- val SIMPLE_VARIABLE_DEFINITION_PATTERN: Regex = """\{\{([^=]+)=([^=]+)\}\}""".r
- val MULTIPLE_CHOICES_VARIABLE_DEFINITION_PATTERN: Regex = """\{\{([^=]+)=((?:[^=]+\|)+[^|]+)\}\}""".r
+ val VARIABLE_PATTERN: Regex = """\{\{[^}]+}}""".r
+ val SIMPLE_VARIABLE_DEFINITION_PATTERN: Regex = """\{\{([^=]+)=([^=]+)}}""".r
+ val MULTIPLE_CHOICES_VARIABLE_DEFINITION_PATTERN: Regex = """\{\{([^=]+)=((?:[^=]+\|)+[^|]+)}}""".r
val STANDARD_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss"
val ACCURATE_DATE_FORMAT = "yyyy-MM-dd HH:mm:ss.SSS"
@@ -74,7 +74,6 @@ object InterpreterLogic {
val STANDARD_DATE_FORMATTER: DateTimeFormatter = DateTimeFormatter.ofPattern(STANDARD_DATE_FORMAT)
val ACCURATE_DATE_FORMATTER: DateTimeFormatter = DateTimeFormatter.ofPattern(ACCURATE_DATE_FORMAT)
-
val preparedStatements : mutable.Map[String, PreparedStatement] = new ConcurrentHashMap[String,PreparedStatement]().asScala
val logger: Logger = LoggerFactory.getLogger(classOf[InterpreterLogic])
@@ -327,12 +326,14 @@ class InterpreterLogic(val session: CqlSession, val properties: Properties) {
applyQueryOptions(options, statement)
}
- def generateBoundStatement(session: CqlSession, st: BoundStm, options: CassandraQueryOptions,context: InterpreterContext): BoundStatement = {
+ def generateBoundStatement(session: CqlSession, st: BoundStm, options: CassandraQueryOptions,
+ context: InterpreterContext): BoundStatement = {
logger.debug(s"Generating bound statement with name : '${st.name}' and bound values : ${st.values}")
preparedStatements.get(st.name) match {
case Some(ps) =>
val boundValues = maybeExtractVariables(st.values, context)
- createBoundStatement(session.getContext.getCodecRegistry, st.name, ps, boundValues)
+ val statement = createBoundStatement(session.getContext.getCodecRegistry, st.name, ps, boundValues)
+ applyQueryOptions(options, statement)
case None =>
throw new InterpreterException(s"The statement '${st.name}' can not be bound to values. " +
@@ -361,9 +362,9 @@ class InterpreterLogic(val session: CqlSession, val properties: Properties) {
def extractVariableAndDefaultValue(statement: String, exp: String): String = exp match {
case MULTIPLE_CHOICES_VARIABLE_DEFINITION_PATTERN(variable, choices) =>
- val escapedExp: String = exp.replaceAll( """\{""", """\\{""").replaceAll( """\}""", """\\}""").replaceAll("""\|""","""\\|""")
+ val escapedExp: String = exp.replaceAll( """\{""", """\\{""").replaceAll( """}""", """\\}""").replaceAll("""\|""","""\\|""")
findInAngularRepository(variable) match {
- case Some(value) => statement.replaceAll(escapedExp,value.toString)
+ case Some(value) => statement.replaceAll(escapedExp, value.toString)
case None =>
val listChoices:List[String] = choices.trim.split(CHOICES_SEPARATOR).toList
val paramOptions = listChoices.map(choice => new ParamOption(choice, choice))
@@ -371,13 +372,13 @@ class InterpreterLogic(val session: CqlSession, val properties: Properties) {
statement.replaceAll(escapedExp,selected.toString)
}
- case SIMPLE_VARIABLE_DEFINITION_PATTERN(variable,defaultVal) =>
- val escapedExp: String = exp.replaceAll( """\{""", """\\{""").replaceAll( """\}""", """\\}""")
+ case SIMPLE_VARIABLE_DEFINITION_PATTERN(variable, defaultVal) =>
+ val escapedExp: String = exp.replaceAll( """\{""", """\\{""").replaceAll( """}""", """\\}""")
findInAngularRepository(variable) match {
case Some(value) => statement.replaceAll(escapedExp,value.toString)
case None =>
- val value = context.getGui.input(variable,defaultVal)
- statement.replaceAll(escapedExp,value.toString)
+ val value = context.getGui.input(variable, defaultVal)
+ statement.replaceAll(escapedExp, value.toString)
}
case _ =>
@@ -453,7 +454,6 @@ class InterpreterLogic(val session: CqlSession, val properties: Properties) {
case _ => throw new InterpreterException(s"Cannot parse date '$dateString'. " +
s"Accepted formats : $STANDARD_DATE_FORMAT OR $ACCURATE_DATE_FORMAT");
}
- // TODO(alex): check about timezone...
LocalDateTime.parse(dateString, formatter).toInstant(ZoneOffset.UTC)
}
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/ParagraphParser.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/ParagraphParser.scala
index e57509c..c19f0af 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/ParagraphParser.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/ParagraphParser.scala
@@ -47,10 +47,10 @@ object ParagraphParser {
val REQUEST_TIMEOUT_PATTERN: Regex = """^\s*@requestTimeOut\s*=\s*([0-9]+)\s*$""".r
val SIMPLE_STATEMENT_PATTERN: Regex = """([^;]+;)""".r
- val PREPARE_STATEMENT_PATTERN: Regex = """^\s*@prepare\[([^]]+)\]\s*=\s*([^;]+)$""".r
- val REMOVE_PREPARE_STATEMENT_PATTERN: Regex = """^\s*@remove_prepare\[([^]]+)\]\s*$""".r
+ val PREPARE_STATEMENT_PATTERN: Regex = """^\s*@prepare\[([^]]+)]\s*=\s*([^;]+)$""".r
+ val REMOVE_PREPARE_STATEMENT_PATTERN: Regex = """^\s*@remove_prepare\[([^]]+)]\s*$""".r
- val BIND_PATTERN: Regex = """^\s*@bind\[([^]]+)\](?:=([^;]+))?""".r
+ val BIND_PATTERN: Regex = """^\s*@bind\[([^]]+)](?:=([^;]+))?""".r
val BATCH_PATTERN: Regex = """^(?i)\s*BEGIN\s+(UNLOGGED|COUNTER)?\s*BATCH""".r
/**
diff --git a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/TextBlockHierarchy.scala b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/TextBlockHierarchy.scala
index 790d397..222584a 100644
--- a/cassandra/src/main/scala/org/apache/zeppelin/cassandra/TextBlockHierarchy.scala
+++ b/cassandra/src/main/scala/org/apache/zeppelin/cassandra/TextBlockHierarchy.scala
@@ -16,7 +16,6 @@
*/
package org.apache.zeppelin.cassandra
-import com.datastax.driver.core._
import com.datastax.oss.driver.api.core.ConsistencyLevel
import com.datastax.oss.driver.api.core.cql.BatchType
@@ -171,6 +170,6 @@ object TextBlockHierarchy {
}
}
- case class HelpCmd(val statement:String = "HELP;") extends QueryStatement(HelpStatementType)
+ case class HelpCmd(statement: String = "HELP;") extends QueryStatement(HelpStatementType)
}
diff --git a/cassandra/src/test/java/org/apache/zeppelin/cassandra/CassandraInterpreterTest.java b/cassandra/src/test/java/org/apache/zeppelin/cassandra/CassandraInterpreterTest.java
index 5f09394..e2fa350 100644
--- a/cassandra/src/test/java/org/apache/zeppelin/cassandra/CassandraInterpreterTest.java
+++ b/cassandra/src/test/java/org/apache/zeppelin/cassandra/CassandraInterpreterTest.java
@@ -65,11 +65,10 @@ import static org.assertj.core.api.Assertions.assertThat;
public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestCase {
private static final String ARTISTS_TABLE = "zeppelin.artists";
- private static final int DEFAULT_UNIT_TEST_PORT = 9142;
private static volatile CassandraInterpreter interpreter;
- private InterpreterContext intrContext = InterpreterContext.builder()
+ private final InterpreterContext intrContext = InterpreterContext.builder()
.setParagraphTitle("Paragraph1")
.build();
@@ -124,13 +123,13 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_create_cluster_and_session_upon_call_to_open() throws Exception {
+ public void should_create_cluster_and_session_upon_call_to_open(){
assertThat(interpreter.session).isNotNull();
assertThat(interpreter.helper).isNotNull();
}
@Test
- public void should_set_custom_option() throws Exception {
+ public void should_set_custom_option() {
assertThat(interpreter.session).isNotNull();
DriverExecutionProfile config = interpreter.session.getContext()
.getConfig().getDefaultProfile();
@@ -139,7 +138,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_interpret_simple_select() throws Exception {
+ public void should_interpret_simple_select() {
//Given
//When
@@ -168,7 +167,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_interpret_select_statement() throws Exception {
+ public void should_interpret_select_statement() {
//Given
//When
@@ -186,7 +185,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_interpret_select_statement_with_cql_format() throws Exception {
+ public void should_interpret_select_statement_with_cql_format() {
//When
intrContext.getLocalProperties().put("outputFormat", "cql");
final InterpreterResult actual = interpreter.interpret(
@@ -204,7 +203,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_interpret_select_statement_with_formatting_options() throws Exception {
+ public void should_interpret_select_statement_with_formatting_options() {
//When
Map<String, String> props = intrContext.getLocalProperties();
props.put("outputFormat", "human");
@@ -265,7 +264,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_throw_statement_not_having_semi_colon() throws Exception {
+ public void should_throw_statement_not_having_semi_colon() {
//Given
String statement = "SELECT * zeppelin.albums";
@@ -281,7 +280,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_validate_statement() throws Exception {
+ public void should_validate_statement() {
//Given
String statement = "SELECT * zeppelin.albums;";
@@ -296,7 +295,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_statement_with_consistency_option() throws Exception {
+ public void should_execute_statement_with_consistency_option() {
//Given
String statement = "@consistency=THREE\n" +
"SELECT * FROM zeppelin.artists LIMIT 1;";
@@ -312,7 +311,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_statement_with_serial_consistency_option() throws Exception {
+ public void should_execute_statement_with_serial_consistency_option() {
//Given
String statement = "@serialConsistency=SERIAL\n" +
"SELECT * FROM zeppelin.artists LIMIT 1;";
@@ -354,7 +353,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_statement_with_request_timeout() throws Exception {
+ public void should_execute_statement_with_request_timeout() {
//Given
String statement = "@requestTimeOut=10000000\n" +
"SELECT * FROM zeppelin.artists;";
@@ -367,7 +366,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_prepared_and_bound_statements() throws Exception {
+ public void should_execute_prepared_and_bound_statements() {
//Given
String queries = "@prepare[ps]=INSERT INTO zeppelin.prepared(key,val) VALUES(?,?)\n" +
"@prepare[select]=SELECT * FROM zeppelin.prepared WHERE key=:key\n" +
@@ -384,7 +383,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_bound_statement() throws Exception {
+ public void should_execute_bound_statement() {
//Given
String queries = "@prepare[users_insert]=INSERT INTO zeppelin.users" +
"(login,firstname,lastname,addresses,location)" +
@@ -414,7 +413,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_exception_when_executing_unknown_bound_statement() throws Exception {
+ public void should_exception_when_executing_unknown_bound_statement() {
//Given
String queries = "@bind[select_users]='jdoe'";
@@ -429,7 +428,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_extract_variable_from_statement() throws Exception {
+ public void should_extract_variable_from_statement() {
//Given
AngularObjectRegistry angularObjectRegistry = new AngularObjectRegistry("cassandra", null);
GUI gui = new GUI();
@@ -455,7 +454,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_just_prepare_statement() throws Exception {
+ public void should_just_prepare_statement() {
//Given
String queries = "@prepare[just_prepare]=SELECT name,country,styles " +
"FROM zeppelin.artists LIMIT 3";
@@ -471,7 +470,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_execute_bound_statement_with_no_bound_value() throws Exception {
+ public void should_execute_bound_statement_with_no_bound_value() {
//Given
String queries = "@prepare[select_no_bound_value]=SELECT name,country,styles " +
"FROM zeppelin.artists LIMIT 3\n" +
@@ -489,7 +488,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_parse_date_value() throws Exception {
+ public void should_parse_date_value() {
//Given
String queries = "@prepare[parse_date]=INSERT INTO zeppelin.users(login,last_update) " +
"VALUES(?,?)\n" +
@@ -504,7 +503,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_bind_null_value() throws Exception {
+ public void should_bind_null_value() {
//Given
String queries = "@prepare[bind_null]=INSERT INTO zeppelin.users(login,firstname,lastname) " +
"VALUES(?,?,?)\n" +
@@ -520,7 +519,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_bind_boolean_value() throws Exception {
+ public void should_bind_boolean_value() {
//Given
String queries = "@prepare[bind_boolean]=INSERT INTO zeppelin.users(login,deceased) " +
"VALUES(?,?)\n" +
@@ -536,7 +535,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_fail_when_executing_a_removed_prepared_statement() throws Exception {
+ public void should_fail_when_executing_a_removed_prepared_statement() {
//Given
String prepareFirst = "@prepare[to_be_removed]=INSERT INTO zeppelin.users(login,deceased) " +
"VALUES(?,?)";
@@ -555,7 +554,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_display_statistics_for_non_select_statement() throws Exception {
+ public void should_display_statistics_for_non_select_statement() {
//Given
String query = "USE zeppelin;\nCREATE TABLE IF NOT EXISTS no_select(id int PRIMARY KEY);";
final String rawResult = reformatHtml(readTestResource(
@@ -574,7 +573,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_error_and_display_stack_trace() throws Exception {
+ public void should_error_and_display_stack_trace() {
//Given
String query = "@consistency=THREE\n" +
"SELECT * FROM zeppelin.users LIMIT 3;";
@@ -588,7 +587,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_cluster() throws Exception {
+ public void should_describe_cluster() {
//Given
String query = "DESCRIBE CLUSTER;";
@@ -604,7 +603,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_keyspaces() throws Exception {
+ public void should_describe_keyspaces() {
//Given
String query = "DESCRIBE KEYSPACES;";
final String expected = reformatHtml(
@@ -619,7 +618,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_keyspace() throws Exception {
+ public void should_describe_keyspace() {
//Given
String query = "DESCRIBE KEYSPACE live_data;";
final String expected = reformatHtml(
@@ -703,7 +702,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_table() throws Exception {
+ public void should_describe_table() {
//Given
String query = "DESCRIBE TABLE live_data.complex_table;";
final String expected = reformatHtml(
@@ -718,7 +717,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_udt() throws Exception {
+ public void should_describe_udt() {
//Given
String query = "DESCRIBE TYPE live_data.address;";
final String expected = reformatHtml(
@@ -733,7 +732,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_udt_withing_logged_in_keyspace() throws Exception {
+ public void should_describe_udt_withing_logged_in_keyspace() {
//Given
String query = "USE live_data;\n" +
"DESCRIBE TYPE address;";
@@ -749,7 +748,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_all_tables() throws Exception {
+ public void should_describe_all_tables() {
//Given
String query = "DESCRIBE TABLES;";
final String expected = reformatHtml(readTestResource(
@@ -764,7 +763,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_describe_all_udts() throws Exception {
+ public void should_describe_all_udts() {
//Given
String query = "DESCRIBE TYPES;";
final String expected = reformatHtml(readTestResource(
@@ -780,7 +779,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
@Test
- public void should_error_describing_non_existing_table() throws Exception {
+ public void should_error_describing_non_existing_table() {
//Given
String query = "USE system;\n" +
"DESCRIBE TABLE complex_table;";
@@ -795,7 +794,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_error_describing_non_existing_udt() throws Exception {
+ public void should_error_describing_non_existing_udt() {
//Given
String query = "USE system;\n" +
"DESCRIBE TYPE address;";
@@ -809,7 +808,7 @@ public class CassandraInterpreterTest { //extends AbstractCassandraUnit4CQLTestC
}
@Test
- public void should_show_help() throws Exception {
+ public void should_show_help() {
//Given
String query = "HELP;";
final String expected = reformatHtml(readTestResource("/scalate/Help.html"));
diff --git a/cassandra/src/test/java/org/apache/zeppelin/cassandra/InterpreterLogicTest.java b/cassandra/src/test/java/org/apache/zeppelin/cassandra/InterpreterLogicTest.java
index 4617b54..fda915d 100644
--- a/cassandra/src/test/java/org/apache/zeppelin/cassandra/InterpreterLogicTest.java
+++ b/cassandra/src/test/java/org/apache/zeppelin/cassandra/InterpreterLogicTest.java
@@ -32,7 +32,6 @@ import static org.mockito.Mockito.when;
import static java.util.Arrays.asList;
-import com.datastax.oss.driver.api.core.ConsistencyLevel;
import com.datastax.oss.driver.api.core.CqlSession;
import com.datastax.oss.driver.api.core.cql.BatchStatement;
import com.datastax.oss.driver.api.core.cql.BatchableStatement;
@@ -54,6 +53,7 @@ import java.time.ZonedDateTime;
import java.time.temporal.ChronoField;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collections;
import java.util.List;
import java.util.Properties;
@@ -89,12 +89,12 @@ public class InterpreterLogicTest {
ArgumentCaptor<ParamOption[]> optionsCaptor;
@Test
- public void should_parse_input_string_block() throws Exception {
+ public void should_parse_input_string_block() {
//Given
String input = "SELECT * FROM users LIMIT 10;";
//When
- final List<AnyBlock> anyBlocks = this.<AnyBlock>toJavaList(helper.parseInput(input));
+ final List<AnyBlock> anyBlocks = this.toJavaList(helper.parseInput(input));
//Then
assertThat(anyBlocks).hasSize(1);
@@ -102,12 +102,12 @@ public class InterpreterLogicTest {
}
@Test
- public void should_parse_input_string_block_with_comment_dash() throws Exception {
+ public void should_parse_input_string_block_with_comment_dash() {
//Given
String input = "SELECT * FROM users LIMIT 10; -- this is a comment";
//When
- final List<AnyBlock> anyBlocks = this.<AnyBlock>toJavaList(helper.parseInput(input));
+ final List<AnyBlock> anyBlocks = this.toJavaList(helper.parseInput(input));
//Then
assertThat(anyBlocks).hasSize(2);
@@ -116,12 +116,12 @@ public class InterpreterLogicTest {
}
@Test
- public void should_parse_input_string_block_with_comment_slash() throws Exception {
+ public void should_parse_input_string_block_with_comment_slash() {
//Given
String input = "SELECT * FROM users LIMIT 10; // this is a comment";
//When
- final List<AnyBlock> anyBlocks = this.<AnyBlock>toJavaList(helper.parseInput(input));
+ final List<AnyBlock> anyBlocks = this.toJavaList(helper.parseInput(input));
//Then
assertThat(anyBlocks).hasSize(2);
@@ -130,7 +130,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_exception_while_parsing_input() throws Exception {
+ public void should_exception_while_parsing_input() {
//Given
String input = "SELECT * FROM users LIMIT 10";
@@ -144,7 +144,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_variable_and_default_value() throws Exception {
+ public void should_extract_variable_and_default_value() {
//Given
AngularObjectRegistry angularObjectRegistry = new AngularObjectRegistry("cassandra", null);
when(intrContext.getAngularObjectRegistry()).thenReturn(angularObjectRegistry);
@@ -160,7 +160,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_variable_and_choices() throws Exception {
+ public void should_extract_variable_and_choices() {
//Given
AngularObjectRegistry angularObjectRegistry = new AngularObjectRegistry("cassandra", null);
when(intrContext.getAngularObjectRegistry()).thenReturn(angularObjectRegistry);
@@ -181,7 +181,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_no_variable() throws Exception {
+ public void should_extract_no_variable() {
//Given
GUI gui = mock(GUI.class);
when(intrContext.getGui()).thenReturn(gui);
@@ -195,7 +195,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_variable_from_angular_object_registry() throws Exception {
+ public void should_extract_variable_from_angular_object_registry() {
//Given
AngularObjectRegistry angularObjectRegistry = new AngularObjectRegistry("cassandra", null);
angularObjectRegistry.add("id", "from_angular_registry", "noteId", "paragraphId");
@@ -213,7 +213,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_error_if_incorrect_variable_definition() throws Exception {
+ public void should_error_if_incorrect_variable_definition() {
//Given
//When
@@ -228,9 +228,9 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_consistency_option() throws Exception {
+ public void should_extract_consistency_option() {
//Given
- List<QueryParameters> options = Arrays.<QueryParameters>asList(new Consistency(ALL),
+ List<QueryParameters> options = Arrays.asList(new Consistency(ALL),
new Consistency(ONE));
//When
@@ -241,9 +241,9 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_serial_consistency_option() throws Exception {
+ public void should_extract_serial_consistency_option() {
//Given
- List<QueryParameters> options = Arrays.<QueryParameters>asList(new SerialConsistency(SERIAL),
+ List<QueryParameters> options = Arrays.asList(new SerialConsistency(SERIAL),
new SerialConsistency(LOCAL_SERIAL));
//When
@@ -254,9 +254,9 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_timestamp_option() throws Exception {
+ public void should_extract_timestamp_option() {
//Given
- List<QueryParameters> options = Arrays.<QueryParameters>asList(new Timestamp(123L),
+ List<QueryParameters> options = Arrays.asList(new Timestamp(123L),
new Timestamp(456L));
//When
@@ -267,9 +267,9 @@ public class InterpreterLogicTest {
}
@Test
- public void should_extract_request_timeout_option() throws Exception {
+ public void should_extract_request_timeout_option() {
//Given
- List<QueryParameters> options = Arrays.<QueryParameters>asList(new RequestTimeOut(100));
+ List<QueryParameters> options = Collections.singletonList(new RequestTimeOut(100));
//When
final CassandraQueryOptions actual = helper.extractQueryOptions(toScalaList(options));
@@ -279,11 +279,11 @@ public class InterpreterLogicTest {
}
@Test
- public void should_generate_simple_statement() throws Exception {
+ public void should_generate_simple_statement() {
//Given
String input = "SELECT * FROM users LIMIT 10;";
CassandraQueryOptions options = new CassandraQueryOptions(Option.apply(QUORUM),
- Option.<ConsistencyLevel>empty(),
+ Option.empty(),
Option.empty(),
Option.empty(),
Option.empty());
@@ -299,14 +299,14 @@ public class InterpreterLogicTest {
}
@Test
- public void should_generate_batch_statement() throws Exception {
+ public void should_generate_batch_statement() {
//Given
SimpleStatement st1 = SimpleStatement.newInstance("SELECT * FROM users LIMIT 10;");
SimpleStatement st2 = SimpleStatement.newInstance("INSERT INTO users(id) VALUES(10);");
SimpleStatement st3 = SimpleStatement.newInstance(
"UPDATE users SET name = 'John DOE' WHERE id=10;");
CassandraQueryOptions options = new CassandraQueryOptions(Option.apply(QUORUM),
- Option.<ConsistencyLevel>empty(),
+ Option.empty(),
Option.empty(),
Option.empty(),
Option.empty());
@@ -317,7 +317,7 @@ public class InterpreterLogicTest {
//Then
assertThat(actual).isNotNull();
- List<BatchableStatement> statements = new ArrayList<BatchableStatement>();
+ List<BatchableStatement> statements = new ArrayList<>();
for (BatchableStatement b: actual) {
statements.add(b);
}
@@ -329,12 +329,12 @@ public class InterpreterLogicTest {
}
@Test
- public void should_parse_bound_values() throws Exception {
+ public void should_parse_bound_values() {
//Given
String bs = "'jdoe',32,'John DOE',null, true, '2014-06-12 34:00:34'";
//When
- final List<String> actual = this.<String>toJavaList(helper.parseBoundValues("ps", bs));
+ final List<String> actual = this.toJavaList(helper.parseBoundValues("ps", bs));
//Then
assertThat(actual).containsExactly("'jdoe'", "32", "'John DOE'",
@@ -342,7 +342,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_parse_simple_date() throws Exception {
+ public void should_parse_simple_date() {
//Given
String dateString = "2015-07-30 12:00:01";
@@ -361,7 +361,7 @@ public class InterpreterLogicTest {
}
@Test
- public void should_parse_accurate_date() throws Exception {
+ public void should_parse_accurate_date() {
//Given
String dateString = "2015-07-30 12:00:01.123";
diff --git a/cassandra/src/test/resources/scalate/Help.html b/cassandra/src/test/resources/scalate/Help.html
index 95c461b..32b7808 100644
--- a/cassandra/src/test/resources/scalate/Help.html
+++ b/cassandra/src/test/resources/scalate/Help.html
@@ -1 +1 @@
-<div class="container"><div class="panel panel-default"><div class="panel-heading" role="tab"><h4 class="panel-title"><a role="button" data-toggle="collapse" aria-expanded="false"><span class="text-info"><strong>Basic Commands</strong></span></a></h4></div><div class="panel-collapse collapse in" role="tabpanel"><div class="panel-body"><div class="panel panel-default"><div class="panel-body"><h3>I CQL Statements</h3><p>This interpreter is compatible with any CQL statement supported by C [...]
+<div class="container"><div class="panel panel-default"><div class="panel-heading" role="tab"><h4 class="panel-title"><a role="button" data-toggle="collapse" aria-expanded="false"><span class="text-info"><strong>Basic Commands</strong></span></a></h4></div><div class="panel-collapse collapse" role="tabpanel"><div class="panel-body"><div class="panel panel-default"><div class="panel-body"><h3>I CQL Statements</h3><p>This interpreter is compatible with any CQL statement supported by Cass [...]
diff --git a/cassandra/src/test/scala/org/apache/zeppelin/cassandra/CqlFormatterTest.scala b/cassandra/src/test/scala/org/apache/zeppelin/cassandra/CqlFormatterTest.scala
index 9bb3866..b855232 100644
--- a/cassandra/src/test/scala/org/apache/zeppelin/cassandra/CqlFormatterTest.scala
+++ b/cassandra/src/test/scala/org/apache/zeppelin/cassandra/CqlFormatterTest.scala
@@ -18,13 +18,11 @@ package org.apache.zeppelin.cassandra
import java.net.InetAddress
import java.nio.ByteBuffer
-import java.time.{Instant, LocalDate, LocalTime, ZoneId}
+import java.time.{Instant, LocalDate, LocalTime}
import java.util.Properties
-import com.datastax.oss.driver.api.core.`type`.{DataTypes, UserDefinedType}
+import com.datastax.oss.driver.api.core.`type`.DataTypes
import com.datastax.oss.driver.api.core.`type`.codec.registry.CodecRegistry
-import com.datastax.oss.driver.api.core.detach.AttachmentPoint
-import io.netty.buffer.ByteBufUtil
import org.scalatest.{BeforeAndAfterEach, FlatSpec, Matchers}
import scala.collection.JavaConverters._
diff --git a/cassandra/src/test/scala/org/apache/zeppelin/cassandra/ParagraphParserTest.scala b/cassandra/src/test/scala/org/apache/zeppelin/cassandra/ParagraphParserTest.scala
index 7998390..19afafc 100644
--- a/cassandra/src/test/scala/org/apache/zeppelin/cassandra/ParagraphParserTest.scala
+++ b/cassandra/src/test/scala/org/apache/zeppelin/cassandra/ParagraphParserTest.scala
@@ -17,7 +17,7 @@
package org.apache.zeppelin.cassandra
import com.datastax.oss.driver.api.core.{ConsistencyLevel, CqlSession}
-import com.datastax.oss.driver.api.core.cql.{BatchStatement, BatchType, PreparedStatement}
+import com.datastax.oss.driver.api.core.cql.{BatchType, PreparedStatement}
import org.apache.zeppelin.interpreter.InterpreterException
import org.scalatest.mock.MockitoSugar
import org.scalatest.{BeforeAndAfterEach, FlatSpec, Matchers}
diff --git a/docs/interpreter/cassandra.md b/docs/interpreter/cassandra.md
index 69487e4..2088f9f 100644
--- a/docs/interpreter/cassandra.md
+++ b/docs/interpreter/cassandra.md
@@ -179,7 +179,7 @@ The complete list of all CQL statements and versions can be found below:
</td>
</tr>
<tr>
- <td><strong>2.1 & 2.0</strong></td>
+ <td><strong>2.1</strong></td>
<td>
<a target="_blank"
href="http://docs.datastax.com/en/cql/3.1/cql/cql_intro_c.html">
@@ -187,15 +187,6 @@ The complete list of all CQL statements and versions can be found below:
</a>
</td>
</tr>
- <tr>
- <td><strong>1.2</strong></td>
- <td>
- <a target="_blank"
- href="https://docs.datastax.com/en/archived/cql/3.1/cql/cql_intro_c.html">
- https://docs.datastax.com/en/archived/cql/3.1/cql/cql_intro_c.html
- </a>
- </td>
- </tr>
</table>
</center>
@@ -907,11 +898,13 @@ Besides these parameters, it's also possible to set other driver parameters by a
**4.0** _(Zeppelin {{ site.ZEPPELIN_VERSION }})_ :
-* Refactor to use unified Java driver 4.5 ([ZEPPELIN-4378](https://issues.apache.org/jira/browse/ZEPPELIN-4378):
+* Refactor to use unified Java driver 4.7 ([ZEPPELIN-4378](https://issues.apache.org/jira/browse/ZEPPELIN-4378):
* changes in configuration were necessary, as new driver has different architecture, and configuration options
* interpreter got support for DSE-specific data types, and other extensions
* support for `@retryPolicy` is removed, as only single retry policy is shipped with driver
- * added support for formatting options, both interpreter & cell level
+ * allow to specify any configuration option of Java driver
+ * dropped support for Cassandra 1.2 & 2.0, that isn't supported by driver anymore
+* added support for formatting options, both interpreter & cell level
**3.1** _(Zeppelin {{ site.ZEPPELIN_VERSION }})_ :