h2o.ifelse in R converts enum to int when no rows match condition

Description

This works fine, and 'a' remains an enum column:

df = as.h2o(data.frame(a = c("a", "b", "c")))

h2o.getTypes(df) # enum

df$a <- h2o.ifelse(df$a == "c", "d", df$a)

h2o.getTypes(df) # enum

Either of the following cases, in which the condition statement returns all FALSE, 'a' gets converted from enum to int. The same occurs when the %in% operator returns all FALSE.

df = as.h2o(data.frame(a = c("a", "b", NA)))

h2o.getTypes(df) # enum

df$a <- h2o.ifelse(df$a == "c", "d", df$a)

h2o.getTypes(df) # int

df = as.h2o(data.frame(a = c("a", "b", "d")))

h2o.getTypes(df) # enum

df$a <- h2o.ifelse(df$a == "c", "d", df$a)

h2o.getTypes(df) # int

Status

Assignee

New H2O Bugs

Fix versions

None

Reporter

Elliot

Support ticket URL

None

Labels

Affected Spark version

None

Customer Request Type

None

Task progress

None

CustomerVisible

Yes

Epic Link

Components

Affects versions

Priority

Major
Configure