Jai Patel
06/15/2021, 8:41 PM{
"name": "created_at_1_week_seconds",
"dataType": "LONG",
"defaultNullValue": 0,
"transformFunction": "dateTrunc('week', created_at, 'MILLISECONDS')",
"format": "1:SECONDS:EPOCH",
"granularity": "1:SECONDS"
},
Error:
Exception in getting arguments for transform function 'dateTrunc('week', created_at, MILLISECONDS)' for column 'created_at_1_week_seconds'"
}
This works:
{
"name": "created_at_1_day_seconds",
"dataType": "LONG",
"defaultNullValue": 0,
"transformFunction": "toEpochSecondsRounded(fromEpochDaysBucket(toEpochDaysBucket(created_at, 1), 1), 1)",
"format": "1:SECONDS:EPOCH",
"granularity": "1:SECONDS"
},
Something about the dateTrunc function doesn’t seem to be compatible. Looking through the docs and the code it looks like dateTrunc may not be listed as a valid transform function in all use cases. The main issue is I want a toEpochDaysBucket(7) that lines up with the calendar week (Sunday or Monday) instead of the epoch week (Thursday).
Any ideas?Xiang Fu
BaseTransformFunction
function not ScalarFunction
function which can be used in the transformFunction
field.Jai Patel
06/15/2021, 8:52 PMXiang Fu
/**
* The sql compatible date_trunc function for epoch time.
* @param unit truncate to unit (millisecond, second, minute, hour, day, week, month, quarter, year)
* @param timeValue value to truncate
* @param inputTimeUnitStr TimeUnit of value, expressed in Java's joda TimeUnit
* @return truncated timeValue in same TimeUnit as the input
*/
@ScalarFunction
public static long dateTrunc(String unit, long timeValue, String inputTimeUnitStr) {
return dateTrunc(unit, timeValue, inputTimeUnitStr, TimeZoneKey.UTC_KEY.getId(), inputTimeUnitStr);
}
dateTrunc(week, created_at, MILLISECONDS)
work?Jai Patel
06/15/2021, 9:14 PMXiang Fu
kubectl logs pinot-server-0
should tellElon
06/16/2021, 3:29 PMJai Patel
06/16/2021, 4:22 PMElon
06/16/2021, 4:24 PMJai Patel
06/16/2021, 4:39 PMXiang Fu
Jai Patel
06/16/2021, 9:17 PMXiang Fu
Elon
06/16/2021, 9:19 PMXiang Fu
Elon
06/16/2021, 9:19 PMXiang Fu
Elon
06/16/2021, 9:19 PMXiang Fu
Jai Patel
06/16/2021, 9:23 PMElon
06/16/2021, 10:14 PMJai Patel
06/16/2021, 10:14 PMElon
06/16/2021, 10:15 PMJai Patel
06/17/2021, 12:03 AM