Skip to content

Commit

Permalink
Upped cypher compiler dependecy to 2.3.9
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Jan 24, 2017
1 parent 1c2325b commit 536793c
Show file tree
Hide file tree
Showing 5 changed files with 41 additions and 9 deletions.
2 changes: 1 addition & 1 deletion community/cypher/cypher/pom.xml
Expand Up @@ -185,7 +185,7 @@
<dependency>
<groupId>org.neo4j</groupId>
<artifactId>neo4j-cypher-compiler-2.3</artifactId>
<version>2.3.8</version>
<version>2.3.9</version>
<exclusions>
<exclusion>
<groupId>org.neo4j</groupId>
Expand Down
Expand Up @@ -28,7 +28,7 @@ import org.neo4j.cypher.{ConstraintValidationException, CypherExecutionException
import org.neo4j.graphdb.{ConstraintViolationException => KernelConstraintViolationException, Node, PropertyContainer, Relationship}
import org.neo4j.kernel.api.TokenNameLookup
import org.neo4j.kernel.api.exceptions.KernelException
import org.neo4j.kernel.api.index.IndexDescriptor
import org.neo4j.cypher.internal.compiler.v2_3.IndexDescriptor

class ExceptionTranslatingQueryContextFor2_3(inner: QueryContext) extends DelegatingQueryContext(inner) {
override def setLabelsOnNode(node: Long, labelIds: Iterator[Int]): Int =
Expand Down
@@ -0,0 +1,31 @@
/*
* Copyright (c) 2002-2017 "Neo Technology,"
* Network Engine for Objects in Lund AB [http://neotechnology.com]
*
* This file is part of Neo4j.
*
* Neo4j is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
package org.neo4j.cypher.internal.spi.v2_3

import org.neo4j.kernel.api.index.{IndexDescriptor => KernelIndexDescriptor}
import org.neo4j.cypher.internal.compiler.v2_3.{IndexDescriptor => CypherIndexDescriptor}

trait IndexDescriptorCompatibility {
implicit def cypherToKernel(index:CypherIndexDescriptor) =
new KernelIndexDescriptor( index.label, index.property )

implicit def kernelToCypher(index:KernelIndexDescriptor) =
CypherIndexDescriptor( index.getLabelId, index.getPropertyKeyId )
}
Expand Up @@ -20,6 +20,7 @@
package org.neo4j.cypher.internal.spi.v2_3

import org.neo4j.cypher.MissingIndexException
import org.neo4j.cypher.internal.compiler.v2_3.{IndexDescriptor => CypherIndexDescriptor}
import org.neo4j.cypher.internal.compiler.v2_3.pipes.EntityProducer
import org.neo4j.cypher.internal.compiler.v2_3.pipes.matching.ExpanderStep
import org.neo4j.cypher.internal.compiler.v2_3.spi._
Expand All @@ -28,16 +29,16 @@ import org.neo4j.graphdb.Node
import org.neo4j.kernel.api.constraints.UniquenessConstraint
import org.neo4j.kernel.api.exceptions.KernelException
import org.neo4j.kernel.api.exceptions.schema.SchemaKernelException
import org.neo4j.kernel.api.index.{IndexDescriptor, InternalIndexState}
import org.neo4j.kernel.api.index.{IndexDescriptor => KernelIndexDescriptor, InternalIndexState}
import org.neo4j.kernel.impl.transaction.log.TransactionIdStore

import scala.collection.JavaConverters._

class TransactionBoundPlanContext(tc: TransactionalContextWrapperv3_1)
extends TransactionBoundTokenContext(tc.statement) with PlanContext {
extends TransactionBoundTokenContext(tc.statement) with PlanContext with IndexDescriptorCompatibility {

@Deprecated
def getIndexRule(labelName: String, propertyKey: String): Option[IndexDescriptor] = evalOrNone {
def getIndexRule(labelName: String, propertyKey: String): Option[CypherIndexDescriptor] = evalOrNone {
val labelId = tc.statement.readOperations().labelGetForName(labelName)
val propertyKeyId = tc.statement.readOperations().propertyKeyGetForName(propertyKey)

Expand All @@ -53,7 +54,7 @@ class TransactionBoundPlanContext(tc: TransactionalContextWrapperv3_1)
onlineIndexDescriptors.nonEmpty
}

def getUniqueIndexRule(labelName: String, propertyKey: String): Option[IndexDescriptor] = evalOrNone {
def getUniqueIndexRule(labelName: String, propertyKey: String): Option[CypherIndexDescriptor] = evalOrNone {
val labelId = tc.statement.readOperations().labelGetForName(labelName)
val propertyKeyId = tc.statement.readOperations().propertyKeyGetForName(propertyKey)

Expand All @@ -64,7 +65,7 @@ class TransactionBoundPlanContext(tc: TransactionalContextWrapperv3_1)
private def evalOrNone[T](f: => Option[T]): Option[T] =
try { f } catch { case _: SchemaKernelException => None }

private def getOnlineIndex(descriptor: IndexDescriptor): Option[IndexDescriptor] =
private def getOnlineIndex(descriptor: KernelIndexDescriptor): Option[CypherIndexDescriptor] =
tc.statement.readOperations().indexGetState(descriptor) match {
case InternalIndexState.ONLINE => Some(descriptor)
case _ => None
Expand Down
Expand Up @@ -46,15 +46,15 @@ import org.neo4j.graphdb.traversal.{Evaluators, TraversalDescription, Uniqueness
import org.neo4j.kernel.GraphDatabaseQueryService
import org.neo4j.kernel.api.constraints.{NodePropertyExistenceConstraint, RelationshipPropertyExistenceConstraint, UniquenessConstraint}
import org.neo4j.kernel.api.exceptions.schema.{AlreadyConstrainedException, AlreadyIndexedException}
import org.neo4j.kernel.api.index.{IndexDescriptor, InternalIndexState}
import org.neo4j.kernel.api.index.InternalIndexState
import org.neo4j.kernel.api.{exceptions, _}
import org.neo4j.kernel.impl.core.NodeManager

import scala.collection.JavaConverters._
import scala.collection.{Iterator, mutable}

final class TransactionBoundQueryContext(tc: TransactionalContextWrapperv3_1)
extends TransactionBoundTokenContext(tc.statement) with QueryContext {
extends TransactionBoundTokenContext(tc.statement) with QueryContext with IndexDescriptorCompatibility {

override val nodeOps = new NodeOperations
override val relationshipOps = new RelationshipOperations
Expand Down

0 comments on commit 536793c

Please sign in to comment.