You've already forked mariadb-columnstore-engine
							
							
				mirror of
				https://github.com/mariadb-corporation/mariadb-columnstore-engine.git
				synced 2025-10-30 07:25:34 +03:00 
			
		
		
		
	fix: MCOL-5778 sum return null value due to nullif function
This commit is contained in:
		
				
					committed by
					
						 Leonid Fedorov
						Leonid Fedorov
					
				
			
			
				
	
			
			
			
						parent
						
							af6a716079
						
					
				
				
					commit
					b01be6ae2d
				
			| @@ -30,6 +30,8 @@ bool nonConstFunc(Item_func* ifp) | |||||||
|   { |   { | ||||||
|     if (ifp->arguments()[i]->type() == Item::FUNC_ITEM && nonConstFunc(((Item_func*)ifp->arguments()[i]))) |     if (ifp->arguments()[i]->type() == Item::FUNC_ITEM && nonConstFunc(((Item_func*)ifp->arguments()[i]))) | ||||||
|       return true; |       return true; | ||||||
|  |     if (ifp->arguments()[i]->type() == Item::CACHE_ITEM) | ||||||
|  |       return true; | ||||||
|   } |   } | ||||||
|  |  | ||||||
|   return false; |   return false; | ||||||
|   | |||||||
							
								
								
									
										16
									
								
								mysql-test/columnstore/bugfixes/mcol-5778.result
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										16
									
								
								mysql-test/columnstore/bugfixes/mcol-5778.result
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,16 @@ | |||||||
|  | DROP DATABASE IF EXISTS mcol5778; | ||||||
|  | CREATE DATABASE mcol5778; | ||||||
|  | USE mcol5778; | ||||||
|  | create table test ( a double, b double ) engine=columnstore; | ||||||
|  | insert into test values (100,100); | ||||||
|  | select sum(a)/NULLIF(sum(b),0) from test; | ||||||
|  | sum(a)/NULLIF(sum(b),0) | ||||||
|  | 1 | ||||||
|  | select sum(a)/NULLIF(b,0) from test; | ||||||
|  | sum(a)/NULLIF(b,0) | ||||||
|  | 1 | ||||||
|  | select sum(a)/NULLIF(100,0) from test; | ||||||
|  | sum(a)/NULLIF(100,0) | ||||||
|  | 1 | ||||||
|  | drop table test; | ||||||
|  | DROP DATABASE mcol5778; | ||||||
							
								
								
									
										21
									
								
								mysql-test/columnstore/bugfixes/mcol-5778.test
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										21
									
								
								mysql-test/columnstore/bugfixes/mcol-5778.test
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,21 @@ | |||||||
|  | -- source ../include/have_columnstore.inc | ||||||
|  |  | ||||||
|  | --disable_warnings | ||||||
|  | DROP DATABASE IF EXISTS mcol5778; | ||||||
|  | --enable_warnings | ||||||
|  |  | ||||||
|  | CREATE DATABASE mcol5778; | ||||||
|  |  | ||||||
|  | USE mcol5778; | ||||||
|  |  | ||||||
|  | create table test ( a double, b double ) engine=columnstore; | ||||||
|  | insert into test values (100,100); | ||||||
|  |  | ||||||
|  | select sum(a)/NULLIF(sum(b),0) from test; | ||||||
|  |  | ||||||
|  | select sum(a)/NULLIF(b,0) from test; | ||||||
|  |  | ||||||
|  | select sum(a)/NULLIF(100,0) from test; | ||||||
|  |  | ||||||
|  | drop table test; | ||||||
|  | DROP DATABASE mcol5778; | ||||||
		Reference in New Issue
	
	Block a user