You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@hop.apache.org by "mattcasters (via GitHub)" <gi...@apache.org> on 2026/10/14 18:42:23 UTC
[PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
mattcasters opened a new pull request, #8927:
URL: https://github.com/apache/hop/pull/8927
Keeps the OpenFormula engine and replaces the tests that came with it.
Those tests were the old formula suite: `FormulaTestBase`, the `Prd*` classes, and 74 files that still named the original authors. They are deleted. Nothing under `src/test` still contains `@author`, `FormulaTestBase`, or `Prd5174`.
The new cases follow OASIS OpenDocument v1.2 Part 2 (29 September 2011). Each Part 2 function the engine registers has one case, and a coverage test fails if a registered function is neither in that set nor in the Kettle/PDI extra set. The extras (`BEGINSWITH`, the array helpers, `YESTERDAY`, and the rest) are tested from their own descriptions, not from Part 2.
`DAYS(EndDate; StartDate)` subtracted the arguments in the other order. It now returns EndDate minus StartDate, which is what Part 2 section 6.10.6 specifies for numeric dates.
The clean-room sentence is removed from `NOTICE`. That file is for required attributions, and the engine has none.
This supersedes #8926. Please do not merge that revert. It would delete the engine as well as the tests.
fixes #8907
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "bamaer (via GitHub)" <gi...@apache.org>.
bamaer commented on PR #8927:
URL: https://github.com/apache/hop/pull/8927#issuecomment-6284000392
@mattcasters, thanks. I built a25d6f6 and the 35 tests pass, with clean checkstyle and spotless. I also ran two copies on separate threads sharing the metadata, with `IF([a]>0;[a];0)` into an Integer field: 588ac42 gave 42–163 BigDecimal rows out of 400,000, and a25d6f6 gives none. That covers everything from the review. LGTM.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "bamaer (via GitHub)" <gi...@apache.org>.
bamaer commented on PR #8927:
URL: https://github.com/apache/hop/pull/8927#issuecomment-6216779998
@mattcasters, thanks. The new tests are clearly fresh: there are no `@author` tags, libformula names or PRD cases left in the module, and the spec-section citations make each case easy to check. I built the plugin from this branch. Checkstyle and spotless are clean, and the 29 tests pass.
Since this replaces the revert, it's effectively the re-land of #8913, so the open items from that review belong here too.
**Blockers**
1. **`DAYS` argument order** (`DateTimeFunctions.java:471-473`): main is correct here, and this change would break it. Part 2 says `DAYS(EndDate; StartDate)`, but PDI does the opposite and subtracts the first date from the second. In PDI 9.4, `DAYS(DATE(2020;1;15);DATE(2020;1;10))` gives -5. Main also gives -5, and this PR gives 5. `KettleImport` sends every PDI Formula step to OpenFormula, so imported pipelines that use `DAYS` would silently flip sign. Where PDI and the spec differ, `openformula.adoc` already follows PDI (`DATE` with a year below 1900). Could you drop this change, assert -5 in the `DateTimeSpecTest` case (line 40), and add a line to the docs saying `DAYS` follows PDI's argument order?
2. **Dates around DST** (`BinaryExpr.java:90-115`, `DateUtil.java:52`): in Europe/Brussels, `[d]+1` for 2026-10-25 gives 2026-10-25 23:00. From 29 to 30 March gives 0 days in an Integer field. PDI and Formula return 2026-10-26 and 1.
3. **Timestamp fields arrive as text** (`RowFormulaContext.java:144`): `[ts]+1` gives 1970-01-01, and `[ts]<DATE(2026;1;1)` is always false. `getDate()` should do it.
4. **Result type fixed on the first row** (`OpenFormula.java:165`): with `IF([a]>0;[a];0)` into an Integer field, later rows store a BigDecimal and the next transform fails.
Each of 2–4 deserves a test with those inputs. The spec cases avoid DST on purpose, so nothing currently catches them. I'm happy to share the PDI comparison setup or push those test cases to your branch.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on PR #8927:
URL: https://github.com/apache/hop/pull/8927#issuecomment-6221224370
I'll fix this one tomorrow ;-)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "bamaer (via GitHub)" <gi...@apache.org>.
bamaer merged PR #8927:
URL: https://github.com/apache/hop/pull/8927
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "bamaer (via GitHub)" <gi...@apache.org>.
bamaer commented on PR #8927:
URL: https://github.com/apache/hop/pull/8927#issuecomment-6221024471
@mattcasters, thanks, that was quick. I built 588ac42 and ran the tests, plus some extra cases. `[d]+1`, `[d]-1`, `[d]+0.5` and date differences across both DST changes in Brussels, New York, Sydney and Lord Howe now all give whole days, and `DAYS` matches PDI again. Timestamp fields compare and add correctly.
One thing left:
**Result type with more than one copy** (`OpenFormula.java:165-168`): `discoverReturnType` now runs on every row and sets `needDataConversion` on the `OpenFormulaMetaFunction`, which all copies of the transform share. I ran two copies of `IF([a]>0;[a];0)` into an Integer field, one seeing positive values and one negative, and 58 of 400,000 rows came out as BigDecimal instead of Long. Keeping the flag per copy in `OpenFormulaData`, next to `returnType`, would fix it.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [PR] Issue #8907 : Replace the OpenFormula tests with spec cases (hop)
Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on PR #8927:
URL: https://github.com/apache/hop/pull/8927#issuecomment-6273097567
@bamaer, the conversion flag now lives on each copy (a25d6f6), so copies no longer share it. CI is green. Could you take another look when you have a moment?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hop.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org