Integer division returning floats after upgrade to 6.1

Hi All, Integer division has miraculously started returning floats after upgrading to vertica 6.1 from 5.1. Is there some flag which can make things as they were ? Thanks in Advance.

Comments

  • ok i discovered the “//” operator. Any other things like this which I should be worried about ?
  • You might find it good practice to check the release notes and New Features Documentation section… Upgrade notes: Dividing integers with the / operator As mentioned in the Vertica 6 New Features Guide, the Vertica 6 release introduced a behavior change when dividing integers using the / operator, as follows: In this release… … / yields this result: Vertica 6.x NUMERIC Vertica 5.x Whole Number Note that Vertica 6.x users could also use a double slash (//) operator for a whole number result when dividing two integers. In Vertica 6 SP1, we’ve introduced a new configuration parameter you can use if you want to roll back to the 5.x single slash operator behavior: Parameter Description UseV50IntegerDivision Specifies that dividing two integers using / should result in a whole number. Acceptable values: • 0—Turns the parameter off. (This is the default.) When set to 0, / returns a NUMERIC result. • 1—Turns the parameter on. When set to 1, / returns a whole number result. Note that the parameter affects division moving forward. It does not change the results of divison that were calculated before you turned the parameter on. While Vertica has provided this parameter to help our customers who may not be ready to modify existing code, we strongly recommend moving to the new SQL-compliant Vertica 6 behavior as soon as possible. If you use / to divide integers in projection segmentation or partition clauses If your 5.x projection definitions included segmentation or partitioning clauses that used the / operator for dividing integers, be aware that your projections will be unaffected after you upgrade. The column definitions will still reflect the single slash behavior in Vertica 5.x. However, you will not be able to create a buddy projection from such projections after upgrading unless you turn the UseV50IntegerDivision parameter on. This is because single slash behavior in the projection created in version 6 will differ from that used in the version 5.x projection. For this reason, you should either: • Always use the // character when dividing integers in any segmentation or partitioning expressions, or • Turn on the UseV50IntegerDivision parameter immediately after upgrading.
  • How do I turn on this UseV50IntegerDivision parameter. I dont see this setting in configuration_parameters

Leave a Comment

BoldItalicStrikethroughOrdered listUnordered list
Emoji
Image
Align leftAlign centerAlign rightToggle HTML viewToggle full pageToggle lights
Drop image/file