diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Type_Mapping.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Type_Mapping.enso index 64fd06a2808ff..026672cea019d 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Type_Mapping.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Internal/SQLite/SQLite_Type_Mapping.enso @@ -5,6 +5,7 @@ import Standard.Base.Errors.Illegal_State.Illegal_State import Standard.Table.Data.Type.Enso_Types import Standard.Table.Data.Type.Value_Type.Value_Type import Standard.Table.Data.Type.Value_Type.Bits +import Standard.Table.Data.Type.Value_Type_Helpers from Standard.Table.Errors import Inexact_Type_Coercion import project.Data.Column.Column @@ -118,7 +119,11 @@ type SQLite_Type_Mapping Panic.throw (Illegal_State.Error "Impossible: IIF must have 3 arguments. This is a bug in the Database library.") inputs_types = arguments.drop 1 . map find_type if inputs_types.first == inputs_types.second then return inputs_types.first else - infer_default_type + case Value_Type_Helpers.reconcile_types inputs_types.first inputs_types.second of + ## Inference failed, fall back to default type. + Ideally, should never happen. To be handled in #6106. + Value_Type.Mixed -> infer_default_type + common -> return common always_boolean_ops = ["==", "!=", "equals_ignore_case", ">=", "<=", "<", ">", "BETWEEN", "AND", "OR", "NOT", "IS_NULL", "IS_NAN", "IS_EMPTY", "LIKE", "IS_IN", "starts_with", "ends_with", "contains"] always_text_ops = ["ADD_TEXT", "CONCAT", "CONCAT_QUOTE_IF_NEEDED"] diff --git a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso index d82288156d2fa..86ec7e2263b25 100644 --- a/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso +++ b/test/Table_Tests/src/Common_Table_Operations/Column_Operations_Spec.enso @@ -19,7 +19,11 @@ spec setup = t = table_builder [["X", [True, False, Nothing, True]]] t.at "X" . iif 22 33 . to_vector . should_equal [22, 33, Nothing, 22] - Test.specify "iif on Columns" pending="Not implemented yet." Nothing + Test.specify "iif on Columns" <| + t = table_builder [["X", [True, False, Nothing, False]], ["Y", [1, 2, 3, 4]], ["Z", [1.5, 2.5, 3.5, 4.5]]] + c = t.at "X" . iif (t.at "Y") (t.at "Z") + c.value_type . is_floating_point . should_be_true + c.to_vector . should_equal [1, 2.5, Nothing, 4.5] t2 = table_builder [["x", [1, 4, 5, Nothing]], ["y", [2, 3, 5, Nothing]], ["b", [False, False, True, Nothing]]] x = t2.at "x"