> On Nov. 27, 2014, 4:11 a.m., Mehant Baid wrote:
> > exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java,
> >  line 490
> > <https://reviews.apache.org/r/28496/diff/1/?file=777185#file777185line490>
> >
> >     Why are you dividing the milli second value by 1000 everywhere? In 
> > Drill we represent Timestamp in milliseconds from EPOCH. For an example 
> > look at the class CastVarCharToTimeStamp

Unix Timestamp is seconds since '1970-01-01 00:00:00'. Thats why I divided by 
1000 after getting the date in milliseconds. Even in Hive also, it is 
implemented similarly by getting date in milliseconds and then converting that 
to seconds.
http://dev.mysql.com/doc/refman/5.5/en/date-and-time-functions.html#function_unix-timestamp


> On Nov. 27, 2014, 4:11 a.m., Mehant Baid wrote:
> > exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java,
> >  line 522
> > <https://reviews.apache.org/r/28496/diff/1/?file=777185#file777185line522>
> >
> >     I looked at unix_timestamp in MySQL and Oracle and they either accept 0 
> > arguments or 1 argument. I don't think we need to have the third function

Yeah, you are right. But in Hive, they support this function as well. 
Unix_timestamp(String date, String datePattern). I think this will add more 
flexibility as date can have different pattern but patterns should match with 
the joda pattern as I am using joda to parse the pattern. I feel this can also 
be added. It is still ANSI SQL just that we have one more functionality. If you 
think otherwise, I can clean that up.


> On Nov. 27, 2014, 4:11 a.m., Mehant Baid wrote:
> > exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java,
> >  line 544
> > <https://reviews.apache.org/r/28496/diff/1/?file=777185#file777185line544>
> >
> >     Please add tests for this function. Look at TestExampleQueries to add a 
> > new test.

I have added test cases for 2 and 3 functions. For 1. unix_timestamp(), I am 
not sure how to add test cases as it gets the current time's unix timestamp, 2. 
unix_timestamp(String date) and 3. unix_timestamp(String date, String 
datePattern)


- Venkata krishnan


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviews.apache.org/r/28496/#review63177
-----------------------------------------------------------


On Nov. 27, 2014, 8:16 a.m., Venkata krishnan Sowrirajan wrote:
> 
> -----------------------------------------------------------
> This is an automatically generated e-mail. To reply, visit:
> https://reviews.apache.org/r/28496/
> -----------------------------------------------------------
> 
> (Updated Nov. 27, 2014, 8:16 a.m.)
> 
> 
> Review request for drill and Mehant Baid.
> 
> 
> Repository: drill-git
> 
> 
> Description
> -------
> 
> Added functionality for unix_timestamp() similar to MySQL
> 
> 
> Diffs
> -----
> 
>   
> exec/java-exec/src/main/java/org/apache/drill/exec/expr/fn/impl/DateTypeFunctions.java
>  f063466 
>   
> exec/java-exec/src/test/java/org/apache/drill/exec/fn/impl/TestDateFunctions.java
>  1ecae19 
>   
> exec/java-exec/src/test/resources/functions/date/to_unixtimestamp_for_date.json
>  PRE-CREATION 
>   
> exec/java-exec/src/test/resources/functions/date/to_unixtimestamp_for_date_with_pattern.json
>  PRE-CREATION 
> 
> Diff: https://reviews.apache.org/r/28496/diff/
> 
> 
> Testing
> -------
> 
> Added testcases
> 
> 
> Thanks,
> 
> Venkata krishnan Sowrirajan
> 
>

Reply via email to