Skip to content

Commit

Permalink
Misc readability improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd authored and Lojjs committed Mar 16, 2018
1 parent 7b2fe1b commit 2f551c4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -337,10 +337,16 @@ private PointValue randomPoint3D( int index )

private static PointValue randomPoint( int index, int dimension )
{
CoordinateReferenceSystem crs =
index % 2 == 0 ?
dimension == 2 ? WGS84 : WGS84_3D :
dimension == 2 ? Cartesian : Cartesian_3D;
CoordinateReferenceSystem crs;
if ( index % 2 == 0 )
{
crs = dimension == 2 ? WGS84 : WGS84_3D;
}
else
{
crs = dimension == 2 ? Cartesian : Cartesian_3D;
}

return unsafePointValue( crs, random().doubles( dimension, Double.MIN_VALUE, Double.MAX_VALUE ).toArray() );
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ class SemanticIndexAcceptanceTest extends ExecutionEngineFunSuite with PropertyC

def dateGen: Gen[DateValue] =
for {
epochDays <- arbitrary[Int] //Gen.chooseNum(-MAX_EPOCH_DAYS+1, MAX_EPOCH_DAYS-1)?
epochDays <- arbitrary[Int] // we only generate epochDays as an int, to avoid overflowing
// the limits of the underlying java types
} yield DateValue.epochDate(epochDays)

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ import org.neo4j.cypher.internal.util.v3_4.attribution.Id
import org.neo4j.cypher.internal.v3_4.expressions.{LabelToken, PropertyKeyToken}
import org.neo4j.cypher.internal.v3_4.logical.plans._
import org.neo4j.internal.kernel.api.{CapableIndexReference, IndexReference}
import org.neo4j.values.virtual.NodeValue

case class NodeIndexSeekPipe(ident: String,
label: LabelToken,
Expand All @@ -51,7 +50,7 @@ case class NodeIndexSeekPipe(ident: String,
protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = {
val indexReference = reference(state.query)
val baseContext = state.createOrGetInitialContext(executionContextFactory)
val resultNodes: Iterator[NodeValue] = indexSeek(state, indexReference, baseContext)
val resultNodes = indexSeek(state, indexReference, baseContext)
resultNodes.map(node => executionContextFactory.copyWith(baseContext, ident, node))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,14 @@ trait NodeIndexSeeker {
indexReference: IndexReference,
baseContext: ExecutionContext): Iterator[NodeValue] =
indexMode match {
case _: ExactSeek =>
case _: ExactSeek |
_: SeekByRange =>
val indexQueries = computeIndexQueries(state, baseContext)
indexQueries.flatMap(query => state.query.indexSeek(indexReference, query)).toIterator

case LockingUniqueIndexSeek =>
val indexQueries = computeExactQueries(state, baseContext)
indexQueries.flatMap(indexQuery => state.query.lockingUniqueIndexSeek(indexReference, indexQuery)).toIterator

case _: SeekByRange =>
val indexQueries = computeIndexQueries(state, baseContext)
indexQueries.flatMap(query => state.query.indexSeek(indexReference, query)).toIterator
}

// helpers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ import org.neo4j.cypher.internal.util.v3_4.attribution.Id
import org.neo4j.cypher.internal.v3_4.expressions.{LabelToken, PropertyKeyToken}
import org.neo4j.cypher.internal.v3_4.logical.plans.QueryExpression
import org.neo4j.internal.kernel.api.{CapableIndexReference, IndexReference}
import org.neo4j.values.virtual.NodeValue

case class NodeIndexSeekSlottedPipe(ident: String,
label: LabelToken,
Expand Down Expand Up @@ -58,7 +57,7 @@ case class NodeIndexSeekSlottedPipe(ident: String,
protected def internalCreateResults(state: QueryState): Iterator[ExecutionContext] = {
val indexReference = reference(state.query)
val baseContext = state.createOrGetInitialContext(executionContextFactory)
val resultNodes: Iterator[NodeValue] = indexSeek(state, indexReference, baseContext)
val resultNodes = indexSeek(state, indexReference, baseContext)
resultNodes.map { node =>
val context = SlottedExecutionContext(slots)
state.copyArgumentStateTo(context, argumentSize.nLongs, argumentSize.nReferences)
Expand Down

0 comments on commit 2f551c4

Please sign in to comment.