Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Investigate "ForIteration" behavior #774

Open
Tracked by #997
gitgabrio opened this issue Dec 15, 2023 · 0 comments
Open
Tracked by #997

Investigate "ForIteration" behavior #774

gitgabrio opened this issue Dec 15, 2023 · 0 comments
Assignees
Labels
area:dmn Related to DMN area:engine Related to the runtime engines type:enhancement Something that already exists needs to be improved type:tech-debt Things that were left behind an may harm us in the future.

Comments

@gitgabrio
Copy link

gitgabrio commented Dec 15, 2023

The current implementation of ForIteration has the following details

  1. it use an underlying Iterator for its operations
  2. the Iterator is not instantiated immediately, but delegated to a Supplier
  3. the iterator is actually instantiated only when  hasNextValue is invoked
  4. if the underling iterator.hasNext() return false, then the iterator is set to null
  5. the getNextValue() does not instantiate the iterator by itself, so if the hasNextValue() has not been called before, it returns null
  6. the semantic is therefore different then the usual one provided by the iterators themselves

A quick experiment, removing the supplier and using the class to simple "facade" of the underlying iterator, lead to test failuers; e.g.

"for x in [ 10, 20, 30 ], y in [ 1, 2, 3 ] return x * y"
->

Expecting actual:
  [10, 20, 30]
to contain exactly (and in same order):
  [10, 20, 30, 20, 40, 60, 30, 60, 90]
but could not find the following elements:
  [20, 40, 60, 30, 60, 90]

That could be the sympton that there is some existing logic, outside this class itself, that is based on the null object returned.

@gitgabrio gitgabrio changed the title Investigate "ForIteration" behavior Investigate "ForIteration" behavior - DMN 1.5 Dec 15, 2023
@gitgabrio gitgabrio self-assigned this Jan 8, 2024
@gitgabrio gitgabrio changed the title Investigate "ForIteration" behavior - DMN 1.5 Investigate "ForIteration" behavior Jan 24, 2024
@yesamer yesamer added area:dmn Related to DMN type:new-feature Something is missing, we need to build it! area:engine Related to the runtime engines type:enhancement Something that already exists needs to be improved and removed type:new-feature Something is missing, we need to build it! labels Jan 24, 2024
@gitgabrio gitgabrio added the type:tech-debt Things that were left behind an may harm us in the future. label May 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:dmn Related to DMN area:engine Related to the runtime engines type:enhancement Something that already exists needs to be improved type:tech-debt Things that were left behind an may harm us in the future.
Projects
Status: 📋 Backlog
Development

No branches or pull requests

2 participants