prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
15.84k stars 5.32k forks source link

After the EQUAL operation is overwritten, Slice and long are used, and the latter bit is EQUAL to 8 bits to report an error #14519

Open qianmoQ opened 4 years ago

qianmoQ commented 4 years ago

Version: 0.221

After the EQUAL operation is overwritten, Slice and long are used, and the latter bit is EQUAL to 8 bits to report an error!

source code

@ScalarOperator(value = EQUAL)
    @SqlType(StandardTypes.BOOLEAN)
    public static boolean equal_string(@SqlType(StandardTypes.VARCHAR) Slice left, @SqlType(StandardTypes.BIGINT) long right) {
        return left.toStringUtf8().equals(String.valueOf(right));
    }

query sql:

select * from push_user_list_sms where ymd=20200511 limit 1

table desc:

Column Type
uid bigint
ymd varchar

ymd is hive Partition the primary key

get errors:

Query failed (#20200513_023554_00007_e7mu7): Object 'Slice{base=[B@d146d99, address=16, length=8}' does not match type long

right length > 8 and right < 8 no problem

mbasmanova commented 4 years ago

@qianmoQ I'm not sure I understand this. Are you seeing an error after modifying the Presto code?