From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id E438746970E for ; Mon, 10 Feb 2020 02:45:42 +0300 (MSK) Date: Mon, 10 Feb 2020 02:45:40 +0300 From: Nikita Pettik Message-ID: <20200209234540.GC1110@tarantool.org> References: <55e18164c96a568a757423df813dc4e73f45b1c9.1577782147.git.imeevma@gmail.com> <20191231085607.GB30188@tarantool.org> <20191231094611.GA9514@tarantool.org> <20200113125829.GB7851@tarantool.org> <20200117080636.GA23812@tarantool.org> <20200122132617.GA1144@tarantool.org> <20200123134040.GA18715@tarantool.org> <20200128162329.GA1049@tarantool.org> <20200203095210.GA7696@tarantool.org> <20200209212932.bwo7bzovelxcog2z@tkn_work_nb> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20200209212932.bwo7bzovelxcog2z@tkn_work_nb> Subject: Re: [Tarantool-patches] [PATCH v2 1/1] sql: make NUMBER to be union of SQL numeric types List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Alexander Turenko Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org On 10 Feb 00:29, Alexander Turenko wrote: > On Mon, Feb 03, 2020 at 12:52:10PM +0300, Mergen Imeev wrote: > > On Tue, Jan 28, 2020 at 07:23:29PM +0300, Nikita Pettik wrote: > > > On 23 Jan 16:40, Mergen Imeev wrote: > > > > Hi! Thank you for review. My answers and new commit-message > > > > below. > > > > > > Hi, > > > > > > I've a bit reworked your patch: splitted it into consistent sequence of > > > independent patches and provided refactoring for sqlVdbeMemNumerify(). > > > Also I found that CAST boolean AS NUMBER didn't work properly: cast resulted > > > in error meanshile cast boolean as integer is legal, so that as number should > > > be legal as well. There's no more functional changes except for mentioned one. > > > Please look at branch: https://github.com/tarantool/tarantool/commits/np/gh-4233-fix-number-field-type-in-sql > > > > > > If it is OK to you please reply and I will push patches to master bracnch. > > > Thanks. > > > > > Hi, > > > > I'm sorry, but I do not like it. Since now it is yours > > commits, I'll ask Sasha to move issues #4233 and #4463 > > to you. If you want a review, please ask Vlad. > > I guess Nikita expects that you'll agree with splitting of the commits > and show you the code to save a time on a discussion. Since you > disagreed (this fast path fails), I think Nikita should provide I've provided arguments in my review (as I always do). > objections against your way explicitly. (However 'I do not like' is very > weak argument, it is always better to provide some reasons explicitly.) > > 'CAST boolean AS NUMBER' does not look as part of tasks Mergen solving > here (#4233 and #4463). Changes provided by Mergen look significant enough to consider them as reworking of number type. So as long as cast blob to number is changed in scope of patch, it seems to be ok to fix cast boolean to number as well. >Aside of this, the commit that fixes it is named > as 'sql: refactor sqlVdbeMemNumerify()', but it changes a user visible > behaviour and so it is not pure refactoring. Could you please explain why it "changes a user visible behaviour"? :) What is more, commit message explicitly says: "...allow conversion from boolean to number (since it is legal to convert boolean to integer, and in turn number type completely includes integer type)." It is related only to this function, which in turn is unreachable. If it is not clear enough, I'll fix a bit commit message. Finally, if you wish to stress the word 'refactoring' implying its 'non-functional' origins..Well, as I already said, patch does not introduce any functional changes (i.e. changes that can be tested), but in current context 'refactoring' may seem a bit dubious. I guess replacing it with 'rework' is enough to remove any doubts. >It is also strange that it > has no tests that will show how the behaviour is changed. It's a consequence from your previous *wrong* observation: patch has no tests since it doesn't change anything that can be tested. Tests which verify boolean to number cast operation come with patch that introduces this change (not the one we are speaking about). > Changes related to Tarantool/SQL type system are very opaque now in the > sense that we have no formal type system description we want to > implement as result. Just 'fix that' and 'change this'. I think we > should design the type system first (we should did it a year ago) and > only then make some changes. Well we (me, Kostja and Peter) had a long conversation last summer concerning types in SQL (it is still available in mailing list). It is resulted in following issues: https://github.com/tarantool/tarantool/issues/3809 https://github.com/tarantool/tarantool/issues/4230 Alternatively, implicit casts can be completely removed (which matches with ANSI on the one hand, but contradicts to user's exprience on the other hand). Both options look acceptable to me. Speaking of "type system", in fact there's well stablished plan. What we need to do to finish it is (in terms of major issues): - remove implicit casts (or reconsider them; now they are a bit broken - see issues #3809 and #4230); - decide how to threat SCALAR type in SQL (on the discussion, see Re: [Tarantool-discussions] Implicit cast for COMPARISON); - implement MAP and ARRAY types (#4762 and #4763); - implement DECIMAL type (#4415). Then we will be able to move to some more advanced features like varchars, datetime, user-defined-cast operations and so forth (depending on customer's requests). Mergen's patch in particular resolves the legacy issues appeared due to the absence of DOUBLE type in Tarantool. Owing to that "number" type in SQL used to emulate DOUBLE type; since now double is on board, we can revert that behaviour. > CCed Kirill and Sergos to plan this > activity (or decide that the current way to design it is okay). > > WBR, Alexander Turenko.