Tarantool development patches archive
 help / color / mirror / Atom feed
From: Nikita Pettik <korablev@tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 3/4] sql: fix CAST AS NUMBER operator
Date: Tue, 11 Feb 2020 17:14:32 +0300	[thread overview]
Message-ID: <20200211141432.GA5708@tarantool.org> (raw)
In-Reply-To: <eee149e2-52be-6179-0f59-34c2beaac9a9@tarantool.org>

On 11 Feb 00:24, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> 
> See 5 comments below.
> 
> > diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
> > index 9c937a065..a3f0bc787 100755
> > --- a/test/sql-tap/cast.test.lua
> > +++ b/test/sql-tap/cast.test.lua
> > @@ -663,14 +663,14 @@ test:do_execsql_test(
> >          SELECT CAST(-9223372036854774800 AS NUMBER)
> >      ]], {
> >          -- <cast-3.6>
> > -        -9223372036854774784
> > +        -9223372036854774800LL
> >          -- </cast-3.6>
> >      })
> >  
> >  test:do_execsql_test(
> >      "cast-3.7",
> >      "SELECT CAST(-9223372036854774800 AS NUMBER)",
> > -    {-9.22337203685477e+18})
> > +    {-9223372036854774800LL})
> 
> 1. 3.6 and 3.7 are the same. I propose to drop one.
> 
> >  test:do_execsql_test(
> >      "cast-3.8",
> > @@ -705,12 +705,12 @@ test:do_execsql_test(
> >  test:do_execsql_test(
> >      "cast-3.13",
> >      "SELECT CAST(9223372036854774800 AS NUMBER)",
> > -    {9.22337203685477e+18})
> > +    {9223372036854774800LL})
> 
> 2. 3.2, 3.3 and 3.13 are exactly the same. I propose to keep
> only one.
> 
> > @@ -732,7 +732,7 @@ test:do_execsql_test(
> >  test:do_execsql_test(
> >      "cast-3.16",
> >      [[
> > -        SELECT CAST('-9223372036854774800' AS NUMBER)
> > +        SELECT CAST('-9223372036854774800.' AS NUMBER)
> >      ]], {
> >          -- <cast-3.16>
> >          -9223372036854774784
> 
> 3. 3.16 and 3.17 are the same. Lets drop one.

Oh, thanks. Removed all duplicates from tests.
 
> > @@ -778,7 +778,7 @@ if true then --test:execsql("PRAGMA encoding")[1][1]=="UTF-8" then
> >          })
> >      test:do_execsql_test(
> >          "cast-3.23",
> > -        "SELECT CAST(x'39323233333732303336383534373734383030' AS NUMBER)",
> > +        "SELECT CAST(x'393232333337323033363835343737343830302E' AS NUMBER)",
> >          {9.22337203685477e+18})
> 
> 4. 3.22 and 3.23 are the same. Drop one, please.
> 
> >      test:do_execsql_test(
> > @@ -788,7 +788,7 @@ if true then --test:execsql("PRAGMA encoding")[1][1]=="UTF-8" then
> >                          AS integer)
> >          ]], {
> >              -- <cast-3.24>
> > -            9223372036854774784LL
> > +        9223372036854774800LL
> 
> 5. Indentation is a bit off.
> 
> >              -- </cast-3.24>
> >          })
> >  end

Diff:

diff --git a/test/sql-tap/cast.test.lua b/test/sql-tap/cast.test.lua
index a3f0bc787..d4af339fd 100755
--- a/test/sql-tap/cast.test.lua
+++ b/test/sql-tap/cast.test.lua
@@ -1,6 +1,6 @@
 #!/usr/bin/env tarantool
 test = require("sqltester")
-test:plan(85)
+test:plan(80)
 
 --!./tcltestrunner.lua
 -- 2005 June 25
@@ -632,11 +632,6 @@ test:do_execsql_test(
         -- </cast-3.2>
     })
 
