'Neo4j Dgs.fastrp.write returnsUnionProperties must all have the same type, but found [LONG, DOUBLE, DOUBLE, DOUBLE]" error

I am working on a large graph consisting of different type of labels, and these labels have their own properties.

CALL gds.graph.create(
'derin',
{
Transaction: {
label: 'Transaction',
properties: {legacy_customer: {defaultValue: 0}
, trx_amount: {defaultValue: 1000}
, atm_trx: {defaultValue: 0}
, fast_credit_flag: {defaultValue: 0}
, silver_bullet_flag: {defaultValue: 0}
}
}
, Withdraw: {
label: 'Withdraw',
properties: {legacy_customer: {defaultValue: 0}
, trx_amount: {defaultValue: 1000}
, atm_trx: {defaultValue: 0}
, fast_credit_flag: {defaultValue: 0}
, silver_bullet_flag: {defaultValue: 0}
}
}
, Loan: {
label: 'Loan',
properties: {legacy_customer: {defaultValue: 0}
, trx_amount: {defaultValue: 1000}
, atm_trx: {defaultValue: 0}
, fast_credit_flag: {defaultValue: 0}
, silver_bullet_flag: {defaultValue: 0}
}
}
, Customer: {
label: 'Customer',
properties: {legacy_customer: {defaultValue: 0}
, trx_amount: {defaultValue: 1000}
, atm_trx: {defaultValue: 0}
, fast_credit_flag: {defaultValue: 0}
, silver_bullet_flag: {defaultValue: 0}
}
}}, {
SENDS: {type: 'SENDS', orientation: 'UNDIRECTED'},
RECEIVES: {type: 'RECEIVES', orientation: 'UNDIRECTED'},
INSPECTS: {type: 'INSPECTS', orientation: 'UNDIRECTED'},
WITHDRAWS: {type: 'WITHDRAWS', orientation: 'UNDIRECTED'},
APPLIES: {type: 'APPLIES', orientation: 'UNDIRECTED'}
})

I created a graph with default values because of missing properties. After creation, I am running the query;

CALL gds.fastRP.write('derin'
,{
embeddingDimension: 32,
writeProperty: 'fast_embedding',
propertyRatio: 0.2,
featureProperties: ['legacy_customer', 'trx_amount', 'atm_trx', 'fast_credit_flag', 'silver_bullet_flag']
}
)

I got the error "Failed to invoke procedure gds.fastRP.write: Caused by: java.lang.IllegalArgumentException: UnionProperties must all have the same type, but found [LONG, DOUBLE, DOUBLE, DOUBLE]". Any help or suggestion would be great. Thanks.



Solution 1:[1]

I was able to simulate your issue using Neo4j version: 4.2.3 and GDS: 1.8.3

Failed to invoke procedure `gds.fastRP.write`: Caused by: java.lang.IllegalArgumentException: UnionProperties must all have the same type, but found [DOUBLE, DOUBLE, LONG, DOUBLE]

I created below nodes and it complains about inconsistent data types LONG and DOUBLE.

 (:Transaction {trx_amount:  1000}) and (:Withdraw{trx_amount: 1000.00) 

I would suggest you run your query and scanning trying out each featureProperties one at a time. (I know it's tedious!) Then run below query to find which nodes are LONG (integer). The query might be long running so I will let you fine tune it.

 MATCH (n) 
 WHERE apoc.meta.type(n.trx_amount)  = 'INTEGER'
 RETURN DISTINCT labels(n) as label, collect(n.trx_amount) AS trx_amount  

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 jose_bacoy