Skip to content

Commit 28d94b9

Browse files
committed
Restore previous exception message
1 parent 0aaa25a commit 28d94b9

File tree

2 files changed

+22
-25
lines changed

2 files changed

+22
-25
lines changed

core/src/main/java/org/neo4j/gds/core/loading/nodeproperties/NodePropertiesFromStoreBuilder.java

Lines changed: 0 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,6 @@
3131
import org.neo4j.gds.values.GdsNoValue;
3232
import org.neo4j.gds.values.GdsValue;
3333
import org.neo4j.gds.values.primitive.PrimitiveValues;
34-
import org.neo4j.values.storable.DoubleArray;
35-
import org.neo4j.values.storable.FloatArray;
36-
import org.neo4j.values.storable.FloatingPointValue;
37-
import org.neo4j.values.storable.IntegralValue;
38-
import org.neo4j.values.storable.LongArray;
39-
import org.neo4j.values.storable.Value;
4034

4135
import java.util.concurrent.atomic.AtomicReference;
4236

@@ -134,23 +128,4 @@ private InnerNodePropertiesBuilder newInnerBuilder(ValueType valueType) {
134128
));
135129
}
136130
}
137-
138-
private ValueType valueType(Value value) {
139-
if (value instanceof IntegralValue) {
140-
return ValueType.LONG;
141-
} else if (value instanceof FloatingPointValue) {
142-
return ValueType.DOUBLE;
143-
} else if (value instanceof LongArray) {
144-
return ValueType.LONG_ARRAY;
145-
} else if (value instanceof DoubleArray) {
146-
return ValueType.DOUBLE_ARRAY;
147-
} else if (value instanceof FloatArray) {
148-
return ValueType.FLOAT_ARRAY;
149-
} else {
150-
throw new UnsupportedOperationException(formatWithLocale(
151-
"Loading of values of type %s is currently not supported",
152-
value.getTypeName()
153-
));
154-
}
155-
}
156131
}

native-projection/src/main/java/org/neo4j/gds/projection/NativeNodePropertyImporter.java

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,11 @@
3939
import org.neo4j.kernel.api.KernelTransaction;
4040
import org.neo4j.storageengine.api.PropertySelection;
4141
import org.neo4j.storageengine.api.Reference;
42+
import org.neo4j.values.storable.DoubleArray;
43+
import org.neo4j.values.storable.FloatArray;
44+
import org.neo4j.values.storable.FloatingPointValue;
45+
import org.neo4j.values.storable.IntegralValue;
46+
import org.neo4j.values.storable.LongArray;
4247
import org.neo4j.values.storable.Value;
4348

4449
import java.util.ArrayList;
@@ -50,6 +55,7 @@
5055
import static java.util.stream.Collectors.toMap;
5156
import static org.neo4j.gds.core.GraphDimensions.ANY_LABEL;
5257
import static org.neo4j.gds.core.GraphDimensions.IGNORE;
58+
import static org.neo4j.gds.utils.StringFormatting.formatWithLocale;
5359

5460
public final class NativeNodePropertyImporter {
5561

@@ -143,6 +149,7 @@ private int setPropertyValue(
143149
Value value = propertyCursor.propertyValue();
144150

145151
for (NodePropertiesFromStoreBuilder builder : builders) {
152+
verifyValueType(value);
146153
var gdsValue = GdsNeo4jValueConverter.toValue(value);
147154
builder.set(neoNodeId, gdsValue);
148155
propertiesImported++;
@@ -152,6 +159,21 @@ private int setPropertyValue(
152159
return propertiesImported;
153160
}
154161

162+
private void verifyValueType(Value value) {
163+
if (!(
164+
value instanceof IntegralValue ||
165+
value instanceof FloatingPointValue ||
166+
value instanceof LongArray ||
167+
value instanceof DoubleArray ||
168+
value instanceof FloatArray
169+
)) {
170+
throw new UnsupportedOperationException(formatWithLocale(
171+
"Loading of values of type %s is currently not supported",
172+
value.getTypeName()
173+
));
174+
}
175+
}
176+
155177
public static final class Builder {
156178
private Concurrency concurrency = ConcurrencyConfig.TYPED_DEFAULT_CONCURRENCY;
157179
private Map<NodeLabel, PropertyMappings> propertyMappings;

0 commit comments

Comments
 (0)