nebula icon indicating copy to clipboard operation
nebula copied to clipboard

Support for adding built-in transformations in the date function timestamp

Open wx-123456 opened this issue 4 years ago • 11 comments

日期转换函数timpstamp插入和保存都是int64,后面是否会支持yyyy-MM-dd HH:mm:ss这种形式,同时支持内部日期函数转换,将int64转换成yyyy-MM-dd HH:mm:ss。对于int64,现在的解决措施只能是应用内转换和新建string字段展示正常的日期格式

wx-123456 avatar May 26 '21 09:05 wx-123456

Dear @wx-123456 ,

For the insert, it can take a string like this:

INSERT VERTEX school(name, found_time) VALUES "DUT":("DUT", timestamp("1988-03-01T08:00:00"));

While for return/yield, maybe a function to convert int64 into a string would be with better experience to save the application from converting/displaying DateTime props.

What do you think @CPWstatic, please?

Thanks a lot for raising this!

wey-gu avatar May 26 '21 09:05 wey-gu

后面是否会支持yyyy-MM-dd HH:mm:ss这种形式

For this part, you could try Date or DateTime.

将int64转换成yyyy-MM-dd HH:mm:ss

This would be considered as function.

CPWstatic avatar May 27 '21 02:05 CPWstatic

Maybe I can try to fix it.

jackwener avatar Jul 20 '21 11:07 jackwener

@CPWstatic Is this issue still valid?

jamieliu1023 avatar Jul 20 '21 11:07 jamieliu1023

Maybe I can try to fix it.

Thanks very much. Try it.

laura-ding avatar Jul 20 '21 11:07 laura-ding

Maybe I can try to fix it.

Already assigned it to you.

jamieliu1023 avatar Jul 20 '21 11:07 jamieliu1023

Insert Insert timestamp is supported at present, so we can ignore insert.

store It isn't good idea that timestamp store as String in special format .

return/show Naturally, we will try to return/show timestamp as String in special format through a function. But it is troublesome that because the type is lost. In the FunctionManager.cpp, we can see that there isn't type timestamp . In the end of request, we will just get List<Row<Int>> from Response, we can't distinguish between Int and Int from timestamp() .

jackwener avatar Aug 24 '21 17:08 jackwener

I think it isn't wise that add a new type or modify many code due to this demand.

jackwener avatar Aug 24 '21 17:08 jackwener

store It isn't good idea that timestamp store as String in special format .

True, it should only be a handy function(rather than introducing any new types) to take non-int format data to save user from constructing datatime in int type themself. Underlying it should be stored as existing datatime type(int).

wey-gu avatar Aug 25 '21 01:08 wey-gu

Consider this

toDate(int)
date(int)

CPWstatic avatar Aug 28 '21 05:08 CPWstatic

Hi, I’m Artem from OSS Revival. And I am already working on this issue.

ghost avatar Feb 10 '25 08:02 ghost