Aparna Razdan
04/06/2022, 11:28 AM{
"name": "sql_date_entered",
"dataType": "INT",
"format": "1:DAYS:EPOCH",
"granularity": "1:DAYS"
},
{
"name": "sql_date_entered_str",
"dataType": "STRING",
"format": "1:DAYS:SIMPLE_DATE_FORMAT:yyyy-MM-dd",
"granularity": "1:DAYS"
}
Other way to handle is using query transformations:
select sql_date_entered ,
DATETIMECONVERT(dateTrunc('week' , sql_date_entered, 'DAYS'), '1:DAYS:EPOCH', '1:DAYS:SIMPLE_DATE_FORMAT:yyyy-MM-dd', '1:DAYS') as week
from
kepler_product_pipegen
Is there any way that I can load the date in ( ‘YYYY-mm-dd’) format and still run the transformation like dateTrunc on the top of it ?
Pinot version = 0.7.1Rong R
04/06/2022, 5:56 PMtimestamp
dateType instead of STRING?Aparna Razdan
04/07/2022, 5:02 AMNeha Pawar
sql_date_entered_str
as yyyy-MM-dd
, is that not loading the way you want? can you share the transformConfigs in your table configs?Neha Pawar
yyyy-MM-dd
and want to use dateTrunc on it but cannot?Aparna Razdan
04/07/2022, 5:22 AMAparna Razdan
04/07/2022, 5:26 AMNeha Pawar
sql_date_entered
is in format yyyy-MM-dd
. But in the Pinot schema, sql_date_entered
is defined as 1:DAYS:EPOCH
. So i think the first correction would be to chage Pinot schema to
{
"name": "sql_date_entered_epoch_ms",
"dataType": "LONG",
"format": "1:MILLISECONDS:EPOCH",
"granularity": "1:DAYS"
},
{
"name": "sql_date_entered",
"dataType": "STRING",
"format": "1:DAYS:SIMPLE_DATE_FORMAT:yyyy-MM-dd",
"granularity": "1:DAYS"
}
and add transform function in table config to go with it
"columnName":"sql_date_entered_epoch_ms","transformFunction":"fromDateTime(sql_date_entered, 'yyyy-MM-dd')"
Aparna Razdan
04/07/2022, 5:33 AMNeha Pawar
sql_date_entered_epoch_ms
as dateTrunc('week', sql_date_entered_epoch_ms)
Aparna Razdan
04/07/2022, 11:52 AMAparna Razdan
04/07/2022, 1:38 PMNeha Pawar
Aparna Razdan
04/08/2022, 2:17 AMNeha Pawar
sql_date_entered
column as a dimension, and turns out is is indeed in EPOCH days format in the original source data. Not sure if presto does something under the hood to show it in yyyy-MM-dd format. But in the parquet file it is in EPOCH DAYS.Neha Pawar
select toDateTime(fromEpochDays(datetrunc('week', sql_date_entered, 'DAYS')), 'yyyy-MM-dd') from kepler_product_pipegen limit 10
Neha Pawar