Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce Value_Type.Null, fix edge cases for read_many #11737

Open
wants to merge 44 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
44 commits
Select commit Hold shift + click to select a range
e993a0f
Adding Value Type Null logic
radeusgd Nov 19, 2024
6927176
fixes
radeusgd Nov 19, 2024
b2b606e
wip
radeusgd Nov 20, 2024
f647799
forgot to commit file
radeusgd Nov 21, 2024
9c72ebb
NullStorag
radeusgd Nov 29, 2024
fc63d39
WIP integrating NullStorage
radeusgd Nov 29, 2024
bc43d3d
fixing edge cases with Null type
radeusgd Nov 29, 2024
55dfc54
updating tests
radeusgd Nov 29, 2024
b1b8209
can cast Null to anything
radeusgd Nov 29, 2024
df1db00
union with null should be possible for every type
radeusgd Nov 29, 2024
6100b86
updating tests, check that Null is accepted in Data.read_many
radeusgd Nov 29, 2024
f268d1b
allow null col
radeusgd Nov 29, 2024
98a5aa8
typo
radeusgd Nov 29, 2024
d8068b9
postgres
radeusgd Nov 29, 2024
95e4c73
re enable some union tests
radeusgd Nov 29, 2024
539a8fd
re enable some agg tests
radeusgd Nov 29, 2024
bebe7f2
fix a tset
radeusgd Dec 2, 2024
ce8bcda
fix a typo - else in wrong place...
radeusgd Dec 2, 2024
b4cde03
fmt
radeusgd Dec 2, 2024
6d016f0
fix parser - empty column gets Null type
radeusgd Dec 2, 2024
a1d1774
WIP read many edge cases
radeusgd Dec 2, 2024
643e324
update spec of null ops?
radeusgd Dec 2, 2024
536068f
update some tests
radeusgd Dec 2, 2024
f8be248
from_repeated_item test
radeusgd Dec 3, 2024
12ad747
Null type for null column from repeated
radeusgd Dec 3, 2024
11b8bbf
add test for Null column edge cases
radeusgd Dec 3, 2024
af34a4b
not
radeusgd Dec 3, 2024
a4b901e
reconciling Null types in various operations
radeusgd Dec 3, 2024
8cbed1b
implement stub ops for NullStorage so that operations on Null columns…
radeusgd Dec 3, 2024
724ca47
fixing tests
radeusgd Dec 3, 2024
7b6ce9f
type mappings for Postgres & SQLServer
radeusgd Dec 3, 2024
ddea3e4
test a few more edge cases
radeusgd Dec 3, 2024
dfe300b
comment, a few more tests
radeusgd Dec 3, 2024
9039bbd
CR
radeusgd Dec 4, 2024
351b068
cannot create NULL columns in DBs
radeusgd Dec 4, 2024
71b509c
disable tests, TODO https://github.com/enso-org/enso/issues/11757
radeusgd Dec 4, 2024
2fe9906
better message
radeusgd Dec 4, 2024
cbe47f7
more tests for https://github.com/enso-org/enso/issues/11757
radeusgd Dec 4, 2024
2d0659c
yet another one for https://github.com/enso-org/enso/issues/11757
radeusgd Dec 4, 2024
2e49995
update error to one with more info
radeusgd Dec 4, 2024
2b94b24
update test
radeusgd Dec 4, 2024
fad1179
make custom aggregates work with Null input
radeusgd Dec 19, 2024
7499758
Merge branch 'develop' into wip/radeusgd/6281-value-type-null
radeusgd Dec 19, 2024
e9fbef0
Merge branch 'develop' into wip/radeusgd/6281-value-type-null
radeusgd Dec 27, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Data.enso
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ import project.Data.Read.Many_Files_List.Many_Files_List
import project.Data.Read.Return_As.Return_As
import project.Data.Text.Encoding.Encoding
import project.Data.Text.Text
import project.Data.Vector.No_Wrap
import project.Data.Vector.Vector
import project.Enso_Cloud.Data_Link.Data_Link
import project.Enso_Cloud.Data_Link_Helpers
import project.Error.Error
import project.Errors.Common.Failed_To_Load
import project.Errors.Common.Missing_Argument
import project.Errors.File_Error.File_Error
import project.Errors.Illegal_Argument.Illegal_Argument
Expand Down Expand Up @@ -144,9 +146,11 @@ read path=(Missing_Argument.throw "path") format=Auto_Detect (on_problems : Prob
read_many : Many_Files_List -> File_Format -> Return_As -> Problem_Behavior -> Any ! File_Error
read_many (paths : Many_Files_List = Missing_Argument.throw "paths") format=Auto_Detect return=..As_Merged_Table (on_problems : Problem_Behavior = ..Report_Warning) =
return_as = Return_As.resolve return
loaded_objects = paths.paths_to_load.map on_problems=on_problems path->
Data.read path format on_problems
return_as.make_return paths loaded_objects on_problems
if paths.paths_to_load.contains Nothing then Error.throw (Illegal_Argument.Error "The list of paths to load should not contain Nothing. Use `filter` with `..Not_Nothing` to filter out missing entries before calling `read_many`.") else
loaded_objects = paths.paths_to_load.map on_problems=No_Wrap.Value path->
Data.read path format on_problems . catch Any error->
Failed_To_Load.Warning path error
return_as.make_return paths loaded_objects on_problems

## ALIAS load text, open text
GROUP Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ import project.Data.Vector.Vector
used in `Data.read_many`.
type Many_Files_List
## PRIVATE
Arguments:
- original_value: The original value that represents a list of files.
Some return modes may use it as it contains more information than just
list of files (e.g. it can be a source table).
- paths_to_load: A vector of paths to load. This is the fallback that can
be used by any return mode if it does not recognize the original value.
The vector is expected to contain values that can be passed into
`Data.read` (so it can be Text, File, URI or any other kind of file -
e.g. S3_File).
Value original_value paths_to_load:Vector

## PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ import project.Data.Read.Many_Files_List.Many_Files_List
import project.Data.Text.Text
import project.Data.Vector.Vector
import project.Error.Error
import project.Errors.Common.Failed_To_Load
import project.Errors.Common.Type_Error
import project.Errors.Illegal_Argument.Illegal_Argument
import project.Errors.Problem_Behavior.Problem_Behavior
import project.Function.Function
import project.Meta
import project.Metadata.Display
import project.Metadata.Widget
import project.Nothing.Nothing
Expand All @@ -33,7 +35,7 @@ type Return_As
to_display_text self -> Text = self.underlying.to_display_text

## PRIVATE
make_return self (input : Many_Files_List) (objects : Vector Any) (on_problems : Problem_Behavior) =
make_return self (input : Many_Files_List) (objects : Vector (Any | Failed_To_Load)) (on_problems : Problem_Behavior) =
self.underlying.make_return input objects on_problems

## PRIVATE
Expand Down Expand Up @@ -77,9 +79,17 @@ type Return_As_Base
Panic.catch Type_Error (value:Return_As_Base) _->Nothing

## PRIVATE
make_return self (input : Many_Files_List) (objects : Vector Any) (on_problems : Problem_Behavior) =
_ = [input, on_problems]
objects
make_return self (input : Many_Files_List) (objects : Vector (Any | Failed_To_Load)) (on_problems : Problem_Behavior) =
_ = input
replace_with_nothing_and_propagate objects on_problems

## PRIVATE
A helper method that takes a Vector and replaces `Failed_To_Load` with `Nothing`, raising them as warnings.
replace_with_nothing_and_propagate (vector : Vector (Any | Failed_To_Load)) (on_problems : Problem_Behavior) =
failed = vector.filter o-> o.is_a Failed_To_Load
if failed.is_empty then vector else
on_problems.attach_problems_before failed <|
vector.map o-> if o.is_a Failed_To_Load then Nothing else o

## PRIVATE
Return_As.from (that : Return_As_Base) =
Expand Down
10 changes: 10 additions & 0 deletions distribution/lib/Standard/Base/0.0.0-dev/src/Errors/Common.enso
Original file line number Diff line number Diff line change
Expand Up @@ -607,3 +607,13 @@ type Floating_Point_Equality
"(Error (location = "+location+"))"
Floating_Point_Equality.Used_As_Dictionary_Key value ->
"(Used_As_Dictionary_Key (value = "+value.to_text+"))"

## A warning indicating that a file failed to be loaded.
type Failed_To_Load
## PRIVATE
Warning path cause

## PRIVATE
Create a human-readable version of the error.
to_display_text : Text
to_display_text self = "Failed to load file at path: "+self.path.to_display_text+": "+self.cause.to_display_text
Original file line number Diff line number Diff line change
Expand Up @@ -595,12 +595,13 @@ type DB_Column
cause a hard error, the value may be truncated or wrap-around etc.
+ : DB_Column | Any -> DB_Column
+ self other =
op = case Value_Type_Helpers.resolve_addition_kind self other of
Value_Type_Helpers.Addition_Kind.Numeric_Add -> "ADD_NUMBER"
Value_Type_Helpers.Addition_Kind.Text_Concat -> "ADD_TEXT"
op.if_not_error <|
new_name = self.naming_helper.binary_operation_name "+" self other
self.make_binary_op op other new_name
new_name = self.naming_helper.binary_operation_name "+" self other
case Value_Type_Helpers.resolve_addition_kind self other of
Value_Type_Helpers.Addition_Kind.Numeric_Add ->
self.make_binary_op "ADD_NUMBER" other new_name
Value_Type_Helpers.Addition_Kind.Text_Concat ->
self.make_binary_op "ADD_TEXT" other new_name
Nothing -> self.const Nothing

## ALIAS minus, subtract, time difference
GROUP Standard.Base.Operators
Expand Down Expand Up @@ -630,6 +631,7 @@ type DB_Column
self.make_binary_op "-" other
Value_Type_Helpers.Subtraction_Kind.Date_Time_Difference ->
Error.throw (Unsupported_Database_Operation.Error "Subtracting date/time value")
Nothing -> self.const Nothing

## ALIAS multiply, product, times
GROUP Standard.Base.Operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,8 @@ type Postgres_Type_Mapping
but we may also consider using the standard SQL `bit(n)` and `bit varying(n)` types.
See: https://www.postgresql.org/docs/current/datatype-bit.html
SQL_Type.Value Types.BINARY "bytea" precision=max_precision
Value_Type.Null ->
Error.throw (Unsupported_Database_Type.Error "Null" "Postgres")
Value_Type.Mixed ->
Error.throw (Unsupported_Database_Type.Error "Mixed" "Postgres")
Value_Type.Unsupported_Data_Type type_name underlying_type ->
Expand Down Expand Up @@ -146,7 +148,7 @@ type Postgres_Type_Mapping
simple_types_map = Dictionary.from_vector <|
ints = [[Types.SMALLINT, Value_Type.Integer Bits.Bits_16], [Types.BIGINT, Value_Type.Integer Bits.Bits_64], [Types.INTEGER, Value_Type.Integer Bits.Bits_32]]
floats = [[Types.DOUBLE, Value_Type.Float Bits.Bits_64], [Types.REAL, Value_Type.Float Bits.Bits_32]]
other = [[Types.DATE, Value_Type.Date], [Types.TIME, Value_Type.Time]]
other = [[Types.DATE, Value_Type.Date], [Types.TIME, Value_Type.Time], [Types.NULL, Value_Type.Null]]
ints + floats + other

## PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,14 +192,12 @@ type SQLite_Dialect
adapt_unified_column : Internal_Column -> Value_Type -> (SQL_Expression -> SQL_Type_Reference) -> Internal_Column
adapt_unified_column self column approximate_result_type infer_result_type_from_database_callback =
_ = infer_result_type_from_database_callback
# TODO [RW] This may be revisited with #6281.
case approximate_result_type of
Nothing -> column
_ ->
sql_type = self.get_type_mapping.value_type_to_sql approximate_result_type Problem_Behavior.Ignore
new_expression = self.make_cast_expression column sql_type
new_sql_type_reference = SQL_Type_Reference.from_constant sql_type
Internal_Column.Value column.name new_sql_type_reference new_expression
needs_cast = approximate_result_type != Value_Type.Null
if needs_cast.not then column else
sql_type = self.get_type_mapping.value_type_to_sql approximate_result_type Problem_Behavior.Ignore
new_expression = self.make_cast_expression column sql_type
new_sql_type_reference = SQL_Type_Reference.from_constant sql_type
Internal_Column.Value column.name new_sql_type_reference new_expression

## PRIVATE
Add an extra cast to adjust the output type of certain operations with
Expand Down Expand Up @@ -636,6 +634,9 @@ make_custom_cast column target_value_type type_mapping =
result = Ref.new Nothing
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I find this logic hard to follow. The return value would be either Nothing or the return value of result.put expr -- but isn't the the return value of Ref.put the old value?

Copy link
Member Author

@radeusgd radeusgd Dec 4, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The return value of put is discarded.

The function returns ref.get at the very end.

I agree it is not ideal. This is a hack to get multiline if without adding a ton of indentation to the else branches. There's just too many branches here (and while sometimes too many branches is bad, here it is just intrinsic to this function) to make it readable.

Once we get multiline if (#6408) I will be more than happy to replace this with just:

if cond1 then
    ...
else if cond2 then
    ...
else
    Nothing

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you think I should rewrite it with increasing indentation?

I'd rather keep it as is as IMO it is readable once the reasons are explained.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, it makes more sense now.

column_type =
type_mapping.sql_type_to_value_type column.sql_type_reference.get
if target_value_type == Value_Type.Null then
result.put column.expression

if target_value_type.is_text && (column_type == Value_Type.Boolean) then
expr = SQL_Expression.Operation "IIF" [column.expression, SQL_Expression.Literal "'true'", SQL_Expression.Literal "'false'"]
result.put expr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ type SQLite_Type_Mapping
Value_Type.Date -> unsupported_date_time
Value_Type.Date_Time _ -> unsupported_date_time
Value_Type.Binary _ _ -> SQLite_Types.blob
Value_Type.Null -> SQLite_Types.null
Value_Type.Mixed ->
## The best we could do would be to store mixed values and
report invalid type or coerce the values to Text. Both seem
Expand Down Expand Up @@ -151,7 +152,7 @@ simple_types_map = Dictionary.from_vector <|
numerics = [Types.DECIMAL, Types.NUMERIC] . map x-> [x, default_float]
strings = [Types.CHAR, Types.VARCHAR] . map x-> [x, default_text]
blobs = [Types.BINARY, Types.BLOB, Types.CLOB] . map x-> [x, Value_Type.Binary]
special_types = [[Types.BOOLEAN, Value_Type.Boolean]]
special_types = [[Types.BOOLEAN, Value_Type.Boolean], [Types.NULL, Value_Type.Null]]
ints + floats + numerics + strings + blobs + special_types

## PRIVATE
Expand Down Expand Up @@ -246,6 +247,9 @@ type SQLite_Types
The artificial 6th affinity that is used to distinguish boolean columns.
boolean = SQL_Type.Value Types.BOOLEAN "BOOLEAN"

## PRIVATE
null = SQL_Type.Value Types.NULL "NULL"

## PRIVATE
default_text = Value_Type.Char size=Nothing variable_length=True

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ private

from Standard.Base import all
import Standard.Base.Data.Vector.No_Wrap
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument

import project.Column_Description.Column_Description
import project.Connection.Connection.Connection
Expand All @@ -10,6 +11,7 @@ import project.Internal.IR.Query.Query
import project.Internal.IR.SQL_Expression.SQL_Expression
import project.SQL_Query.SQL_Query
import project.SQL_Statement.SQL_Statement
from project.Errors import Unsupported_Database_Type

## PRIVATE
make_batched_insert_template : Connection -> Text -> Vector (Vector Text) -> SQL_Query
Expand All @@ -32,6 +34,9 @@ prepare_create_table_statement connection table_name columns primary_key tempora
type_mapping = connection.dialect.get_type_mapping
column_descriptors = columns.map on_problems=No_Wrap.Value def->
sql_type = type_mapping.value_type_to_sql def.value_type on_problems
. catch Unsupported_Database_Type error->
Error.throw (Illegal_Argument.Error "Definition for column ["+def.name+"] is invalid: "+error.to_display_text)

sql_type_text = type_mapping.sql_type_to_text sql_type
Create_Column_Descriptor.Value def.name sql_type_text def.constraints
connection.dialect.generate_sql <|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ type SQLServer_Type_Mapping
True -> SQL_Type.Value Types.BINARY "VARBINARY" size
False -> SQL_Type.Value Types.BINARY "BINARY" size
Value_Type.Mixed -> Error.throw (Unsupported_Database_Type.Error "Mixed" "SQLServer")
Value_Type.Null -> Error.throw (Unsupported_Database_Type.Error "Null" "SQLServer")
Value_Type.Unsupported_Data_Type type_name underlying_type ->
underlying_type.if_nothing <| Error.throw <| Illegal_Argument.Error <|
"An unsupported SQL type ["+type_name.to_text+"] cannot be converted into an SQL type because it did not contain the SQL metadata needed to reconstruct it."
Expand Down Expand Up @@ -101,6 +102,7 @@ type SQLServer_Type_Mapping
"varbinary" -> Value_Type.Binary size=sql_type.precision variable_length=True
"binary" -> Value_Type.Binary size=sql_type.precision variable_length=False
_ -> on_unknown_type sql_type
Types.NULL -> Value_Type.Null
_ -> case sql_type.name of
"datetimeoffset" -> Value_Type.Date_Time with_timezone=True
_ -> on_unknown_type sql_type
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ type Snowflake_Type_Mapping
True -> SQL_Type.Value Types.BINARY "binary"
False -> SQL_Type.Value Types.BINARY "binary" size
Value_Type.Mixed -> Error.throw (Unsupported_Database_Type.Error "Mixed" "Snowflake")
Value_Type.Null -> Error.throw (Unsupported_Database_Type.Error "Null" "Snowflake")
Value_Type.Unsupported_Data_Type type_name underlying_type ->
underlying_type.if_nothing <| Error.throw <| Illegal_Argument.Error <|
"An unsupported SQL type ["+type_name.to_text+"] cannot be converted into an SQL type because it did not contain the SQL metadata needed to reconstruct it."
Expand Down Expand Up @@ -159,7 +160,7 @@ type Snowflake_Type_Mapping
## PRIVATE
simple_types_map = Dictionary.from_vector <|
floats = [[Types.DOUBLE, Value_Type.Float Bits.Bits_64], [Types.REAL, Value_Type.Float Bits.Bits_64]]
other = [[Types.DATE, Value_Type.Date], [Types.TIME, Value_Type.Time], [Types.BOOLEAN, Value_Type.Boolean]]
other = [[Types.DATE, Value_Type.Date], [Types.TIME, Value_Type.Time], [Types.BOOLEAN, Value_Type.Boolean], [Types.NULL, Value_Type.Null]]
floats + other

## PRIVATE
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -536,6 +536,7 @@ type Column
run_binary_op self fn other new_name
_ ->
run_vectorized_binary_op self Java_Storage.Maps.SUB other
Nothing -> self.const Nothing

## ALIAS multiply, product, times
GROUP Standard.Base.Operators
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ polyglot java import org.enso.table.data.column.storage.type.StorageType
Checks if one type can be cast into another and returns a dataflow error
explaining the situation if not.
check_cast_compatibility source_type target_type ~action =
are_compatible = if (target_type == Value_Type.Mixed) || (source_type == Value_Type.Mixed) || target_type.is_text || (source_type == target_type) then True else
are_compatible = if (target_type == Value_Type.Mixed) || (source_type == Value_Type.Mixed) || (source_type == Value_Type.Null) || target_type.is_text || (source_type == target_type) then True else
if source_type.is_text && is_a_valid_parse_target target_type then Error.throw (Illegal_Argument.Error "To parse a text column into "+target_type.to_display_text+" type, `parse` should be used instead of `cast`.") else
if source_type == Value_Type.Boolean then target_type.is_numeric else
if source_type.is_numeric then target_type.is_numeric else
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from Standard.Base import all
import Standard.Base.Errors.Common.Failed_To_Load
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument

import project.Columns_To_Keep.Columns_To_Keep
Expand Down Expand Up @@ -39,11 +40,18 @@ Read_Many_As_Merged_Table_Strategy.from (that : Vector) =
(No_Rows.Warning "The "+path.to_display_text+" loaded as an empty array, so it is not included in the `As_Merged_Table` result of `read_many`.")
Read_Many_As_Merged_Table_Strategy.Value callback

## PRIVATE
Read_Many_As_Merged_Table_Strategy.from (that : Failed_To_Load) =
callback path _ _ on_problems =
on_problems.attach_problem_after Read_Many_As_Table_Result.No_Data <|
(No_Rows.Warning "The "+path.to_display_text+" failed to load, so it is not included in the `As_Merged_Table` result of `read_many`. Caused by: "+that.cause.to_display_text)
Read_Many_As_Merged_Table_Strategy.Value callback

## PRIVATE
The fallback strategy for converting a generic object into a table.
Custom data types may implement a conversion to override this strategy, like above.
Read_Many_As_Merged_Table_Strategy.from (that : Any) =
callback path _ _ on_problems =
callback path _ _ on_problems =
Read_Many_As_Table_Result.Table metadata=Nothing data=(_interpret_as_table that path on_problems)
Read_Many_As_Merged_Table_Strategy.Value callback

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@ private

from Standard.Base import all
import Standard.Base.Data.Read.Many_Files_List.Many_Files_List
import Standard.Base.Errors.Common.Failed_To_Load
import Standard.Base.Errors.Illegal_Argument.Illegal_Argument
from Standard.Base.Data.Read.Return_As import replace_with_nothing_and_propagate

import project.Column.Column
import project.Errors.Invalid_Value_Type
Expand Down Expand Up @@ -30,15 +32,18 @@ ensure_column_type_valid_to_be_files_list (column : Column) ~action =
Value_Type.Mixed -> True
# Columns containing paths as Text will be Char
Value_Type.Char _ _ -> True
# Empty columns are also valid
Value_Type.Null -> True
_ -> False
if is_expected_type then action else
Error.throw (Invalid_Value_Type.Column "Text or Mixed" column.value_type column.name)

make_return (return_shape : Return_As_Table) (input : Many_Files_List) (objects : Vector Any) (on_problems : Problem_Behavior) -> Table =
make_return (return_shape : Return_As_Table) (input : Many_Files_List) (objects : Vector (Any | Failed_To_Load)) (on_problems : Problem_Behavior) -> Table =
base_table = _input_as_table input
case return_shape of
Return_As_Table.With_New_Column ->
_add_objects_column base_table objects
replaced = replace_with_nothing_and_propagate objects on_problems
_add_objects_column base_table replaced
Return_As_Table.As_Merged_Table columns_to_keep match_columns ->
tables = input.paths_to_load.zip objects path-> object->
strategy = Read_Many_As_Merged_Table_Strategy.from object
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ polyglot java import org.enso.table.data.column.storage.type.DateTimeType
polyglot java import org.enso.table.data.column.storage.type.DateType
polyglot java import org.enso.table.data.column.storage.type.FloatType
polyglot java import org.enso.table.data.column.storage.type.IntegerType
polyglot java import org.enso.table.data.column.storage.type.NullType
polyglot java import org.enso.table.data.column.storage.type.StorageType
polyglot java import org.enso.table.data.column.storage.type.TextType
polyglot java import org.enso.table.data.column.storage.type.TimeOfDayType
Expand All @@ -46,6 +47,7 @@ to_value_type storage_type = case storage_type of
_ : TimeOfDayType -> Value_Type.Time
_ : BigDecimalType -> Value_Type.Decimal
_ : BigIntegerType -> Value_Type.Decimal scale=0
_ : NullType -> Value_Type.Null
_ : AnyObjectType -> Value_Type.Mixed

## PRIVATE
Expand All @@ -70,6 +72,7 @@ closest_storage_type value_type = case value_type of
Value_Type.Decimal _ scale ->
is_integer = scale.is_nothing.not && scale <= 0
if is_integer then BigIntegerType.INSTANCE else BigDecimalType.INSTANCE
Value_Type.Null -> NullType.INSTANCE
_ ->
Error.throw (Illegal_Argument.Error "Columns of type "+value_type.to_display_text+" are currently not supported in the in-memory backend.")

Expand Down
Loading
Loading