Skip to content

Commit e20c49d

Browse files
Allow scalar doubles
1 parent b4dcc38 commit e20c49d

File tree

2 files changed

+7
-5
lines changed

2 files changed

+7
-5
lines changed

algo/src/test/java/org/neo4j/gds/kmeans/KmeansStreamConfigTest.java

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ void shouldFailOnInvalidPropertyValueTypes(ValueType valueType) {
7272
assertThatIllegalArgumentException()
7373
.isThrownBy(() -> streamConfig.graphStoreValidation(graphStoreMock, List.of(), List.of()))
7474
.withMessageContaining("Unsupported node property value type")
75-
.withMessageContaining("Value type required: [DOUBLE_ARRAY] or [FLOAT_ARRAY].");
75+
.withMessageContaining("Value type required: [DOUBLE], [DOUBLE_ARRAY] or [FLOAT_ARRAY].");
7676
}
7777

7878
@ParameterizedTest
@@ -93,13 +93,14 @@ void shouldAcceptValidPropertyValueTypes(ValueType valueType) {
9393
static Stream<Arguments> validNodePropertyValueTypes() {
9494
return Stream.of(
9595
Arguments.of(ValueType.DOUBLE_ARRAY),
96-
Arguments.of(ValueType.FLOAT_ARRAY)
96+
Arguments.of(ValueType.FLOAT_ARRAY),
97+
Arguments.of(ValueType.DOUBLE)
9798
);
9899
}
99100

100101
static Stream<Arguments> invalidNodePropertyValueTypes() {
101102
return Arrays.stream(ValueType.values())
102-
.filter(t -> t != ValueType.DOUBLE_ARRAY && t != ValueType.FLOAT_ARRAY)
103+
.filter(t -> t != ValueType.DOUBLE_ARRAY && t != ValueType.FLOAT_ARRAY && t != ValueType.DOUBLE)
103104
.map(Arguments::of);
104105
}
105106

procedures/facade-api/configs/community-configs/src/main/java/org/neo4j/gds/kmeans/KmeansBaseConfig.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,13 +69,14 @@ default void nodePropertyTypeValidation(
6969
Collection<RelationshipType> selectedRelationshipTypes
7070
) {
7171
var valueType = graphStore.nodeProperty(nodeProperty()).valueType();
72-
if (valueType == ValueType.DOUBLE_ARRAY || valueType == ValueType.FLOAT_ARRAY) {
72+
if (valueType == ValueType.DOUBLE_ARRAY || valueType == ValueType.FLOAT_ARRAY || valueType == ValueType.DOUBLE) {
7373
return;
7474
}
7575
throw new IllegalArgumentException(
7676
StringFormatting.formatWithLocale(
77-
"Unsupported node property value type [%s]. Value type required: [%s] or [%s].",
77+
"Unsupported node property value type [%s]. Value type required: [%s], [%s] or [%s].",
7878
valueType,
79+
ValueType.DOUBLE,
7980
ValueType.DOUBLE_ARRAY,
8081
ValueType.FLOAT_ARRAY
8182
)

0 commit comments

Comments
 (0)