apache / apache/hop

[Bug]: Formula returns 0.0 instead of null for string type

Open
#5,042 4 comments 0 reactions 0 assignees View on GitHub
awaiting triage P2 Transforms
Dominant language
Java
Stars
1.5k
Forks
476
Avg merge
19h
Merged PRs (30d)
227

Description

### Apache Hop version?

2.12

### Java version?

17

### Operating system

Windows

### What happened?

I recently discovered a weird behaviour in the formula transform.
![Image](https://github.com/user-attachments/assets/6fe1992b-853d-45e8-bf2f-88dbac90df45)
If you look at the image, given the formula, NEW_FIELD should be null instead of "0.0".
If I select just one of the IDs though, then NEW_FIELD is correctly assigned null.
![Image](https://github.com/user-attachments/assets/272b310c-5795-4d5a-a061-89c4ff4e1889)

I have the same behaviour on both Hop 2.8 on Java 11 and Hop 2.12 on Java 17.

Thanks!

### Issue Priority

Priority: 2

### Issue Component

Component: Transforms

Contributor guide

Open the contributing guide

Research direction

Start with the formula transform and reproduce the reported case on the listed Hop and Java versions, using the screenshots as the expected behavior reference. Investigate why the formula produces 0.0 when multiple IDs are selected but null when one ID is selected. Done means the affected expression returns null consistently for the string-type case.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.