s3select: add trim operator , fix substring and bypass boost::spirit rescan#39
Conversation
35dc415 to
c5caf63
Compare
include/s3select.h
Outdated
|
|
||
| substr_one_arg = (bsc::str_p("substring") >> '(' >> (arithmetic_expression >> bsc::str_p(",") >> arithmetic_expression) >> ')') [BOOST_BIND_ACTION(push_substr_one_arg)]; | ||
|
|
||
| substr_two_arg = (bsc::str_p("substring") >> '(' >> (arithmetic_expression >> bsc::str_p(",") >> arithmetic_expression >> bsc::str_p(",") >> arithmetic_expression) >> ')') [BOOST_BIND_ACTION(push_substr_two_arg)]; |
There was a problem hiding this comment.
no need for substr_one_arg / substr_two_arg rules.
the rule for function accept both rules , the operator will handle those different functions.
There was a problem hiding this comment.
Argument order reverses for push_substr_from and push_substr_from_for in operator. I have modified substring operator to accommodate that. Should I create new operator for 'from' and 'from_for'?
There was a problem hiding this comment.
it better to do it in single operator (re-use code).
main consideration is performance.
the /operator()/ is very intensive , thus code should be compact as possible.
011396e to
7c5daee
Compare
include/s3select_functions.h
Outdated
| {"float", s3select_func_En_t::TO_FLOAT}, | ||
| {"substr", s3select_func_En_t::SUBSTR}, | ||
| {"substring", s3select_func_En_t::SUBSTR}, | ||
| {"substring_from", s3select_func_En_t::SUBSTR_FROM}, |
There was a problem hiding this comment.
must "hide" those functions with '#' ( "#substring_from#")
include/s3select.h
Outdated
| self->getAction()->exprQ.pop_back(); | ||
| func->push_argument(inp_expr); | ||
|
|
||
| base_statement* inp_exp = self->getAction()->exprQ.back(); |
There was a problem hiding this comment.
typo:
use better name for variables , it makes the code more readable
in this case, it will describe the order of parameters and their roles.
include/s3select_functions.h
Outdated
| iter++; | ||
| to = *iter; | ||
| v_to = to->eval(); | ||
| if (v_to.is_string()) |
include/s3select_functions.h
Outdated
| iter++; | ||
| str = *iter; | ||
| v_to = to->eval(); | ||
| if (v_to.is_string()) |
include/s3select_functions.h
Outdated
| int str_length = strlen(v_str.str()); | ||
|
|
||
| v_from = from->eval(); | ||
| if(v_from.is_string()) |
|
|
||
| substr_from = (bsc::str_p("substring") >> '(' >> (arithmetic_expression >> bsc::str_p("from") >> arithmetic_expression) >> ')') [BOOST_BIND_ACTION(push_substr_from)]; | ||
|
|
||
| substr_from_for = (bsc::str_p("substring") >> '(' >> (arithmetic_expression >> bsc::str_p("from") >> arithmetic_expression >> bsc::str_p("for") >> arithmetic_expression) >> ')') [BOOST_BIND_ACTION(push_substr_from_for)]; |
There was a problem hiding this comment.
ok,
those rules accepts the uniq syntax for substring function.
|
looks good. |
7c5daee to
319865c
Compare
|
Thanks. I have addressed the comments. |
|
substr::operator() and substr_from::operator |
… to bind-action more than once per the same text) Signed-off-by: gal salomon <gal.salomon@gmail.com>
319865c to
75b5105
Compare
Align ceph s3select with aws. Signed-off-by: Albin Antony <aantony@redhat.com>
75b5105 to
e720052
Compare
include/s3select.h
Outdated
| } | ||
| } | ||
|
|
||
| void push_trim_remove_type::builder(s3select* self, const char* a, const char* b) const |
There was a problem hiding this comment.
push_trim_type identical to push_trim_remove_type
Signed-off-by: Albin Antony <aantony@redhat.com>
Signed-off-by: Albin Antony <aantony@redhat.com>
c3e7174 to
3e2328e
Compare
Align ceph s3select with aws.
Signed-off-by: Albin Antony aantony@redhat.com