-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Additional functions for SQL compatibility #3826
Additional functions for SQL compatibility #3826
Conversation
func_node->name = "substring"; | ||
func_node->arguments = std::move(expr_list_args); | ||
func_node->children.push_back(func_node->arguments); | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Separate function should be both more simple and more efficient.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It appeared that substring
with negative second argument does exactly what right
is supposed to, so I just simplified this aliasing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I mean we need separate functions trim
, trimLeft
, trimRight
with fairly efficient implementation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See b7566a8, looks roughly like this for 16Gb of text with a lot of whitespace:
"runs": [
{
"min_time": 1.224000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(value)"
},
{
"min_time": 2.019000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(trimLeft(value))"
},
{
"min_time": 1.979000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(trimRight(value))"
},
{
"min_time": 1.991000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(trimBoth(value))"
},
{
"min_time": 5.121000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(replaceRegexpOne(value, '^ *', ''))"
},
{
"min_time": 8.320000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(replaceRegexpOne(value, ' *$', ''))"
},
{
"min_time": 12.282000,
"query": "SELECT count() FROM whitespaces WHERE NOT ignore(replaceRegexpAll(value, '^ *| *$', ''))"
}
]
…t about suboptimal library call
…IFF, EXTRACT and INTERVAL (allows to use same set of aliases in them)
No test for |
@alexey-milovidov there's a test for it's implicit call from one of |
|
#3712 #3714 #3704 #3705