OrientDB Version: 3.2.43
Previous Version (works): 3.0.37
Description:
In OrientDB 3.0.37, returning a JavaScript array from a custom JS function works as expected. In OrientDB 3.2.43, returning a JS array throws a ClassCastException.
Steps to Reproduce:
- Create a JS function in OrientDB:
// Convert to JS native array
var jsList = [];
for (var i = 0; i < 10; i++) {
jsList.push(i);
}
return jsList;
- Execute the function in 3.0.37 → works fine:
[
{
"@type": "d",
"@version": 0,
"value": [
0,1,2,3,4,5,6,7,8,9
]
}
]
- Execute the same function in 3.2.43 → throws:
{
"errors": [
{
"code": 500,
"reason": 500,
"content": "java.lang.ClassCastException: Cannot convert '0'(language: Java, type: java.lang.Integer) using Value.asHostObject(): Value is not a host object. You can ensure that the value can be converted using Value.isHostObject()."
}
]
}
Observations:
- Returning
Map/HashMap works fine in both versions.
- Returning primitive values (e.g., String, Number) works fine.
- Returning arrays (JavaScript array or Java ArrayList) fails in 3.2.43.
Expected Behavior:
JS arrays returned from custom functions should work consistently across versions, similar to how returning Map works.
Notes:
- The issue seems related to changes in the JS engine or type conversion between OrientDB versions 3.0.x and 3.2.x.
OrientDB Version: 3.2.43
Previous Version (works): 3.0.37
Description:
In OrientDB 3.0.37, returning a JavaScript array from a custom JS function works as expected. In OrientDB 3.2.43, returning a JS array throws a
ClassCastException.Steps to Reproduce:
[ { "@type": "d", "@version": 0, "value": [ 0,1,2,3,4,5,6,7,8,9 ] } ]{ "errors": [ { "code": 500, "reason": 500, "content": "java.lang.ClassCastException: Cannot convert '0'(language: Java, type: java.lang.Integer) using Value.asHostObject(): Value is not a host object. You can ensure that the value can be converted using Value.isHostObject()." } ] }Observations:
Map/HashMapworks fine in both versions.Expected Behavior:
JS arrays returned from custom functions should work consistently across versions, similar to how returning
Mapworks.Notes: