Presto 无法读取十六进制字符串:不是有效的 base-16 数字
Presto fails to read hexadecimal string: Not a valid base-16 number
有没有办法让 presto 检查字符串是否为十六进制?我有以下查询一直失败:
from_base(hexstring, 16)
有错误
> /usr/local/lib/python3.7/dist-packages/pyhive/presto.py in _process_response(self, response)
> 347 self._state = self._STATE_FINISHED
> 348 if 'error' in response_json:
> --> 349 raise DatabaseError(response_json['error'])
> 350
> 351
>
> DatabaseError: {'message': 'Not a valid base-16 number:
> ffffffffffdfae90', 'errorCode': 7, 'errorName':
> 'INVALID_FUNCTION_ARGUMENT', 'errorType': 'USER_ERROR', 'failureInfo':
> {'type': 'io.prestosql.spi.PrestoException', 'message': 'Not a valid
> base-16 number: ffffffffffdfae90', 'cause': {'type':
> 'java.lang.NumberFormatException', 'message': 'For input string:
> "ffffffffffdfae90"', 'suppressed': [], 'stack':
>
但是,python 可以使用字符串:
int('ffffffffffdfae90',16)
returns
18446744073707433616
有没有办法让 presto 检查字符串是否为十六进制?我有以下查询一直失败:
from_base(hexstring, 16)
有错误
> /usr/local/lib/python3.7/dist-packages/pyhive/presto.py in _process_response(self, response)
> 347 self._state = self._STATE_FINISHED
> 348 if 'error' in response_json:
> --> 349 raise DatabaseError(response_json['error'])
> 350
> 351
>
> DatabaseError: {'message': 'Not a valid base-16 number:
> ffffffffffdfae90', 'errorCode': 7, 'errorName':
> 'INVALID_FUNCTION_ARGUMENT', 'errorType': 'USER_ERROR', 'failureInfo':
> {'type': 'io.prestosql.spi.PrestoException', 'message': 'Not a valid
> base-16 number: ffffffffffdfae90', 'cause': {'type':
> 'java.lang.NumberFormatException', 'message': 'For input string:
> "ffffffffffdfae90"', 'suppressed': [], 'stack':
>
但是,python 可以使用字符串:
int('ffffffffffdfae90',16)
returns
18446744073707433616