General operation of vtl engine operators
Vtl engine has a superclass containing the main params to execute the different operation available in this language. To do it, many class methods are created to indentify what type of data are treating, such as datasets, datacomponents or even the type of data the operator is using.
Operator class
- class vtlengine.Operators.Operator
Bases:
object
Superclass for all operators
- classmethod modify_measure_column(result: Dataset) None
If an Operator change the data type of the Variable it is applied to (e.g., from string to number), the result Data Set cannot maintain this Variable as it happens in the previous cases, because a Variable cannot have different data types in different Data Sets. As a consequence, the converted variable cannot follow the same rules described in the sections above and must be replaced, in the result Data Set, by another Variable of the proper data type. For sake of simplicity, the operators changing the data type are allowed only on mono-measure operand Data Sets, so that the conversion happens on just one Measure. A default generic Measure is assigned by default to the result Data Set, depending on the data type of the result (the default Measure Variables are reported in the table below).
Function used by the evaluate function when a dataset is involved
Operator class has two subclasses:
Binary
This class is prepared to support those operations where two variables are operated. There are different methods supporting this class, allowing the engine to perform all kind of operations that vtl language supports.
To distinguish the kind of operator and its role, there are validation methods that verifies what type of data the operand is, focusing on its components and its compatibility. Also, there are evaluate methods to ensure the type of data is the correct one to operate with in a determined operation.
- class vtlengine.Operators.Binary
Unary
This class allows the engine to perform the operations that only have one operand. As binary class, it is supported with validation and evaluation methods.
- class vtlengine.Operators.Unary