Changeset: 07455c65e6b5 for MonetDB
URL: https://dev.monetdb.org/hg/MonetDB?cmd=changeset;node=07455c65e6b5
Modified Files:
        sql/server/rel_optimizer.c
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
        
sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
Branch: default
Log Message:

Merged with Apr2019.


diffs (69 lines):

diff --git a/sql/server/rel_optimizer.c b/sql/server/rel_optimizer.c
--- a/sql/server/rel_optimizer.c
+++ b/sql/server/rel_optimizer.c
@@ -3087,7 +3087,8 @@ exp_simplify_math( mvc *sql, sql_exp *e,
                                atom *la = exp_flatten(sql, le);
                                atom *ra = exp_flatten(sql, re);
 
-                               if (la && ra) {
+                               /* TODO check if output type is larger then 
input */
+                               if (la && ra && subtype_cmp(atom_type(la), 
atom_type(ra)) == 0 && subtype_cmp(atom_type(la), exp_subtype(e)) == 0) {
                                        atom *a = atom_mul(la, ra);
 
                                        if (a && atom_cast(sql->sa, a, 
exp_subtype(e))) {
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out
@@ -162,6 +162,24 @@ stdout of test 'sqlitelogictest-aritmeti
 % bigint # type
 % 1 # length
 [ NULL ]
+#SELECT ALL - - 11 + 51 + + 32 + 13 - - - NULLIF ( - + 52, + + 19 ) - + ( + + 
9 ) + + 44 * - 69 / + - 30 + 24 / - 71 + + CAST ( NULL AS REAL ) * - 72 + - 44 
* - + 68 + - + COUNT ( DISTINCT 55 ) AS col1; -- NULL
+% .L5 # table_name
+% col1 # name
+% real # type
+% 15 # length
+[ NULL ]
+#SELECT - + 94 * - 81 / + 4 + + 92 * + + CAST ( NULL AS REAL ) * + + 97 * - ( 
+ - COUNT ( * ) ) AS col0; -- NULL
+% .L5 # table_name
+% col0 # name
+% real # type
+% 15 # length
+[ NULL ]
+#SELECT 71 * - 59 / - COUNT ( * ) + - 98 * - + 35 / + CAST ( NULL AS REAL ) / 
- ( + COUNT ( * ) ) AS col0; --NULL
+% .L6 # table_name
+% col0 # name
+% real # type
+% 15 # length
+[ NULL ]
 
 # 16:20:37 >  
 # 16:20:37 >  "Done."
diff --git 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
--- 
a/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
+++ 
b/sql/test/BugTracker-2018/Tests/sqlitelogictest-aritmetic-expressions-handling.Bug-6576.stable.out.int128
@@ -162,6 +162,24 @@ stdout of test 'sqlitelogictest-aritmeti
 % hugeint # type
 % 1 # length
 [ NULL ]
+#SELECT ALL - - 11 + 51 + + 32 + 13 - - - NULLIF ( - + 52, + + 19 ) - + ( + + 
9 ) + + 44 * - 69 / + - 30 + 24 / - 71 + + CAST ( NULL AS REAL ) * - 72 + - 44 
* - + 68 + - + COUNT ( DISTINCT 55 ) AS col1; -- NULL
+% .L5 # table_name
+% col1 # name
+% real # type
+% 15 # length
+[ NULL ]
+#SELECT - + 94 * - 81 / + 4 + + 92 * + + CAST ( NULL AS REAL ) * + + 97 * - ( 
+ - COUNT ( * ) ) AS col0; -- NULL
+% .L5 # table_name
+% col0 # name
+% real # type
+% 15 # length
+[ NULL ]
+#SELECT 71 * - 59 / - COUNT ( * ) + - 98 * - + 35 / + CAST ( NULL AS REAL ) / 
- ( + COUNT ( * ) ) AS col0; --NULL
+% .L6 # table_name
+% col0 # name
+% real # type
+% 15 # length
+[ NULL ]
 
 # 16:20:37 >  
 # 16:20:37 >  "Done."
_______________________________________________
checkin-list mailing list
checkin-list@monetdb.org
https://www.monetdb.org/mailman/listinfo/checkin-list

Reply via email to