Skip to main content
Guarupe
Gold ⭐️
Jul 1, 2021 4:57 PM UTC
Solved

Add new Columns in Kudu Tables from Impala

Hi Folks,
After adding new columns in Kudu tables from impala, I had some issues computing stats for this table. Everything works fine until the Compute Stats command;

The alter table command 

 

ALTER TABLE myschema.mytable ADD COLUMNS (mycolumn TIMESTAMP DEFAULT now());

 

 

The issue when Compute Stats command.

 

ImpalaRuntimeException: Error making 'updateTableColumnStatistics' RPC to Hive Metastore: CAUSED BY: MetaException: Column mycolumn doesn't exist in table mytable in database myschema

 

 

Someone can help me, please?

Guarupe
GuarupeAnswer
Gold ⭐️
Mar 29, 2022 7:17 PM UTC

Hi @Shelton, sorry for the delay in responding.
I finally found the solution to my problem. I need to specify the column properties and then Compute Stats will work perfectly.
```sql
ALTER TABLE myschema.mytable
ADD COLUMNS (mycolumn1 TIMESTAMP NULL COMPRESSION DEFAULT_COMPRESSION,
mycolumn2 TIMESTAMP NULL COMPRESSION DEFAULT_COMPRESSION);
```

5 replies

Shelton
Gold ⭐️⭐️⭐️
Jul 4, 2021 11:07 AM UTC

@Guarupe 
I responded to a similar question Warm up Impala
You will need to run the  INVALIDATE METADATA [[db_name.]table_name]
The error is precise Impala uses the Hive Metastore  [HMS] to build efficient queries

 

 

CAUSED BY: MetaException: Column mycolumn doesn't exist in table mytable in database myschema

 

 

In your case INVALIDATE METADATA [[myschema.]mytable] 
The INVALIDATE METADATA is an asynchronous operation that simply discards the loaded metadata from the catalog and coordinator caches. After that operation, the catalog and all the Impala coordinators only know about the existence of databases and tables and nothing more. Metadata loading for tables is triggered by any subsequent queries.

 

After running this in the impala-shell you should compute statistics successfully

Happy hadooping

Translate
Guarupe
GuarupeAuthor
Gold ⭐️
Jul 5, 2021 12:08 PM UTC

Hi Shelton,
Thanks for your reply, but INVALIDATE METADATA didn't work for me. I still have the same error. My option was to recreate the table with a CREATE TABLE as SELECT from the previous table.
Thanks again

Translate
Shelton
Gold ⭐️⭐️⭐️
Jul 5, 2021 1:08 PM UTC

@Guarupe 
Can you share your steps, please? Are you suing HUE to run your cmds? Did you use the Impala editor?

Translate
Guarupe
GuarupeAuthorAnswer
Gold ⭐️
Mar 29, 2022 7:17 PM UTC

Hi @Shelton, sorry for the delay in responding.
I finally found the solution to my problem. I need to specify the column properties and then Compute Stats will work perfectly.
```sql
ALTER TABLE myschema.mytable
ADD COLUMNS (mycolumn1 TIMESTAMP NULL COMPRESSION DEFAULT_COMPRESSION,
mycolumn2 TIMESTAMP NULL COMPRESSION DEFAULT_COMPRESSION);
```

Translate