happyiwin / common-schema

Automatically exported from code.google.com/p/common-schema
0 stars 0 forks source link

split does not work if stop is specified #65

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
Which version of common_schema are you using? (specify
revision+distribution)
version 2.2, revision 523, distribution common_schema-2.2.sql

Which component is failing? (specify the view, function, etc.)
split, with stop parameter specified

What is the expected output? What do you see instead?
Should iterate over the statement but does not

Can you provide with sample data?
call common_schema.run('
split ({start: 80, stop: 300, size: 125} : select * from mytable where)
{
  select 
      $split_step as step, $split_columns as columns, 
      $split_min as min_value, $split_max as max_value, 
      $split_range_start as range_start, $split_range_end as range_end
}
');

(As of version 1.1), please provide output of
SELECT * FROM common_schema.status
+---------------+---------+----------+---------------------+-----------------+--
-------------------------+------------------------------------+-----------------
--------------------+-----------------------+-----------------------------------
-----------+
| project_name  | version | revision | install_time        | install_success | 
base_components_installed | innodb_plugin_components_installed | 
percona_server_components_installed | install_mysql_version | install_sql_mode  
                           |
+---------------+---------+----------+---------------------+-----------------+--
-------------------------+------------------------------------+-----------------
--------------------+-----------------------+-----------------------------------
-----------+
| common_schema | 2.2     | 523      | 2014-10-29 19:30:46 | 1               | 
1                         | 1                                  | 0              
                     | 5.6.21-log            | 
NO_AUTO_VALUE_ON_ZERO,NO_ENGINE_SUBSTITUTION |
+---------------+---------+----------+---------------------+-----------------+--
-------------------------+------------------------------------+-----------------
--------------------+-----------------------+-----------------------------------
-----------+

Please provide any additional information below.
I found that in some cases split did not work when I specified the stop 
parameter. At first I thought it was due to something in my table, but then I 
realized that it is because the values in the start and stop parameters are 
compared to each other to set the value of @_split_is_empty_range_result in 
_split_assign_min_max_variables (lines 81 to 94) - the problem is that the 
values being compared are text, so the range may get incorrectly set to be 
empty. In the example above I set start to 80 and stop to 300, but when the 
text is compared 80 is greater than 300. The comparison needs to compare the 
values as numbers when the column type is numeric.

Original issue reported on code.google.com by sno...@emmis.com on 30 Oct 2014 at 4:45

GoogleCodeExporter commented 8 years ago
Thank you and apologies for the late response. This is quite an issue; I'll 
address it shortly.

Original comment by shlomi.n...@gmail.com on 13 Dec 2014 at 7:23