-
Notifications
You must be signed in to change notification settings - Fork 5
Closed
Labels
releasedIncluded in a releaseIncluded in a release
Description
Is your feature request related to a problem?
At the moment, the add_row and add_rows methods of Table raise an exception if the schemata of the current Table and the new Row differ:
if self._schema != row.schema:
raise SchemaMismatchError()This is a particular problem, if the Table is empty.
Desired solution
- If the schema of the
Tableis empty (no columns), accept anyRowand use the schema of theRowas the schema of the newTable - Otherwise, verify that the list of column names is the same for the
Tableand theRow. Don't fail if the types differ, but instead widen them so all values in theTableand the values in theRoware included. For each column, the resulting type should be the lowest common supertype of the type of the column in theTableand theRow
Example:
- Schema of
Table:
{
"a": Integer()
}- Schema of
Row:
{
"a": RealNumber()
}- Schema of resulting
Table:
{
"a": RealNumber() # Common supertype of `Integer()` and `RealNumber()`
}Type hierarchy:
- Anything
- RealNumber
- Integer
- Boolean
- String
- RealNumber
Nullability of one of the types gets propagated to the result, i.e. iff any of the types was nullable, the result type is also nullable.
Possible alternatives (optional)
No response
Screenshots (optional)
No response
Additional Context (optional)
No response
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
releasedIncluded in a releaseIncluded in a release
Type
Projects
Status
✔️ Done