apache / apache/hop

[Feature Request]: User Defined Java Class can't retieve INTEGER from external JAR

Open
#4,859 1 comment 0 reactions 0 assignees View on GitHub
awaiting triage P3 Transforms
Dominant language
Java
Stars
1.5k
Forks
476
Avg merge
18h 32m
Merged PRs (30d)
216

Description

### What would you like to happen?

I've created a User Defined Java Class, that invokes a External JAR i've developed.

The External JAR returns an INTEGER, that my User Defined Java class tries to assign to and Integer variable defined on the Fields Tab.

No mather what id, i'm allways getting the error

`2025/02/03 15:35:43 - test_sid - Caused by: com.fasterxml.jackson.databind.JsonMappingException: sid Integer : There was a data type error: the data type of java.lang.Integer object [8024] does not correspond to value meta [Integer] (through reference chain: org.apache.hop.execution.ExecutionData["rowsBinaryGzipBase64Encoded"])
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:402)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.JsonMappingException.wrapWithPath(JsonMappingException.java:361)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.std.StdSerializer.wrapAndThrow(StdSerializer.java:323)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:780)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.BeanSerializer.serialize(BeanSerializer.java:178)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:479)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:318)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ObjectWriter$Prefetch.serialize(ObjectWriter.java:1572)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ObjectWriter._writeValueAndClose(ObjectWriter.java:1273)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ObjectWriter.writeValue(ObjectWriter.java:1098)
2025/02/03 15:35:43 - test_sid - at org.apache.hop.execution.local.FileExecutionInfoLocation.registerData(FileExecutionInfoLocation.java:340)
2025/02/03 15:35:43 - test_sid - ... 11 more
2025/02/03 15:35:43 - test_sid - Caused by: java.lang.RuntimeException: sid Integer : There was a data type error: the data type of java.lang.Integer object [8024] does not correspond to value meta [Integer]
2025/02/03 15:35:43 - test_sid - at org.apache.hop.core.row.value.ValueMetaBase.writeData(ValueMetaBase.java:3228)
2025/02/03 15:35:43 - test_sid - at org.apache.hop.core.row.RowMeta.writeData(RowMeta.java:719)
2025/02/03 15:35:43 - test_sid - at org.apache.hop.execution.ExecutionData.getRowsBinaryGzipBase64Encoded(ExecutionData.java:189)
2025/02/03 15:35:43 - test_sid - at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
2025/02/03 15:35:43 - test_sid - at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
2025/02/03 15:35:43 - test_sid - at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
2025/02/03 15:35:43 - test_sid - at java.base/java.lang.reflect.Method.invoke(Method.java:568)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.BeanPropertyWriter.serializeAsField(BeanPropertyWriter.java:688)
2025/02/03 15:35:43 - test_sid - at com.fasterxml.jackson.databind.ser.std.BeanSerializerBase.serializeFields(BeanSerializerBase.java:772)
2025/02/03 15:35:43 - test_sid - ... 18 more`

If i change the definition of the variable on the Fields tab to String, works fine. But it's not the ideal solution.

I tried to adapt my Java Class to PentaHo, and i get the exact same error...

### Issue Priority

Priority: 3

### Issue Component

Component: Transforms

Contributor guide

Open the contributing guide

Research direction

Start with the reported serialization path in org.apache.hop.core.row.value.ValueMetaBase.writeData, RowMeta.writeData, and ExecutionData.getRowsBinaryGzipBase64Encoded, then inspect how the User Defined Java Class transform maps an Integer field. Reproduce the failure with an external JAR returning Integer and compare it with the working String case. Done means an Integer field can be serialized without the reported data type error.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.