[Bug]: JSON input transform loses the field to read from when it depends on success of a database query
Apache Hop version?
2.15
Java version?
OpenJDK 17
Operating system
Windows
What happened?
When the field a JSON input transform reads is dependent on the success of a database query, the field vanishes in case the SQL query fails (e.g. due to non-existent table)
See the attached zip and the screenshots.
How to reproduce:
- create a simple query in a Table input transform that packs a column (e.g. "id") read from a database into a string in JSON format , stream field that contains the JSON is called "id_json"
- read "id" out of the JSON-string via "JSON Input" transform, under "Select field:" use "id_json" in the drop-down
- as long as the query works / table exists, the JSON input parses everything correctly
- now change the SQL query to use a NON-existing table and save the Table input transform
- edit the JSON input transform: accept both error messages
- what you see afterwards in the "File" tab of the "JSON input" transform is that the "Select field" LOST the field "id_json"
- if you now hit OK and save (accidentally) the pipeline is stored with empty field to read from. (Happened a lot and caused quite a lot of troubles.)
Issue Priority
Priority: 3
Issue Component
Component: Hop Gui, Component: Transforms
I understand that when the table configuration is incorrect, the JSON Input component tries to fetch id_json from the previous step but fails to find it. This causes the dropdown list to have no available values, which is reasonable. However, the error dialog pops up twice, which is not expected. I’m working on fixing this issue.
Hi! Thanks for the fast response! Yes, it is reasonable. But this is the case in other transforms as well, it is perfectly reasonable that the dropdown when expanded shows no values. But without expanding the dropdown the entered field must remain stored and visible, in my point of view.
E.g. in Table output step: the already entered fields remain there even if the Table input transform at the beginning fails for some reason. Imagine all entered fields in the Table output step would vanish the same way in case the Table input transform does not provide data...