Hi all,
I'm trying to use ADD_SECONDS to convert epoch time to a timestamp and I don't quite get its behavior:
I've got a table with an integer column:
hdbsql HDB=> select * from ttt limit 1;
| DOCUMENT_ID | TIME | CATEGORY | RELEVANCE |
| -------------------- | ----------- | --------------------------- | ----------- |
| 733431348 | 1378843045 | HEALTH_CARE_PHARMACEUTICALS | 80 |
When I try to use ADD_SECONDS, it refuses:
hdbsql HDB=> select document_id, add_seconds('1970-01-01', time) ts, category, relevance FROM ttt;
* 7: feature not supported: cannot support non-constant types SQLSTATE: HY000
I would understand it, if it were consistent in this, but it is not:
hdbsql HDB=> select document_id, add_seconds('1970-01-01', round(time, 0, round_down)) ts, category, relevance FROM ttt limit 1;
| DOCUMENT_ID | TS | CATEGORY | RELEVANCE |
| -------------------- | ----------------------------- | --------------------------- | ----------- |
| 733431348 | 2013-09-10 19:57:25.000000000 | HEALTH_CARE_PHARMACEUTICALS | 80 |
Is this some magic property of ROUND (mind you, without ROUND_DOWN it still refuses) to convert a column value to a constant? If ADD_SECONDS actually can work with non-constant values, it should do that consistently, without the need for such tricks. Actually, Hana should provide functions to convert EPOCH time to a timestamp and vice versa, then one would not need such tricks at all.
Cheers,
-- Micha