Skip to content

Support for hex encoding/decoding for Binary in sql queries #3125

Description

@ozgrakkurt

Hi,

I want to query parquet files by a binary column. I have the scalar value to query by in hex form and I want to run an sql query.

I tried to_hex and postgres style encode but neither seemed to work.

SELECT block_number from log
WHERE log.block_number >= 10000000
	AND log.block_number < 10001000
	AND encode(log.address, 'hex') = '0xced4e93198734ddaff8492d525bd258d49eb388e'

or

SELECT block_number from log
WHERE log.block_number >= 10000000
	AND log.block_number < 10001000
	AND to_hex(log.address) = '0xced4e93198734ddaff8492d525bd258d49eb388e'

I get this error with to_hex:

failed to execute query:\nError during planning: Coercion from [Binary] to the signature Uniform(1, [Int64]) failed.

Would it be possible to implement this? also how can I enter a binary literal so maybe I can run this query now?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions