Skip to content

Commit

Permalink
Fixed Value support in consistency checker
Browse files Browse the repository at this point in the history
  • Loading branch information
fickludd committed Jun 15, 2017
1 parent c852085 commit 2650d54
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
Expand Up @@ -126,7 +126,7 @@ private void matchIndexesToNode(
} }
} }


private void verifyNodeCorrectlyIndexedUniquely( long nodeId, Object[] propertyValues, private void verifyNodeCorrectlyIndexedUniquely( long nodeId, Value[] propertyValues,
CheckerEngine<NodeRecord,ConsistencyReport.NodeConsistencyReport> engine, IndexRule indexRule, CheckerEngine<NodeRecord,ConsistencyReport.NodeConsistencyReport> engine, IndexRule indexRule,
IndexReader reader ) IndexReader reader )
{ {
Expand All @@ -145,23 +145,23 @@ private void verifyNodeCorrectlyIndexedUniquely( long nodeId, Object[] propertyV
} }
else else
{ {
engine.report().uniqueIndexNotUnique( indexRule, propertyValues, indexedNodeId ); engine.report().uniqueIndexNotUnique( indexRule, Values.asPublic( propertyValues ), indexedNodeId );
} }
} }


reportIncorrectIndexCount( propertyValues, engine, indexRule, count ); reportIncorrectIndexCount( propertyValues, engine, indexRule, count );
} }


private void reportIncorrectIndexCount( Object[] propertyValues, private void reportIncorrectIndexCount( Value[] propertyValues,
CheckerEngine<NodeRecord,ConsistencyReport.NodeConsistencyReport> engine, IndexRule indexRule, long count ) CheckerEngine<NodeRecord,ConsistencyReport.NodeConsistencyReport> engine, IndexRule indexRule, long count )
{ {
if ( count == 0 ) if ( count == 0 )
{ {
engine.report().notIndexed( indexRule, propertyValues ); engine.report().notIndexed( indexRule, Values.asPublic( propertyValues ) );
} }
else if ( count != 1 ) else if ( count != 1 )
{ {
engine.report().indexedMultipleTimes( indexRule, propertyValues, count ); engine.report().indexedMultipleTimes( indexRule, Values.asPublic( propertyValues ), count );
} }
} }


Expand Down Expand Up @@ -219,13 +219,13 @@ private PrimitiveIntObjectMap<PropertyBlock> properties( List<PropertyBlock> pro
return propertyIds; return propertyIds;
} }


private IndexQuery[] seek( LabelSchemaDescriptor schema, Object[] propertyValues ) private IndexQuery[] seek( LabelSchemaDescriptor schema, Value[] propertyValues )
{ {
assert schema.getPropertyIds().length == propertyValues.length; assert schema.getPropertyIds().length == propertyValues.length;
IndexQuery[] query = new IndexQuery[propertyValues.length]; IndexQuery[] query = new IndexQuery[propertyValues.length];
for ( int i = 0; i < query.length; i++ ) for ( int i = 0; i < query.length; i++ )
{ {
query[i] = IndexQuery.exact( schema.getPropertyIds()[i], Values.of( propertyValues[i] ) ); query[i] = IndexQuery.exact( schema.getPropertyIds()[i], propertyValues[i] );
} }
return query; return query;
} }
Expand Down
12 changes: 7 additions & 5 deletions community/values/src/main/java/org/neo4j/values/Values.java
Expand Up @@ -413,14 +413,16 @@ public static Object asLegacyObject( Value value )
return value == null ? null : value.asLegacyObject(); return value == null ? null : value.asLegacyObject();
} }


public static Value[] values( Object... objects ) public static Object[] asPublic( Value[] propertyValues )
{ {
Value[] values = new Value[objects.length]; Object[] legacy = new Object[propertyValues.length];
for ( int i = 0; i < objects.length; i++ )
for ( int i = 0; i <propertyValues.length ; i++ )
{ {
values[i] = Values.of( objects[i] ); legacy[i] = propertyValues[i].asPublic();
} }
return values;
return legacy;
} }


private static Value arrayValue( Object[] value ) private static Value arrayValue( Object[] value )
Expand Down

0 comments on commit 2650d54

Please sign in to comment.