You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@drill.apache.org by Prabhakar Bhosale <bh...@gmail.com> on 2023/09/06 07:23:32 UTC

column with default value not working for parquet files

Hi Team,
I am trying to add a column with default into a parquet file by way of
defining a schema for the folder after enabling the metostore. I used the
following query to provide a schema. but the new column always returns null
value instead of giving default value. I am using drill 1.21.1

ANALYZE TABLE   table(dfs.tmp.`TESTCUST_1`
(type=>'parquet',schema=>'inline=(`TRANID`
VARCHAR,
    `CUST_ID` VARCHAR,
    `ACTID` VARCHAR,
    `TRANAMT` FLOAT NOT NULL properties {`DEFAULT` = `1.77`})')) REFRESH
METADATA;

REgards
Prabhakar

Re: column with default value not working for parquet files

Posted by James Turton <ja...@somecomputer.xyz.INVALID>.
I don't think this feature is actually supported for Parquet files. How 
about defining a SQL view that includes a COALESCE(TRANAMT, 1.77) column 
expression?

On 2023/09/06 09:23, Prabhakar Bhosale wrote:
> Hi Team,
> I am trying to add a column with default into a parquet file by way of
> defining a schema for the folder after enabling the metostore. I used the
> following query to provide a schema. but the new column always returns null
> value instead of giving default value. I am using drill 1.21.1
>
> ANALYZE TABLE   table(dfs.tmp.`TESTCUST_1`
> (type=>'parquet',schema=>'inline=(`TRANID`
> VARCHAR,
>      `CUST_ID` VARCHAR,
>      `ACTID` VARCHAR,
>      `TRANAMT` FLOAT NOT NULL properties {`DEFAULT` = `1.77`})')) REFRESH
> METADATA;
>
> REgards
> Prabhakar
>