Fix: init var that's otherwise accessed uninit'd #207
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR initialises a variable ("format") that can be read
uninitialised. There are no negative manifestations of this issue.
The var carries the type of time format that has been detected when
parsing a string input value, which would subsequently be converted to
a TIME/DATE/TIMESTAMP data type. In case the source is a string
representing a TIMESTAMP and the destination a DATE, the representation
of the destination is obtained from the original input, by zero-ing the
time part (since this is how DATEs are represented in ES/SQL) and the
"format" var decides, in a disjunction with another variable, on this
action.
In case the source is of the type DATE and the destination also a DATE,
the "format" var would not be set, but its value read. In the case the
random value the var can take matches the condition, a zero'ing of an
already zero'd string would happen, with no other side-effect.