Hi.  Upgrading from 1.20 > 2.0.0-M2.  Jira: 
https://issues.apache.org/jira/browse/NIFI-12885

Apologies if not bug.  What is 2.0’s way of getting timestamped object?


I think I found a breaking bug from this commit 
https://github.com/apache/nifi/commit/250fe90b348fac515ea597c1985ca432ac7c3ac3#diff-ce496d3f0fc5a7e8a3c0431972f7069b4cf1af2e94f3a199f595ef195eb5ebfa
The below passes in 1.20.0 but fails in 2.0

@Test
    void testBasic() throws Exception {
        // setup
        final String schemaText = "{" +
                "\"type\" : \"record\"," +
                "\"name\" : \"TestRecord\"," +
                "\"namespace\" : \"org.apache.nifi\"," +
                "\"fields\" : [ {" +
                "\"name\" : \"my_datestamp_field\"," +
                "\"type\" : {" +
                "\"type\" : \"long\"," +
                "\"logicalType\" : \"timestamp-millis\"" +
                "}" +
                "} ]" +
              "}";
        final RecordSchema schemaParsed = AvroTypeUtil.createSchema(new 
Schema.Parser().parse(schemaText));

        final HashMap<String, Object> item = new HashMap<>();
        item.put("my_datestamp_field", "2022-01-01 10:00:00.000");

        // act
        final MapRecord record = new MapRecord(schemaParsed, item);
        final Date myDateStampField = record.getAsDate("my_datestamp_field", 
"yyyy-MM-dd HH:mm:ss.SSS");

        // assert
        // fails in 2.0; it actual is `1640995200000`
        assertEquals(1641031200000L, myDateStampField.getTime());
    }

[cid:image001.png@01DA73CD.EF051AB0]
Kyle Nguyen
Corporate Technology, Software Engineer

Millennium Management LLC
399 Park Avenue  |  New York, NY 10022
📞 +1.212.708.1366  | 📱 +1.929.837.1788
mlp.com<https://www.mlp.com/home/>




######################################################################

The information contained in this communication is confidential and

may contain information that is privileged or exempt from disclosure

under applicable law. If you are not a named addressee, please notify

the sender immediately and delete this email from your system.

If you have received this communication, and are not a named

recipient, you are hereby notified that any dissemination,

distribution or copying of this communication is strictly prohibited.

######################################################################

Reply via email to