The Altair Community and the RapidMiner community is on read-only mode until further notice. Technical support via cases will continue to work as is. For any urgent requests from Students/Faculty members, please submit the form linked here.
Options
Equivalent of MySQL "COALESCE"?
Hi Community
I'm wondering if in rapidminer's formulas there is an equivalent of the command "coalesce" in mysql? Thats is a command which, given a list of parameters, returns the first non-null.
Example:
DataFromSource1 = null
DataFromSource2 = "foo"
coalesce(DataFromSource1, DatafromSource2, "default") would give "foo".
TIA
greg
I'm wondering if in rapidminer's formulas there is an equivalent of the command "coalesce" in mysql? Thats is a command which, given a list of parameters, returns the first non-null.
Example:
DataFromSource1 = null
DataFromSource2 = "foo"
coalesce(DataFromSource1, DatafromSource2, "default") would give "foo".
TIA
greg
1
Answers
You can still use this function in SQL scripts, and insert SQL codes into RapidMiner for in-database SQL execution. (need “Read Database” or “Execute SQL” operators)
In rapidminer you can combine several operators for the same operation. For example, “Filter Examples” to remove the missing values (NULL), and then “Filter Example Range” to pick the 1st element.
I am attaching the example process here. Let me know if you have further questions.![Filter Missing Values (Null).png Filter Missing Values (Null).png](https://us.v-cdn.net/6030995/uploads/s3://uploads/lithium_attachments/image/serverpage/image-id/1384i1796B7C51D29D8EC/filter_missing_values_(null).png)
Example with the Labor-Negotiations dataset and Generate Attributes:
if(missing([wage-inc-2nd]), -1, [wage-inc-2nd])
Or even:
if(missing([wage-inc-2nd]),
if(missing([wage-inc-3rd]), -2,
[wage-inc-3rd]),
[wage-inc-2nd])
Not as clean as coalesce() but not bad either.
Regards,
Balázs