TypeSystem.add_type(logical_type: LogicalType, inference_function: Optional[Callable] = None, parent: Optional[LogicalType] = None, treatment: Optional[str] = None)[source]#

Add a new LogicalType to the TypeSystem, optionally specifying the corresponding inference function and a parent type.

  • logical_type (LogicalType) – The new LogicalType to add.

  • inference_function (func, optional) – The inference function to use for inferring the given LogicalType. Defaults to None. If not specified, this LogicalType will never be inferred.

  • parent (LogicalType, optional) – The parent LogicalType, if applicable. Defaults to None. If not specified, this type will be considered a root type with no parent.

  • treatment (string, optional) – If the specified LogicalType already exists, determine the logic that should be applied. Options are “replace”, “ignore”, or None (default). “replace” will unregister the present LogicalType and replace it with the one that was passed. “ignore” will not register the passed LogicalType if it already exists. The default value of None will raise an error.