-test:do_execsql_test(
-    "cast-3.3",
-    "SELECT CAST(9223372036854774800 AS NUMBER)",
-    {9223372036854774800LL})
-
 test:do_execsql_test(
     "cast-3.4",
     [[
@@ -647,16 +642,6 @@ test:do_execsql_test(
         -- </cast-3.4>
     })
 
-test:do_execsql_test(
-    "cast-3.5",
-    [[
-        SELECT CAST(-9223372036854774800 AS integer)
-    ]], {
-        -- <cast-3.5>
-        -9223372036854774800LL
-        -- </cast-3.5>
-    })
-
 test:do_execsql_test(
     "cast-3.6",
     [[
@@ -667,11 +652,6 @@ test:do_execsql_test(
         -- </cast-3.6>
     })
 
-test:do_execsql_test(
-    "cast-3.7",
-    "SELECT CAST(-9223372036854774800 AS NUMBER)",
-    {-9223372036854774800LL})
-
 test:do_execsql_test(
     "cast-3.8",
     [[
@@ -739,11 +719,6 @@ test:do_execsql_test(
         -- </cast-3.16>
     })
 
-test:do_execsql_test(
-    "cast-3.17",
-    "SELECT CAST('-9223372036854774800.' AS NUMBER)",
-    {-9.22337203685477e+18})
-
 test:do_execsql_test(
     "cast-3.18",
     [[
@@ -776,10 +751,6 @@ if true then --test:execsql("PRAGMA encoding")[1][1]=="UTF-8" then
             9223372036854774784
             -- </cast-3.22>
         })
-    test:do_execsql_test(
-        "cast-3.23",
-        "SELECT CAST(x'393232333337323033363835343737343830302E' AS NUMBER)",
-        {9.22337203685477e+18})
 
     test:do_execsql_test(
         "cast-3.24",
@@ -788,7 +759,7 @@ if true then --test:execsql("PRAGMA encoding")[1][1]=="UTF-8" then
                         AS integer)
         ]], {
             -- <cast-3.24>
-        9223372036854774800LL
+            9223372036854774800LL
             -- </cast-3.24>
         })
 end

  reply	other threads:[~2020-02-11 14:14 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-05 16:19 [Tarantool-patches] [PATCH 0/4] sql: fix NUMBER conversion issues Nikita Pettik
2020-02-05 16:19 ` [Tarantool-patches] [PATCH 1/4] sql: remove cast to INT during FP arithmetic ops Nikita Pettik
2020-02-05 16:19 ` [Tarantool-patches] [PATCH 2/4] sql: refactor sqlVdbeMemNumerify() Nikita Pettik
2020-02-10 23:25   ` Vladislav Shpilevoy
2020-02-11 14:14     ` Nikita Pettik
2020-02-11 22:17       ` Vladislav Shpilevoy
2020-02-05 16:19 ` [Tarantool-patches] [PATCH 3/4] sql: fix CAST AS NUMBER operator Nikita Pettik
2020-02-10 23:24   ` Vladislav Shpilevoy
2020-02-11 14:14     ` Nikita Pettik [this message]
2020-02-11 22:17       ` Vladislav Shpilevoy
2020-02-11 23:20         ` Nikita Pettik
2020-02-11 23:27           ` Vladislav Shpilevoy
2020-02-12 14:10             ` Nikita Pettik
2020-02-05 16:19 ` [Tarantool-patches] [PATCH 4/4] sql: do not force FP representation for NUMBER field Nikita Pettik
2020-02-10 23:24   ` Vladislav Shpilevoy
2020-02-11 14:14     ` Nikita Pettik
2020-02-09 17:39 ` [Tarantool-patches] [PATCH 0/4] sql: fix NUMBER conversion issues Vladislav Shpilevoy

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=20200211141432.GA5708@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 3/4] sql: fix CAST AS NUMBER operator' \
    /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