Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-717

Compare BINARY and VARBINARY on unsigned byte values

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.4.0-incubating
    • Component/s: None
    • Labels:
      None

      Description

      I am storing IP address as varbinary and the order by on that column will not yield correct order. Because, it use signed value instead of unsigned value to sort the column.

      Is there anyway I can sort it by unsigned value?

        Activity

        Hide
        jnadeau Jacques Nadeau added a comment -

        Resolved in release 1.4.0-incubating (2015-08-23)

        Show
        jnadeau Jacques Nadeau added a comment - Resolved in release 1.4.0-incubating (2015-08-23)
        Hide
        julianhyde Julian Hyde added a comment -
        Show
        julianhyde Julian Hyde added a comment - Fixed in http://git-wip-us.apache.org/repos/asf/incubator-calcite/commit/26a08774 . Thanks for the patch!
        Hide
        chinwei Low Chin Wei added a comment -

        Added a patch.

        Show
        chinwei Low Chin Wei added a comment - Added a patch.
        Hide
        julianhyde Julian Hyde added a comment -

        Should be straightforward to fix. You'e right - it's just the compare function. Probably ByteString.compareTo. Some code in SqlFunctions.java might need changing too - I'm not sure. You should add a line or two to each of SqlFunctionsTest.testByteString, SqlOperatorBaseTest.testLessThanOperator, testGreaterThanOperator, testBetween, etc.

        Show
        julianhyde Julian Hyde added a comment - Should be straightforward to fix. You'e right - it's just the compare function. Probably ByteString.compareTo. Some code in SqlFunctions.java might need changing too - I'm not sure. You should add a line or two to each of SqlFunctionsTest.testByteString, SqlOperatorBaseTest.testLessThanOperator, testGreaterThanOperator, testBetween, etc.
        Hide
        chinwei Low Chin Wei added a comment -

        Hi Julian,

        Any idea about this issue? I think we just need to fix the compare function of bytes.

        Show
        chinwei Low Chin Wei added a comment - Hi Julian, Any idea about this issue? I think we just need to fix the compare function of bytes.

          People

          • Assignee:
            julianhyde Julian Hyde
            Reporter:
            chinwei Low Chin Wei
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Development