Lucene - Core
  1. Lucene - Core
  2. LUCENE-3738

Be consistent about negative vInt/vLong

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6, 4.0-ALPHA
    • Component/s: None
    • Labels:
      None
    • Lucene Fields:
      New

      Description

      Today, write/readVInt "allows" a negative int, in that it will encode and decode correctly, just horribly inefficiently (5 bytes).

      However, read/writeVLong fails (trips an assert).

      I'd prefer that both vInt/vLong trip an assert if you ever try to write a negative number... it's badly trappy today. But, unfortunately, we sometimes rely on this... had we had this assert in 'since the beginning' we could have avoided that.

      So, if we can't add that assert in today, I think we should at least fix readVLong to handle negative longs... but then you quietly spend 9 bytes (even more trappy!).

      1. LUCENE-3738.patch
        0.6 kB
        Uwe Schindler
      2. LUCENE-3738.patch
        1 kB
        Uwe Schindler
      3. LUCENE-3738.patch
        1 kB
        Michael McCandless
      4. LUCENE-3738.patch
        11 kB
        Uwe Schindler
      5. LUCENE-3738.patch
        14 kB
        Uwe Schindler
      6. ByteArrayDataInput.java.patch
        4 kB
        Uwe Schindler
      7. LUCENE-3738-improvement.patch
        7 kB
        Uwe Schindler

        Issue Links

          Activity

          Uwe Schindler made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Robert Muir made changes -
          Link This issue is related to LUCENE-4641 [ LUCENE-4641 ]
          Uwe Schindler made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Uwe Schindler made changes -
          Priority Major [ 3 ] Blocker [ 1 ]
          Uwe Schindler made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Uwe Schindler made changes -
          Attachment LUCENE-3738.patch [ 12520629 ]
          Uwe Schindler made changes -
          Attachment LUCENE-3738-improvement.patch [ 12520780 ]
          Michael McCandless made changes -
          Attachment LUCENE-3738.patch [ 12520629 ]
          Uwe Schindler made changes -
          Attachment ByteArrayDataInput.java.patch [ 12520155 ]
          Uwe Schindler made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Uwe Schindler made changes -
          Attachment LUCENE-3738.patch [ 12518858 ]
          Uwe Schindler made changes -
          Attachment LUCENE-3738.patch [ 12518846 ]
          Uwe Schindler made changes -
          Assignee Uwe Schindler [ thetaphi ]
          Michael McCandless made changes -
          Attachment LUCENE-3738.patch [ 12518689 ]
          Uwe Schindler made changes -
          Attachment LUCENE-3738.patch [ 12512573 ]
          Uwe Schindler made changes -
          Field Original Value New Value
          Attachment LUCENE-3738.patch [ 12512570 ]
          Michael McCandless created issue -

            People

            • Assignee:
              Uwe Schindler
              Reporter:
              Michael McCandless
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development