Skip to content

Improve JdbcExecutor traversal by safely handling missing or multiple consumers#711

Open
mohit-devlogs wants to merge 1 commit intoapache:mainfrom
mohit-devlogs:jdbc-executor-improvement
Open

Improve JdbcExecutor traversal by safely handling missing or multiple consumers#711
mohit-devlogs wants to merge 1 commit intoapache:mainfrom
mohit-devlogs:jdbc-executor-improvement

Conversation

@mohit-devlogs
Copy link
Contributor

This change improves the robustness of JdbcExecutor by relaxing the assumption that the retrieval of consumers from the output channel is a singleton.
In the previous code, the function findJdbcExecutionOperatorTaskInStage() in the class WayangJdbcExecutor used the function WayangCollections.getSingle() for the retrieval of consumers from the output channel. The function throws an IllegalArgumentException if the list of consumers is empty or if there are more than one consumers in the list.

Changes:

  • More robust code is now used in place of WayangCollections.getSingle()
  • Return null if no consumer exists (i.e., it is the last in the pipeline)
  • Throw a Wayang exception if there are more than one consumers

This prevents crashes like this:
IllegalArgumentException: [] is not a singleton

Testing:

  • Compilation checked
  • Tested with:
    mvn -pl wayang-platforms/wayang-generic-jdbc test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant