Hey Jason, 
Thanks for sharing this.  Would you consider creating a pull request with these 
changes?
Thanks!
-- C

> On Nov 30, 2021, at 12:35 PM, Jason Gauci <jgmath2...@gmail.com> wrote:
> 
> Hi Drill dev!
> 
> I was using drill to analyze data in some parquet files, and ran into
> trouble with columns containing unsigned integers.  Doing a "select
> distinct" or a "group by" or even a cast was failing with an unsupported
> operation error.
> 
> Adding casts for unsigned integers allowed me to cast the columns and then
> group by them.  I don't know if this is the ideal solution, but here is a
> patch that worked for me.  After this change, I was able to work with those
> columns.
> 
> diff --git a/exec/java-exec/src/main/codegen/data/Casts.tdd
> b/exec/java-exec/src/main/codegen/data/Casts.tdd
> index f9ccbf817..29ff4dabb 100644
> --- a/exec/java-exec/src/main/codegen/data/Casts.tdd
> +++ b/exec/java-exec/src/main/codegen/data/Casts.tdd
> @@ -19,11 +19,26 @@
> {
>   types: [
>     {from: "Int", to: "BigInt", major: "Fixed"},
> +    {from: "UInt1", to: "BigInt", explicit: "long", major: "Fixed"},
> +    {from: "UInt2", to: "BigInt", explicit: "long", major: "Fixed"},
> +    {from: "UInt4", to: "BigInt", explicit: "long", major: "Fixed"},
> +    {from: "UInt8", to: "BigInt", explicit: "long", major: "Fixed"},
> +
>     {from: "Float4", to: "Float8", major: "Fixed" },
>     {from: "Int", to: "Float4", major: "Fixed" },
>     {from: "BigInt", to: "Float4", major: "Fixed" },
> +    {from: "UInt1", to: "Float4", major: "Fixed"},
> +    {from: "UInt2", to: "Float4", major: "Fixed"},
> +    {from: "UInt4", to: "Float4", major: "Fixed"},
> +    {from: "UInt8", to: "Float4", major: "Fixed"},
> +
>     {from: "Int", to: "Float8", major: "Fixed" },
>     {from: "BigInt", to: "Float8", major: "Fixed" },
> +    {from: "UInt1", to: "Float8", major: "Fixed"},
> +    {from: "UInt2", to: "Float8", major: "Fixed"},
> +    {from: "UInt4", to: "Float8", major: "Fixed"},
> +    {from: "UInt8", to: "Float8", major: "Fixed"},
> +
>     {to: "Int", from: "BigInt", explicit: "int", major: "Fixed"},
>     {to: "Float4", from: "Float8" , explicit: "float", major: "Fixed"},
>     {to: "Int", from: "Float4" , explicit: "int", native: "float", major:
> "Fixed"},
> (END)

Reply via email to