diff --git a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso index 1c98224e12124..2c228fef34aa9 100644 --- a/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso +++ b/distribution/lib/Standard/Database/0.0.0-dev/src/Data/Table.enso @@ -1159,12 +1159,22 @@ type Table queries = all_tables.map_with_index i-> t-> columns_to_select = good_columns.map description-> column_set = description.first + result_type = description.second column_name = column_set.name case column_set.column_indices.at i of Nothing -> typ = SQL_Type_Reference.from_constant SQL_Type.null expr = SQL_Expression.Literal "NULL" - Internal_Column.Value column_name typ expr + null_column = Internal_Column.Value column_name typ expr + if cast_after_union then null_column else + ## We assume that the type for this + expression will never be queried - it + is just used internally to build the + Union operation and never exposed + externally. + infer_return_type _ = SQL_Type_Reference.null + dialect.make_cast null_column result_type infer_return_type + corresponding_column_index : Integer -> t.at corresponding_column_index . as_internal . rename column_name pairs = columns_to_select.map c-> diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso index f1cf73525b7e0..b24cd47ca8232 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Column.enso @@ -19,7 +19,7 @@ import project.Internal.Widget_Helpers from project.Data.Table import print_table from project.Data.Type.Value_Type import Value_Type, Auto from project.Data.Type.Value_Type_Helpers import type_helpers -from project.Errors import No_Index_Set_Error, Floating_Point_Equality, Invalid_Value_Type +from project.Errors import No_Index_Set_Error, Floating_Point_Equality, Invalid_Value_Type, Inexact_Type_Coercion polyglot java import org.enso.table.data.column.operation.map.MapOperationProblemBuilder polyglot java import org.enso.table.data.column.storage.Storage as Java_Storage @@ -647,7 +647,7 @@ type Column type_helpers.check_argument_type self Value_Type.expect_boolean <| common_type = type_helpers.find_common_type_for_arguments [when_true, when_false] storage_type = Storage.from_value_type common_type Problem_Behavior.Report_Error - storage_type.catch Inexact_Type_Coercion error-> + storage_type.catch Inexact_Type_Coercion _-> Panic.throw (Illegal_State.Error "Common type "+common_type.to_display_text+" is not supported by the Storage. This should never happen and is a bug in the Table library.") storage_type.if_not_error <| diff --git a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Type/Value_Type_Helpers.enso b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Type/Value_Type_Helpers.enso index 95eaa36e76aa2..6e0e70cccf7d9 100644 --- a/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Type/Value_Type_Helpers.enso +++ b/distribution/lib/Standard/Table/0.0.0-dev/src/Data/Type/Value_Type_Helpers.enso @@ -4,7 +4,7 @@ import Standard.Base.Errors.Illegal_Argument.Illegal_Argument import project.Data.Column.Column import project.Data.Type.Enso_Types from project.Data.Type.Value_Type import Value_Type, Auto -from project.Errors import Invalid_Value_Type +from project.Errors import Invalid_Value_Type, No_Common_Type ## PRIVATE Finds a type that can fit both a current type and a new type. diff --git a/std-bits/table/src/main/java/org/enso/table/data/column/storage/DoubleStorage.java b/std-bits/table/src/main/java/org/enso/table/data/column/storage/DoubleStorage.java index a2032453c5a53..abeb15dc7e691 100644 --- a/std-bits/table/src/main/java/org/enso/table/data/column/storage/DoubleStorage.java +++ b/std-bits/table/src/main/java/org/enso/table/data/column/storage/DoubleStorage.java @@ -40,7 +40,7 @@ public DoubleStorage(long[] data, int size, BitSet isMissing) { public static DoubleStorage makeEmpty(int size) { BitSet isMissing = new BitSet(size); isMissing.set(0, size); - return new DoubleStorage(new long[0], size, new BitSet(size)); + return new DoubleStorage(new long[0], size, isMissing); } /** @inheritDoc */