Skip to content

[Bug]: Timestamp parse mask reads HOP_DEFAULT_DATE_FORMAT #8218

Description

@fskorgen

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

  1. Set HOP_DEFAULT_DATE_FORMAT to a date-only pattern, e.g. dd-MM-yyyy.
  2. 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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions