hive-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shyam Sarkar <>
Subject RE: Please check grammar for TIMESTAMP
Date Mon, 09 Mar 2009 22:47:46 GMT

Dear Ashish,

Thanks for the comment. I found the following things from MySQL 6.0 ::

(1) Inside CREATE TABLE, TIMESTAMP does not have any format. It is treated like a primitive
type (string).

(2) Inside SELECT clause, TIMESTAMP(YYYYMMDDHHMMSS) is called as a routine with format information
for output spec. 

===========  MySQL 6.0 function ===============================
TIMESTAMP(expr), TIMESTAMP(expr1,expr2) 
With a single argument, this function returns the date or datetime expression expr as a datetime
value. With two arguments, it adds the time expression expr2 to the date or datetime expression
expr1 and returns the result as a datetime value. 
mysql> SELECT TIMESTAMP('2003-12-31');
        -> '2003-12-31 00:00:00'
mysql> SELECT TIMESTAMP('2003-12-31 12:00:00','12:00:00');
        -> '2004-01-01 00:00:00'

As a result, we have to define TIMESTAMP as primitive type as well as a complex type with
format information.  I have to upgrade the grammar after further inspection. I am going to
add a basic design document to JIRA.

Please provide suggestions.


--- On Mon, 3/9/09, Ashish Thusoo <> wrote:

> From: Ashish Thusoo <>
> Subject: RE: Please check grammar for TIMESTAMP
> To: "" <>
> Date: Monday, March 9, 2009, 2:52 PM
> One immediate issue is that the format string is a lexical
> token, so a string of that format will not conform to the
> grammar at places where a string literal is expected. A
> better approach is to treat the format as a stringliteral
> and then do the format checks at the typecheck and semantic
> analysis time.
> Ashish 
> -----Original Message-----
> From: Shyam Sarkar [] 
> Sent: Sunday, March 08, 2009 7:16 AM
> To:
> Subject: Please check grammar for TIMESTAMP
> Hi Zheng and others,
> Could you please check Hive.g grammar changes for TIMESTAMP
> (See the comments with // Change by Shyam)?
> Please review and let me know your feedback. I shall write
> a short design doc later for review after these short
> exchanges.
> Thanks,


View raw message