Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

split does not work if stop is specified #65

Open
GoogleCodeExporter opened this issue Jun 18, 2015 · 1 comment
Open

split does not work if stop is specified #65

GoogleCodeExporter opened this issue Jun 18, 2015 · 1 comment

Comments

@GoogleCodeExporter
Copy link

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 [email protected] on 30 Oct 2014 at 4:45

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant