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 2025/08/27 14:58:03 UTC

[I] [Bug]: Converting a Timestamp to a Date doesn't do anything (hop)

mattcasters opened a new issue, #5651:
URL: https://github.com/apache/hop/issues/5651

   ### Apache Hop version?
   
   2.15.0
   
   ### Java version?
   
   openjdk 21.0.8 2025-07-15
   
   ### Operating system
   
   Linux
   
   ### What happened?
   
   If we look in `ValueMetaTimestamp` we notice that method `getDate()` simply returns `getTimestamp()`.
   This causes issues downstream and is probably the source of a number of Timestamp related conversion errors in other issues.
   
   This is what [the Javadocs](https://download.java.net/java/early_access/genzgc/docs/api/java.sql/java/sql/Timestamp.html) say about the topic: 
   
   ```
   Due to the differences between the Timestamp class and the java.util.Date class mentioned above, it is recommended that code not view Timestamp values generically as an instance of java.util.Date. The inheritance relationship between Timestamp and java.util.Date really denotes implementation inheritance, and not type inheritance.
   ```
   
   Therefor I think that we can consider our implementation a bug, and make the subtle change:
   
   ```
     @Override
     public Date getDate(Object object) throws HopValueException {
       Timestamp timestamp = getTimestamp(object);
        if (timestamp==null) {
           return null;
        }
        return new Date(timestamp.getTime());
     }
   ```
   
   ### Issue Priority
   
   Priority: 2
   
   ### Issue Component
   
   Component: API


-- 
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.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [I] [Bug]: Converting a Timestamp to a Date doesn't do anything (hop)

Posted by "sramazzina (via GitHub)" <gi...@apache.org>.
sramazzina commented on issue #5651:
URL: https://github.com/apache/hop/issues/5651#issuecomment-3232429044

   I agree. I can apply that fix to the code if no one has time to do that


-- 
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: [I] [Bug]: Converting a Timestamp to a Date doesn't do anything (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters closed issue #5651: [Bug]: Converting a Timestamp to a Date doesn't do anything
URL: https://github.com/apache/hop/issues/5651


-- 
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: [I] [Bug]: Converting a Timestamp to a Date doesn't do anything (hop)

Posted by "hansva (via GitHub)" <gi...@apache.org>.
hansva commented on issue #5651:
URL: https://github.com/apache/hop/issues/5651#issuecomment-3232423264

   This sounds like a great improvement/fix


-- 
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: [I] [Bug]: Converting a Timestamp to a Date doesn't do anything (hop)

Posted by "mattcasters (via GitHub)" <gi...@apache.org>.
mattcasters commented on issue #5651:
URL: https://github.com/apache/hop/issues/5651#issuecomment-3232499543

   The change itself is obviously already running on my systems.  I'm just very scared about the unintended consequences in other scenarios.  Extra testing and an abundance of caution is needed IMO.  Any help is very welcome!
   Perhaps we can create extra MySQL / Postgres / ... database integration tests to make sure old behavior with Timestamps continues to work as expected.


-- 
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