From 058161d2d53c3fe9bc0f1dc2bb738bf0f6a41a13 Mon Sep 17 00:00:00 2001 From: DuyHai DOAN Date: Tue, 5 Jan 2016 15:54:25 +0100 Subject: [PATCH 1/9] Upgrade Java driver version to 3.0.0-rc1 --- cassandra/pom.xml | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/cassandra/pom.xml b/cassandra/pom.xml index 57b501a7a69..82bb412f1d1 100644 --- a/cassandra/pom.xml +++ b/cassandra/pom.xml @@ -35,18 +35,19 @@ http://zeppelin.incubator.apache.org - 2.1.7.1 + 3.0.0-rc1 1.0.5.4 - 1.2.0 - 2.11.7 - 2.11 - 3.4 + 1.3.0 + 2.10.4 + 2.10 + 3.3.2 1.7.1 + 16.0.1 2.2.4 4.12 - 3.2.2 + 3.2.4-Zeppelin 1.7.0 1.9.5 @@ -65,6 +66,12 @@ ${cassandra.driver.version} + + com.google.guava + guava + ${cassandra.guava.version} + + @@ -130,7 +137,7 @@ info.archinnov - achilles-junit + achilles-embedded ${achilles.version} test @@ -145,13 +152,6 @@ - - com.google.guava - guava - 16.0 - test - - org.mockito mockito-core From 6b46076ecb592e5c8b3da0333da057aa64dd5563 Mon Sep 17 00:00:00 2001 From: DuyHai DOAN Date: Tue, 5 Jan 2016 15:54:54 +0100 Subject: [PATCH 2/9] Add Support for UDF, UDA and Materialized Views --- .../resources/scalate/aggregateDetails.ssp | 81 ++ .../main/resources/scalate/allAggregates.ssp | 68 ++ .../main/resources/scalate/allFunctions.ssp | 68 ++ .../scalate/allMaterializedViews.ssp | 68 ++ .../src/main/resources/scalate/allTables.ssp | 8 - .../src/main/resources/scalate/allUDTs.ssp | 61 ++ .../scalate/dropDownMenuForKeyspace.ssp | 37 +- .../resources/scalate/functionDetails.ssp | 77 ++ .../resources/scalate/keyspaceContent.ssp | 90 ++ .../resources/scalate/keyspaceDetails.ssp | 2 +- .../scalate/materializedViewDetails.ssp | 109 +++ cassandra/src/main/resources/scalate/menu.ssp | 22 +- .../main/resources/scalate/tableDetails.ssp | 83 +- .../src/main/resources/scalate/udtDetails.ssp | 2 +- .../zeppelin/cassandra/DisplaySystem.scala | 417 +++++++-- .../zeppelin/cassandra/EnhancedSession.scala | 108 ++- .../zeppelin/cassandra/InterpreterLogic.scala | 25 +- .../cassandra/MetaDataHierarchy.scala | 31 +- .../zeppelin/cassandra/ParagraphParser.scala | 165 +++- .../cassandra/TextBlockHierarchy.scala | 46 +- .../cassandra/CassandraInterpreterTest.java | 93 +- .../cassandra/InterpreterLogicTest.java | 4 +- .../resources/scalate/DescribeCluster.html | 99 +-- .../scalate/DescribeKeyspace_live_data.html | 820 +----------------- .../resources/scalate/DescribeKeyspaces.html | 401 +-------- ...DescribeTable_live_data_complex_table.html | 327 +------ .../DescribeType_live_data_address.html | 138 +-- ..._data_address_within_current_keyspace.html | 138 +-- .../cassandra/ParagraphParserTest.scala | 305 ++++++- 29 files changed, 1741 insertions(+), 2152 deletions(-) create mode 100644 cassandra/src/main/resources/scalate/aggregateDetails.ssp create mode 100644 cassandra/src/main/resources/scalate/allAggregates.ssp create mode 100644 cassandra/src/main/resources/scalate/allFunctions.ssp create mode 100644 cassandra/src/main/resources/scalate/allMaterializedViews.ssp create mode 100644 cassandra/src/main/resources/scalate/allUDTs.ssp create mode 100644 cassandra/src/main/resources/scalate/functionDetails.ssp create mode 100644 cassandra/src/main/resources/scalate/materializedViewDetails.ssp diff --git a/cassandra/src/main/resources/scalate/aggregateDetails.ssp b/cassandra/src/main/resources/scalate/aggregateDetails.ssp new file mode 100644 index 00000000000..02800a2bd62 --- /dev/null +++ b/cassandra/src/main/resources/scalate/aggregateDetails.ssp @@ -0,0 +1,81 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +<%@ val sameNameAggregateDetails: SameNameAggregateDetails %> +<%@ val withCaption: Boolean%> +
+
+
+ #for (aggregate <- sameNameAggregateDetails.aggregates) +
+ + #if(withCaption) + + #end + + + + + + + + + + + + + + + + + + #if(aggregate.finalFunc.isDefined) + + + + + #end + #if(aggregate.initCond.isDefined) + + + + + #end + + + + + +

 ${aggregate.name}

Keyspace${aggregate.keyspace}
Arguments${aggregate.arguments.toList.mkString(", ")}
State Function${aggregate.sFunc}
State Type${aggregate.sType}
Final Function${aggregate.finalFunc.get}
Initial State${aggregate.initCond.get}
Return type${aggregate.returnType}
+ +
+
+ #end +
+
+
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/allAggregates.ssp b/cassandra/src/main/resources/scalate/allAggregates.ssp new file mode 100644 index 00000000000..f093c507d97 --- /dev/null +++ b/cassandra/src/main/resources/scalate/allAggregates.ssp @@ -0,0 +1,68 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> + +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +#import(java.util.UUID) +<%@ val allAggregates: Map[(UUID, String), List[AggregateSummary]] %> + +
+ +
+
+ #for (((ksId,ksName), aggregates) <- allAggregates) +
+ +
+
+
+
+
+ + + + + + + + + #for (aggregate <- aggregates) + + + + + #end + + +
AggregateReturn Type
${aggregate.name + aggregate.arguments.mkString("(", ", ", ")")}${aggregate.returnType}
+
+
+
+
+
+
+ #end +
+
+
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/allFunctions.ssp b/cassandra/src/main/resources/scalate/allFunctions.ssp new file mode 100644 index 00000000000..fc756a42aa6 --- /dev/null +++ b/cassandra/src/main/resources/scalate/allFunctions.ssp @@ -0,0 +1,68 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> + +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +#import(java.util.UUID) +<%@ val allFunctions: Map[(UUID, String), List[FunctionSummary]] %> + +
+ +
+
+ #for (((ksId,ksName), functions) <- allFunctions) +
+ +
+
+
+
+
+ + + + + + + + + #for (function <- functions) + + + + + #end + + +
FunctionReturn Type
${function.name + function.arguments.mkString("(",", ", ")")}${function.returnType}
+
+
+
+
+
+
+ #end +
+
+
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/allMaterializedViews.ssp b/cassandra/src/main/resources/scalate/allMaterializedViews.ssp new file mode 100644 index 00000000000..8ffee573a6c --- /dev/null +++ b/cassandra/src/main/resources/scalate/allMaterializedViews.ssp @@ -0,0 +1,68 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +#import(java.util.UUID) +<%@ val allMVs: Map[(UUID,String),List[MaterializedViewSummary]] %> +
+ +
+
+ #for (((ksId,ksName), mvs) <- allMVs) +
+ +
+
+
+
+
+ + + + + + #for (mv <- mvs) + + + + + #end + + +
Materialized View
+ ${mv.name} +   +   +  ${mv.baseTable} +
+
+
+
+
+
+
+ #end +
+
+
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/allTables.ssp b/cassandra/src/main/resources/scalate/allTables.ssp index b363bee6b89..810881ba8ce 100644 --- a/cassandra/src/main/resources/scalate/allTables.ssp +++ b/cassandra/src/main/resources/scalate/allTables.ssp @@ -24,7 +24,6 @@
#for (((ksId,ksName), tables) <- allTables) -
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/allUDTs.ssp b/cassandra/src/main/resources/scalate/allUDTs.ssp new file mode 100644 index 00000000000..559ef41af5a --- /dev/null +++ b/cassandra/src/main/resources/scalate/allUDTs.ssp @@ -0,0 +1,61 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +#import(java.util.UUID) +<%@ val allUDTs: Map[(UUID,String),List[String]] %> +
+ +
+
+ #for (((ksId,ksName), udts) <- allUDTs) +
+ +
+
+
+
+
+ + + + + + #for (udt <- udts) + + + #end + + +
UDT
${udt}
+
+
+
+
+
+
+ #end +
+
+
\ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/dropDownMenuForKeyspace.ssp b/cassandra/src/main/resources/scalate/dropDownMenuForKeyspace.ssp index 74f6fbc8970..b695a9bf3c6 100644 --- a/cassandra/src/main/resources/scalate/dropDownMenuForKeyspace.ssp +++ b/cassandra/src/main/resources/scalate/dropDownMenuForKeyspace.ssp @@ -35,8 +35,19 @@ #end #end - #if(ksContent.udts.nonEmpty) + #if(ksContent.views.nonEmpty) + + + #for((id,name,_) <- ksContent.views) +
  • + +  ${name} + +
  • + #end + #end + #if(ksContent.udts.nonEmpty) #for((id,name,_) <- ksContent.udts) @@ -47,6 +58,30 @@ #end #end + + #if(ksContent.functions.nonEmpty) + + + #for((id,name,_) <- ksContent.functions) +
  • + +  ${name} + +
  • + #end + #end + + #if(ksContent.aggregates.nonEmpty) + + + #for((id,name,_) <- ksContent.aggregates) +
  • + +  ${name} + +
  • + #end + #end \ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/functionDetails.ssp b/cassandra/src/main/resources/scalate/functionDetails.ssp new file mode 100644 index 00000000000..7d61400f7a5 --- /dev/null +++ b/cassandra/src/main/resources/scalate/functionDetails.ssp @@ -0,0 +1,77 @@ +<%-- +/* +* Licensed to the Apache Software Foundation (ASF) under one or more +* contributor license agreements. See the NOTICE file distributed with +* this work for additional information regarding copyright ownership. +* The ASF licenses this file to You under the Apache License, Version 2.0 +* (the "License"); you may not use this file except in compliance with +* the License. You may obtain a copy of the License at +* +* http://www.apache.org/licenses/LICENSE-2.0 +* +* Unless required by applicable law or agreed to in writing, software +* distributed under the License is distributed on an "AS IS" BASIS, +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +* See the License for the specific language governing permissions and +* limitations under the License. +*/ +--%> +#import(org.apache.zeppelin.cassandra.MetaDataHierarchy._) +<%@ val sameNameFunctionDetails: SameNameFunctionDetails %> +<%@ val withCaption: Boolean%> +
    +
    +
    + #for (function <- sameNameFunctionDetails.functions) +
    + + #if(withCaption) + + #end + + + + + + + + + + + + #if(function.calledOnNullInput) + + #else + + #end + + + + + + + + + + + + + + +

     ${function.name}

    Keyspace${function.keyspace}
    Arguments${function.arguments.toList.mkString(", ")}
    Null InputCALLED ON NULL INPUTRETURN NULL ON NULL INPUT
    Return type${function.returnType}
    Language${function.language}
    Body${escape(function.body)}
    + +
    +
    + #end +
    +
    +
    \ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/keyspaceContent.ssp b/cassandra/src/main/resources/scalate/keyspaceContent.ssp index 51390691976..152c657e609 100644 --- a/cassandra/src/main/resources/scalate/keyspaceContent.ssp +++ b/cassandra/src/main/resources/scalate/keyspaceContent.ssp @@ -57,6 +57,36 @@
    #end + #if (ksContent.views.nonEmpty) + + + + + +

    Materialized Views
    +
    +
    + #for((id,name,viewHTML) <- ksContent.views) + +
    + +
    +
    + ${unescape(viewHTML)} +
    +
    +
    + #end +
    +
    + #end + #if (ksContent.udts.nonEmpty) @@ -88,4 +118,64 @@ #end + #if (ksContent.functions.nonEmpty) + +
    + + + +

    Functions
    +
    +
    + #for((id,name,functionHTML) <- ksContent.functions) + +
    + +
    +
    + ${unescape(functionHTML)} +
    +
    +
    + #end +
    +
    + #end + + #if (ksContent.aggregates.nonEmpty) + + + + + +

    Aggregates
    +
    +
    + #for((id,name,aggregateHTML) <- ksContent.aggregates) + +
    + +
    +
    + ${unescape(aggregateHTML)} +
    +
    +
    + #end +
    +
    + #end +
    \ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/keyspaceDetails.ssp b/cassandra/src/main/resources/scalate/keyspaceDetails.ssp index beaf182cd89..c0b9f8f413e 100644 --- a/cassandra/src/main/resources/scalate/keyspaceDetails.ssp +++ b/cassandra/src/main/resources/scalate/keyspaceDetails.ssp @@ -46,7 +46,7 @@ + #if(tableDetails.indices.size > 0) +
    +
    + + + + + + + + + + #for (index <- tableDetails.indices) + + + + + #end + +

     ${tableDetails.tableName}'s indices

    +
    NameTarget
    ${index.name}${index.target}
    + +
    + #end
    \ No newline at end of file diff --git a/cassandra/src/main/resources/scalate/udtDetails.ssp b/cassandra/src/main/resources/scalate/udtDetails.ssp index 80380a4943d..28858f2b757 100644 --- a/cassandra/src/main/resources/scalate/udtDetails.ssp +++ b/cassandra/src/main/resources/scalate/udtDetails.ssp @@ -46,7 +46,7 @@