Re: how to return dates in java/enumerable convention?

2019-10-07 Thread Danny Chan
>In most cases the internal representation of date objects in the Enumerable
>convention are longs [1].

For the reference you give, date object is Integer internal instead of long.

Best,
Danny Chan
在 2019年10月6日 +0800 PM2:57,dev@calcite.apache.org,写道:
>
> In most cases the internal representation of date objects in the Enumerable
> convention are longs [1].


Re: how to return dates in java/enumerable convention?

2019-10-06 Thread Stamatis Zampetakis
Hi Jess,

In most cases the internal representation of date objects in the Enumerable
convention are longs [1].
Keep in mind that there are also other cases (e.g., [2]) where there are
conversion of dates to other types.

Best,
Stamatis

[1]
https://github.com/apache/calcite/blob/35c5f57d7db2b4745086178602ca69195ffb858e/core/src/main/java/org/apache/calcite/jdbc/JavaTypeFactoryImpl.java#L193
[2]
https://github.com/apache/calcite/blob/35c5f57d7db2b4745086178602ca69195ffb858e/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java#L243


On Fri, Oct 4, 2019 at 5:26 PM Jess Balint  wrote:

> I'm returning string objects from my enumerable, but getting an exception
> when trying to use the MONTH function which compiles to:
>
>
>
> org.apache.calcite.avatica.util.DateTimeUtils.unixDateExtract(org.apache.calcite.avatica.util.TimeUnitRange.MONTH,
> org.apache.calcite.runtime.SqlFunctions.toInt(current[1]))};
>
> current[1] is a string here and an exception is thrown. are dates expected
> to be java.util.Date objects? Is there documentation on this?
>
> Thanks.
>
> Jess
>


how to return dates in java/enumerable convention?

2019-10-04 Thread Jess Balint
I'm returning string objects from my enumerable, but getting an exception
when trying to use the MONTH function which compiles to:


org.apache.calcite.avatica.util.DateTimeUtils.unixDateExtract(org.apache.calcite.avatica.util.TimeUnitRange.MONTH,
org.apache.calcite.runtime.SqlFunctions.toInt(current[1]))};

current[1] is a string here and an exception is thrown. are dates expected
to be java.util.Date objects? Is there documentation on this?

Thanks.

Jess