Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 5/9] sql: improve type determination for column meta
Date: Tue, 23 Apr 2019 22:58:33 +0300	[thread overview]
Message-ID: <528116B3-186F-4E76-B772-93CABDB1E409@tarantool.org> (raw)
In-Reply-To: <72727290-ccad-85b7-69da-32b59be955a6@tarantool.org>

[-- Attachment #1: Type: text/plain, Size: 2485 bytes --]


>> Secondly, suggested approach simply makes code cleaner and easier
>> to maintain: we shouldn’t care about adding on each branch of switch
>> appropriate type (since it is already done in sql_expr_type()).
>> 
>> Eventually, sqlExprCodeTarget() doesn’t take into consideration
>> types of child nodes. This drawback will appear when we extend
>> integer type with small/big ints:
>> 
>> Column a is of type smallint.
>> 
>> SELECT 1 + a;
>> 
>> Should result in ‘smallint' type, not common ‘number’.
>> Without tree traversal we can’t do that.
>> 
>> Price is a primitive traversal through the expr tree. This traversal (but in more
>> sophisticated implementation and being called only once saving in each node
>> its type) is anyway required to implement this task:
>> https://github.com/tarantool/tarantool/issues/3103 <https://github.com/tarantool/tarantool/issues/3103> <https://github.com/tarantool/tarantool/issues/3103 <https://github.com/tarantool/tarantool/issues/3103>>
> 
> I do not have anything against traversal. I just don't like multiple
> traversal and seemingly free and fast call of deceptive sql_expr_type() -
> it is expensive in fact, just look at this huge 'switch-case'.
> 
> Your patch is ok, it does not aggravate anything. But sql_expr_type()
> is called in very many places. Probably, in scope of 3103 we should
> set Expr type always before optimizer and Vdbe-coder are started. Just
> thoughts.
> 
>> In fact, we should once visit each node (probably after names resolution)
>> and save its type depending on child’s types.
>> 
>>> If you are not sure about the price, we could ask Alexander to run
>>> benches on your branch before pushing into the master.
>> 
>> This patch is auxiliary to main-patchset. I’ve added it to avoid
>> abusing changing result files like sql/types.result etc. Can drop it tho.
> 
> Now I see, that there is nothing to bench. Almost pure refactoring.
> 
>>>> 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 <https://github.com/tarantool/tarantool/issues/4126>.
>> 
>> Ok, added label.
>> 
> 
> During the second review I found some orphan type assignments
> in codetarget(). I dropped them and the tests passed. The diff is
> on the branch.

Thx, applied as obvious.


[-- Attachment #2: Type: text/html, Size: 13743 bytes --]

  reply	other threads:[~2019-04-23 19:58 UTC|newest]

Thread overview: 42+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-04-14 15:03 [tarantool-patches] [PATCH 0/9] Introduce type BOOLEAN in SQL Nikita Pettik
2019-04-14 15:03 ` [tarantool-patches] [PATCH 1/9] sql: refactor mem_apply_numeric_type() Nikita Pettik
2019-04-14 15:04 ` [tarantool-patches] [PATCH 2/9] sql: disallow text values participate in sum() aggregate Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:54     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:58         ` n.pettik
2019-04-14 15:04 ` [tarantool-patches] [PATCH 3/9] sql: use msgpack types instead of custom ones Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:54     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:58         ` n.pettik
2019-04-14 15:04 ` [tarantool-patches] [PATCH 4/9] sql: introduce type boolean Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:54     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:58         ` n.pettik
2019-04-23 21:06           ` Vladislav Shpilevoy
2019-04-14 15:04 ` [tarantool-patches] [PATCH 5/9] sql: improve type determination for column meta Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:54     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:58         ` n.pettik [this message]
2019-04-14 15:04 ` [tarantool-patches] [PATCH 6/9] sql: make comparison predicate return boolean Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:54     ` n.pettik
2019-04-14 15:04 ` [tarantool-patches] [PATCH 7/9] sql: make predicates accept and " Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:55     ` n.pettik
2019-04-14 15:04 ` [tarantool-patches] [PATCH 9/9] sql: make <search condition> accept only boolean Nikita Pettik
2019-04-16 14:12   ` [tarantool-patches] " Vladislav Shpilevoy
2019-04-18 17:55     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:59         ` n.pettik
2019-04-23 21:06           ` Vladislav Shpilevoy
2019-04-23 22:01             ` n.pettik
     [not found] ` <b2a84f129c2343d3da3311469cbb7b20488a21c2.1555252410.git.korablev@tarantool.org>
2019-04-16 14:12   ` [tarantool-patches] Re: [PATCH 8/9] sql: make LIKE predicate return boolean result Vladislav Shpilevoy
2019-04-18 17:55     ` n.pettik
2019-04-22 18:02       ` Vladislav Shpilevoy
2019-04-23 19:58         ` n.pettik
2019-04-24 10:28 ` [tarantool-patches] Re: [PATCH 0/9] Introduce type BOOLEAN in SQL Vladislav Shpilevoy
2019-04-25  8:46 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=528116B3-186F-4E76-B772-93CABDB1E409@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 5/9] sql: improve type determination for column meta' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox