Slackbot
09/11/2023, 6:21 AMBibek Sahoo
09/11/2023, 8:55 AMdruid.generic.useDefaultValueForNull
actually does that.
If a value cannot be cast to the target type, as in CAST('foo' AS BIGINT), Druid either substitutes a default value (when druid.generic.useDefaultValueForNull = true, the default mode), or substitutes NULL (when druid.generic.useDefaultValueForNull = false). NULL values cast to non-nullable types are also substituted with a default value. For example, if druid.generic.useDefaultValueForNull = true, a null VARCHAR cast to BIGINT is converted to a zero.anoop kumar
09/11/2023, 10:13 AMBibek Sahoo
09/11/2023, 10:21 AMJohn Kowtko
09/11/2023, 10:47 AMREPLACE INTO wikipedia_hr
OVERWRITE where __time >= TIMESTAMP '2016-06-27 00:00:00' and __time < TIMESTAMP '2016-06-27 01:00:00.000'
SELECT
__time,
"isRobot",
"channel",
"flags",
"page",
"diffUrl",
"added",
"comment",
"commentLength",
"isNew",
"isMinor",
case when delta = 0 then null else delta end as delta,
"user",
"deltaBucket",
"deleted",
"namespace"
FROM "wikipedia_hr"
where __time BETWEEN '2016-06-27T00:00:00.000Z' and '2016-06-27T01:00:00.000Z'
PARTITIONED BY HOUR
CLUSTERED BY "channel", "page"anoop kumar
09/11/2023, 11:11 AMBenjamin Hopp
09/11/2023, 4:11 PMNULLIF(delta,0) is another way to write this case statement.John Kowtko
09/11/2023, 10:35 PMcase when <some filter condition that identifies one or more rows that you want to update> then new_value else field_name end as field_name