[tarantool-patches] Re: [PATCH 5/9] sql: improve type determination for column meta

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Tue Apr 16 17:12:52 MSK 2019



On 14/04/2019 18:04, Nikita Pettik wrote:
> In most cases we don't assign and store type of node of expression AST
> (except for constant literals).  To determine type of node  we use
> sql_expr_type() function, which implements logic of quite simple
> recursive tree traversal. Before this patch we set type of node after
> code generation in sqlExprCodeTarget() without any traversal. This
> approach is way worse even then sql_expr_type().

Why? How is recursive scan of the tree better than simple access to
a struct's attribute? I see, that your patch improves type determination
precision, but I do not understand how, and what a perf price for that?
If you are not sure about the price, we could ask Alexander to run
benches on your branch before pushing into the master.

> So, to improve accuracy
> of type determination, let's always call that method and remove type
> assignment in sqlExprCodeTarget().

This patch fixes the issue
https://github.com/tarantool/tarantool/issues/4126.

> ---
>  src/box/sql/expr.c                         | 19 ++++---------------
>  src/box/sql/select.c                       |  2 +-
>  test/sql/check-clear-ephemeral.result      |  2 +-
>  test/sql/gh-2347-max-int-literals.result   |  2 +-
>  test/sql/gh-3199-no-mem-leaks.result       | 18 +++++++++---------
>  test/sql/gh-3888-values-blob-assert.result |  2 +-
>  test/sql/persistency.result                |  8 ++++----
>  test/sql/transition.result                 |  4 ++--
>  test/sql/types.result                      | 10 +++++-----
>  9 files changed, 28 insertions(+), 39 deletions(-)
> 




More information about the Tarantool-patches mailing list