regexp1987 / common-schema

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

add next partition not using datetime fail after a value >= 10000 (or thereabouts) #75

Open GoogleCodeExporter opened 8 years ago

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

Which component is failing? (specify the view, function, etc.)
 view _sql_range_partitions_summary

What is the expected output? What do you see instead?
I have partitions set up by range using the id field.
I manually create partitions by range of 2000,4000,6000

I call the common_schema function sql_add_next_partition. It adds a new 
partition of range less than 8000
I call it again, it adds a partition of range less than 10,000
I call it again, it complains of a duplicated range.

I've narrowed it down to this code in the view noted above:
    MAX(IF(PARTITION_DESCRIPTION != 'MAXVALUE', 
      IFNULL(_as_datetime(unquote(PARTITION_DESCRIPTION)), CAST(PARTITION_DESCRIPTION AS SIGNED)), 
      NULL)
_as_datetime seems to have problems with the value 10000, so the result of the 
query is 8000. The diff is added to this value to get the next partition name 
of p_10000 which already exists.
The code does not seem to manage datetimes and integral values it seems.

Original issue reported on code.google.com by russ...@internode.on.net on 27 Apr 2015 at 7:39