Add support for Timestamp data type in SQL Select (#7185)

This change adds support for casting strings to Timestamp via CAST:
`CAST('2010T' AS TIMESTAMP)`

It also implements the following date-time functions:
  - UTCNOW()
  - DATE_ADD()
  - DATE_DIFF()
  - EXTRACT()

For values passed to these functions, date-types are automatically
inferred.
This commit is contained in:
Aditya Manthramurthy
2019-02-04 20:54:45 -08:00
committed by kannappanr
parent ea6d61ab1f
commit f04f8bbc78
10 changed files with 514 additions and 35 deletions

View File

@@ -60,6 +60,8 @@ func (r *Record) Set(name string, value *sql.Value) (err error) {
v = f
} else if i, ok := value.ToInt(); ok {
v = i
} else if t, ok := value.ToTimestamp(); ok {
v = sql.FormatSQLTimestamp(t)
} else if s, ok := value.ToString(); ok {
v = s
} else if value.IsNull() {