Re: Nifi Expression Language method toInstant works with a negative number

2024-02-23 Thread Dan S
So I think I answered why toInstant does not throw an exception when the
subject is negative. The reason I believe this is because Java's
java.time.Instant ofEpochMilli method takes negative numbers and will
return Instant objects from before the epoch.

On Fri, Feb 23, 2024 at 2:28 PM Dan S  wrote:

> For decimal I think I figured that the long value of the decimal is used
> but I still have my question for a negative number.
>
> On Fri, Feb 23, 2024 at 1:44 PM Dan S  wrote:
>
>> Similar question is with a decimal number e.g. 1403620278642.00 when
>> calling toInstant on it it evaluates to 2014-06-24T14:31:18.642Z. Why does
>> it not throw an exception?
>>
>> On Fri, Feb 23, 2024 at 12:48 PM Dan S  wrote:
>>
>>> I am working on NIFI-12756 to better understand when NIFI expressions
>>> can throw exceptions. I have an attribute which is a negative number and I
>>> thought calling toInstant would have thrown an
>>> org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException
>>> but instead it evaluated to 1925-07-10T09:28:41.358Z. I tried using
>>> toInstant as some of the unit tests (in nifi/nifi-commons/nifi-expression
>>> language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java)
>>> use it without any arguments although the documentation
>>> 
>>>  details
>>> using it with arguments format and timeZone. Can someone please clarify the
>>> following:
>>>
>>>1. Does the documentation need to be changed to indicate the
>>>arguments are not required?
>>>2. Why does toInstant  evaluate with a negative number and not throw
>>>an exception?
>>>
>>>


Nifi Expression Language method toInstant works with a negative number

2024-02-23 Thread Dan S
I am working on NIFI-12756 to better understand when NIFI expressions can
throw exceptions. I have an attribute which is a negative number and I
thought calling toInstant would have thrown an
org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException
but instead it evaluated to 1925-07-10T09:28:41.358Z. I tried using
toInstant as some of the unit tests (in nifi/nifi-commons/nifi-expression
language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java)
use it without any arguments although the documentation

details
using it with arguments format and timeZone. Can someone please clarify the
following:

   1. Does the documentation need to be changed to indicate the arguments
   are not required?
   2. Why does toInstant  evaluate with a negative number and not throw an
   exception?


Re: Nifi Expression Language method toInstant works with a negative number

2024-02-23 Thread Dan S
Similar question is with a decimal number e.g. 1403620278642.00 when
calling toInstant on it it evaluates to 2014-06-24T14:31:18.642Z. Why does
it not throw an exception?

On Fri, Feb 23, 2024 at 12:48 PM Dan S  wrote:

> I am working on NIFI-12756 to better understand when NIFI expressions can
> throw exceptions. I have an attribute which is a negative number and I
> thought calling toInstant would have thrown an
> org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException
> but instead it evaluated to 1925-07-10T09:28:41.358Z. I tried using
> toInstant as some of the unit tests (in nifi/nifi-commons/nifi-expression
> language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java)
> use it without any arguments although the documentation
> 
>  details
> using it with arguments format and timeZone. Can someone please clarify the
> following:
>
>1. Does the documentation need to be changed to indicate the arguments
>are not required?
>2. Why does toInstant  evaluate with a negative number and not throw
>an exception?
>
>


Re: Nifi Expression Language method toInstant works with a negative number

2024-02-23 Thread Dan S
For decimal I think I figured that the long value of the decimal is used
but I still have my question for a negative number.

On Fri, Feb 23, 2024 at 1:44 PM Dan S  wrote:

> Similar question is with a decimal number e.g. 1403620278642.00 when
> calling toInstant on it it evaluates to 2014-06-24T14:31:18.642Z. Why does
> it not throw an exception?
>
> On Fri, Feb 23, 2024 at 12:48 PM Dan S  wrote:
>
>> I am working on NIFI-12756 to better understand when NIFI expressions can
>> throw exceptions. I have an attribute which is a negative number and I
>> thought calling toInstant would have thrown an
>> org.apache.nifi.attribute.expression.language.exception.AttributeExpressionLanguageException
>> but instead it evaluated to 1925-07-10T09:28:41.358Z. I tried using
>> toInstant as some of the unit tests (in nifi/nifi-commons/nifi-expression
>> language/src/test/java/org/apache/nifi/attribute/expression/language/TestQuery.java)
>> use it without any arguments although the documentation
>> 
>>  details
>> using it with arguments format and timeZone. Can someone please clarify the
>> following:
>>
>>1. Does the documentation need to be changed to indicate the
>>arguments are not required?
>>2. Why does toInstant  evaluate with a negative number and not throw
>>an exception?
>>
>>