2

We are trying to create a kudu table that should contain a column holding the timestamp when the records are getting inserted.

We tried the below :

create table clcs.table_a (
         store_nbr string, 
         load_dttm timestamp default now(), 
         primary key ( store_nbr)
)

But the load_dttm timestamp is always the time when the table got created and NOT the time when records are getting inserted.

Any directions would be highly appreciated. Thanks in advance!

tk421
  • 5,775
  • 6
  • 23
  • 34
srikanth ramesh
  • 131
  • 1
  • 11

1 Answers1

0

You are thinking of Kudu as a database, which it is not. It is a storage layer. Drop the default from your Kudu DDL and instead use whatever function call is available in your SQL language processor that is performing the insert, such as now(), current_timestamp(), or CURRENT_TIMESTMAP (Impala, Impala, and Hive, respectively). Take note of whether the function call is deterministic (repeatable for the lifetime of the INSERT transaction) or not, depending on what time you want to record, the row or set of rows insert.

Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80