Apache Hop version?
2.19
Java version?
21
Operating system
Windows
What happened?
Affected: 2.19.0 and earlier. One-line fix.
public static final String DEFAULT_TIMESTAMP_PARSE_MASK =
Const.NVL(
EnvUtil.getSystemProperty(Const.HOP_DEFAULT_DATE_FORMAT), // <-- date, not timestamp
"yyyy/MM/dd HH:mm:ss.SSSSSSSSS");
The default value is the timestamp pattern and the sibling DEFAULT_TIMESTAMP_FORMAT_MASK reads
HOP_DEFAULT_TIMESTAMP_FORMAT, so the variable name is simply wrong here. Two consequences:
HOP_DEFAULT_TIMESTAMP_FORMAT has no effect on timestamp parsing at all.
- Setting
HOP_DEFAULT_DATE_FORMAT silently changes how timestamps are parsed, which is hard to
find because the symptom shows up on a different data type than the variable names.
Steps to reproduce
- Set
HOP_DEFAULT_DATE_FORMAT to a date-only pattern, e.g. dd-MM-yyyy.
- Convert a String to Timestamp without an explicit format mask, for example in a Select values
transform.
Expected: the conversion uses HOP_DEFAULT_TIMESTAMP_FORMAT, or the built-in timestamp pattern
when that variable is unset. HOP_DEFAULT_DATE_FORMAT affects Date only.
Actual: the timestamp is parsed with the date pattern, and setting
HOP_DEFAULT_TIMESTAMP_FORMAT changes nothing.
Suggested fix
Read Const.HOP_DEFAULT_TIMESTAMP_FORMAT.
Issue Priority
Priority: 2
Issue Component
Component: API
Apache Hop version?
2.19
Java version?
21
Operating system
Windows
What happened?
Affected: 2.19.0 and earlier. One-line fix.
The default value is the timestamp pattern and the sibling
DEFAULT_TIMESTAMP_FORMAT_MASKreadsHOP_DEFAULT_TIMESTAMP_FORMAT, so the variable name is simply wrong here. Two consequences:HOP_DEFAULT_TIMESTAMP_FORMAThas no effect on timestamp parsing at all.HOP_DEFAULT_DATE_FORMATsilently changes how timestamps are parsed, which is hard tofind because the symptom shows up on a different data type than the variable names.
Steps to reproduce
HOP_DEFAULT_DATE_FORMATto a date-only pattern, e.g.dd-MM-yyyy.transform.
Expected: the conversion uses
HOP_DEFAULT_TIMESTAMP_FORMAT, or the built-in timestamp patternwhen that variable is unset.
HOP_DEFAULT_DATE_FORMATaffects Date only.Actual: the timestamp is parsed with the date pattern, and setting
HOP_DEFAULT_TIMESTAMP_FORMATchanges nothing.Suggested fix
Read
Const.HOP_DEFAULT_TIMESTAMP_FORMAT.Issue Priority
Priority: 2
Issue Component
Component: API