Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

substring String type column by using Add Function Column #125

Closed
kohry opened this issue Dec 21, 2018 · 3 comments
Closed

substring String type column by using Add Function Column #125

kohry opened this issue Dec 21, 2018 · 3 comments
Assignees
Labels
question Further information is requested

Comments

@kohry
Copy link

kohry commented Dec 21, 2018

#74 is related issue but this is little more specific.
4

Add Function Column works well with numeric types as intended,
but with string type, text slice is not working.
I think python expression should support string slice, as python is famous for being convenient for text slicing.

(timestamp column in the screenshot above is string type. not datetime)

@kohry
Copy link
Author

kohry commented Dec 21, 2018

In this function, I wanted to reformat datetime, so if there is a datetime formatter as a function,
the modeling process will be much simpler.

@shovsj
Copy link
Contributor

shovsj commented Dec 21, 2018

  1. For now, use sqlite instead of python.
    sqlite support datetime functions. see https://www.sqlite.org/lang_datefunc.html
    For your information, sqlite uses IS0-8601 date and time formats, that is,
    A time string can be in any of the following formats:
    YYYY-MM-DD
    YYYY-MM-DD HH:MM
    YYYY-MM-DD HH:MM:SS
    YYYY-MM-DD HH:MM:SS.SSS
    YYYY-MM-DDTHH:MM
    YYYY-MM-DDTHH:MM:SS
    YYYY-MM-DDTHH:MM:SS.SSS
    HH:MM
    HH:MM:SS
    HH:MM:SS.SSS
    now
    DDDDDDDDDD

strftime function(format, timestring) can be used in this circumstance.

   
%d   day of month: 00
%f   fractional seconds: SS.SSS
%H   hour: 00-24
%j   day of year: 001-366
%J   Julian day number
%m   month: 01-12
%M   minute: 00-59
%s   seconds since 1970-01-01
%S   seconds: 00-59
%w   day of week 0-6 with Sunday==0
%W   week of year: 00-53
%Y   year: 0000-9999
%%   %

@shovsj shovsj added the question Further information is requested label Dec 21, 2018
@shovsj shovsj self-assigned this Dec 21, 2018
@shovsj
Copy link
Contributor

shovsj commented Dec 21, 2018

  1. query executor based on sqlite will be developed. one can use not only built-in sql function, aggregate functions but also several udfs and udafs developed by us, or functions developed by herself.

@shovsj shovsj closed this as completed Dec 31, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants