[tarantool-patches] [PATCH 5/5] Enforce space format for columns

  • From: Georgy Kirichenko <georgy@xxxxxxxxxxxxx>
  • To: tarantool-patches@xxxxxxxxxxxxx
  • Date: Sun, 15 Jul 2018 23:44:50 +0300

Use correct field type for each table column instead of scalar
---
 src/box/sql.c                 | 18 +++++++-----------
 test/sql-tap/select1.test.lua |  6 +++---
 2 files changed, 10 insertions(+), 14 deletions(-)

diff --git a/src/box/sql.c b/src/box/sql.c
index 12279d0e1..c2af5c4de 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -1376,26 +1376,22 @@ static const struct Enc *get_enc(void *buf)
  */
 static const char *convertSqliteAffinity(int affinity, bool allow_nulls)
 {
-       if (allow_nulls || 1) {
+       (void) allow_nulls;
+/*     if (allow_nulls || 1) {
                return "scalar";
-       }
+       }*/
        switch (affinity) {
-       default:
-               assert(false);
        case AFFINITY_BLOB:
                return "scalar";
        case AFFINITY_TEXT:
                return "string";
        case AFFINITY_NUMERIC:
        case AFFINITY_REAL:
-         /* Tarantool workaround: to make comparators able to compare, e.g.
-            double and int use generic type. This might be a performance 
issue.  */
-         /* return "number"; */
-               return "scalar";
+               return "number";
        case AFFINITY_INTEGER:
-         /* See comment above.  */
-         /* return "integer"; */
-               return "scalar";
+               return "integer";
+       default:
+               assert(false);
        }
 }
 
diff --git a/test/sql-tap/select1.test.lua b/test/sql-tap/select1.test.lua
index 1503bd041..9415256c6 100755
--- a/test/sql-tap/select1.test.lua
+++ b/test/sql-tap/select1.test.lua
@@ -222,17 +222,17 @@ string.format([[
         INSERT INTO test1 VALUES(11,22);
         INSERT INTO test1 VALUES(33,44);
         DROP TABLE IF EXISTS t3;
-        CREATE TABLE t3(id INT, a INT , b INT , PRIMARY KEY(id));
+        CREATE TABLE t3(id INT, a TEXT, b TEXT, PRIMARY KEY(id));
         INSERT INTO t3 VALUES(1, 'abc',NULL);
         INSERT INTO t3 VALUES(2, NULL,'xyz');
         INSERT INTO t3 SELECT f1, * FROM test1;
         DROP TABLE IF EXISTS t4;
-        CREATE TABLE t4(id INT, a INT , b INT , PRIMARY KEY(id));
+        CREATE TABLE t4(id INT, a INT , b TEXT , PRIMARY KEY(id));
         INSERT INTO t4 VALUES(1, NULL,'%s');
         SELECT * FROM t3;
     ]], long), {
         -- <select1-2.0>
-        1, "abc", "", 2, "", "xyz", 11, 11, 22, 33, 33, 44
+        1, "abc", "", 2, "", "xyz", 11, "11", "22", 33, "33", "44"
         -- </select1-2.0>
     })
 
-- 
2.18.0


Other related posts:

  • » [tarantool-patches] [PATCH 5/5] Enforce space format for columns - Georgy Kirichenko