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

[Bug]: If you choose a date format mask when entering a value for the filter transform, your value will not be used for compare corrrectly. #3200

Closed
usbrandon opened this issue Sep 1, 2023 · 8 comments · Fixed by #3826
Assignees
Labels
bug P2 Default Priority Transforms
Milestone

Comments

@usbrandon
Copy link
Contributor

Apache Hop version?

2.5-GA

Java version?

11

Operating system

Windows

What happened?

When you are setting up your Filter Transform and entering a value, if you say choose
2023-02-01 00:00:00, and use the proper date mask matching that and Ok through it, you'll see a different date mask representation of the date value in the filter on the right side. The filter will now fail to compare the right way giving you output like this:

image

The step will work if you happen to enter your date values exactly as the default date mask suggests, then when you run the pipeline the filter will be applied correctly.

The attached can reproduce the issue.
sample_filter.zip

Issue Priority

Priority: 3

Issue Component

Component: Transforms

@mattcasters
Copy link
Contributor

The mask is indeed saved and used but it is incorrect for the milliseconds specified.

@mattcasters
Copy link
Contributor

mattcasters commented Nov 14, 2023

TODO: Allow editing of the mask on previously entered values, despite the error thrown: see issue #3196

@usbrandon
Copy link
Contributor Author

Remember, a key behavior is that if you were to put yyyy-MM-dd and a value like 2023-12-06, and then click Ok. When you go back into the filter step, it will forget your manually entered mask and try to put its own in there not matching it and permanently fail.

@sramazzina sramazzina self-assigned this Feb 24, 2024
@adbrown101
Copy link

adbrown101 commented Mar 28, 2024

Same issue noted here:

hop version 2.7.0 (2023-11-17 12.19.09)
java.specification.version=11
java.version=11.0.20
java.vm.vendor=Microsoft

Then if I go and try and edit the condition I get the following error.

HopValueException: 
constant String : couldn't convert string [2023/03/31 00:00:00.000] to a date using format [yyyy-MM-dd] on offset location 4
2023/03/31 00:00:00.000

Root cause: ParseException: 2023/03/31 00:00:00.000

If I put the date in yyyy/MM/dd hh:MM:ss format the comparison works, but I do prefer to use yyyy-MM-dd for all of my date masks.

@usbrandon usbrandon added P2 Default Priority and removed P3 Nice to have labels Apr 16, 2024
@sramazzina sramazzina self-assigned this Apr 18, 2024
@sramazzina
Copy link
Contributor

@usbrandon one of the dates' mask definition in your sample was wrong. That was the reason why the filter transform was raising an exception. Try my sample
sample_filter1.zip

The only issue I foresee is related to code hardening by putting a check over the mask and see that is aligned to the expectations of the date you entered. I will move on that way for the moment as a fix for this transform. Let me know what you think. My sample works correctly and returns the row you are expecting

@sramazzina
Copy link
Contributor

@adbrown101, as I was writing in my previous message, the date's format mask MUST be aligned to the format of the date you entered. Otherwise it cannot work.

@usbrandon
Copy link
Contributor Author

Reproduction video

https://www.youtube.com/watch?v=HeC9oQKygQU

@usbrandon
Copy link
Contributor Author

The only workaround currently is to format your dates as the transform demands with milliseconds at the end and according to your local java date format with slashes instead of dashes etc. If you customize the date mask to match your stream in any way, then the transform hammers in its mask over what you had but records what you had, just doesn't use it.

@sramazzina sramazzina mentioned this issue Apr 18, 2024
5 tasks
usbrandon added a commit that referenced this issue Apr 19, 2024
@hansva hansva added this to the 2.9 milestone Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug P2 Default Priority Transforms
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants