apache / apache/hop

[Bug]: Enhanced JSON Output throws unexpected error when group fieldname no longer exists

Open
#2,570 0 comments 0 reactions 0 assignees View on GitHub
Actions awaiting triage P2
Dominant language
Java
Stars
1.5k
Forks
476
Avg merge
18h 33m
Merged PRs (30d)
204

Description

### Apache Hop version?

2.3

### Java version?

jdk-16.0.1.9

### Operating system

Windows

### What happened?

- create a Data Grid action with field Field1
- connect to Enhanced JSON Output
- define Field1 as Group Key
- run pipeline -> success
- rename field in Data Grid to Field2
- run pipeline, JSON action throws unexpected error

```
2023/03/15 13:56:12 - Enhanced JSON Output.0 - ERROR: Unexpected error
2023/03/15 13:56:12 - Enhanced JSON Output.0 - ERROR: java.lang.IndexOutOfBoundsException: Index: 1, Size: 0
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at java.base/java.util.ArrayList.rangeCheckForAdd(ArrayList.java:756)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at java.base/java.util.ArrayList.add(ArrayList.java:481)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at org.apache.hop.core.row.RowMeta.addValueMeta(RowMeta.java:273)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at org.apache.hop.pipeline.transforms.jsonoutputenhanced.JsonOutput.onFirstRecord(JsonOutput.java:412)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at org.apache.hop.pipeline.transforms.jsonoutputenhanced.JsonOutput.processRow(JsonOutput.java:118)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at org.apache.hop.pipeline.transform.RunThread.run(RunThread.java:55)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - at java.base/java.lang.Thread.run(Thread.java:831)
2023/03/15 13:56:12 - Enhanced JSON Output.0 - Finished processing (I=0, O=0, R=1, W=0, U=0, E=1)
```

Not sure if this is a bug and should be captured properly and throwing an error to let the user know that the input field can no longer be found or if its OK to throw an unexpected error instead.

### Issue Priority

Priority: 2

### Issue Component

Component: Actions

Contributor guide

Open the contributing guide

Research direction

Start with the stack-trace locations in JsonOutput.java, especially onFirstRecord, and RowMeta.java at addValueMeta. Reproduce the Data Grid to Enhanced JSON Output pipeline, rename the group field, and determine the intended handling for the missing input field; done means it no longer surfaces as an unexpected IndexOutOfBoundsException.

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.