milvus-io / milvus-sdk-java

Java SDK for Milvus.
https://milvus.io
Apache License 2.0
361 stars 149 forks source link

使用milvus java sdk的QueryIterator出现报错:id > \Q123456\, error: line 1:12 token recognition error at: '\' #964

Open feriki opened 6 days ago

feriki commented 6 days ago

看起来是io.milvus.orm.iterator.QueryIterator#setupNextExpr方法导致的,使用的milvus-sdk-java版本是2.3.6,如图 21

xiaofan-luan commented 4 days ago

I thought we can not just append something to string. @MrPresent-Han please help on it

xiaofan-luan commented 4 days ago
public static byte[] incrementBytes(byte[] value) {
    if (value == null || value.length == 0) {
        throw new IllegalArgumentException("Input byte array cannot be null or empty");
    }

    byte[] newValue = value.clone();
    boolean carry = true;
    int index = newValue.length - 1;

    while (carry && index >= 0) {
        if (newValue[index] == (byte) 0xFF) {
            newValue[index] = 0;
            index--;
        } else {
            newValue[index]++;
            carry = false;
        }
    }

    // If carry is still true, this means we have overflowed beyond the most significant byte
    if (carry) {
        byte[] extendedValue = new byte[newValue.length + 1];
        System.arraycopy(newValue, 0, extendedValue, 1, newValue.length);
        extendedValue[0] = 1; // Add a new leading byte
        return extendedValue;
    }

    return newValue;
}