vtlengine 1.0.3rc3__py3-none-any.whl → 1.1rc1__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of vtlengine might be problematic. Click here for more details.
- vtlengine/API/_InternalApi.py +64 -58
- vtlengine/API/__init__.py +11 -2
- vtlengine/API/data/schema/json_schema_2.1.json +116 -0
- vtlengine/AST/ASTConstructor.py +5 -4
- vtlengine/AST/ASTConstructorModules/Expr.py +47 -48
- vtlengine/AST/ASTConstructorModules/ExprComponents.py +45 -23
- vtlengine/AST/ASTConstructorModules/Terminals.py +21 -11
- vtlengine/AST/ASTEncoders.py +1 -1
- vtlengine/AST/DAG/__init__.py +0 -3
- vtlengine/AST/Grammar/lexer.py +0 -1
- vtlengine/AST/Grammar/parser.py +185 -440
- vtlengine/AST/VtlVisitor.py +0 -1
- vtlengine/DataTypes/TimeHandling.py +50 -15
- vtlengine/DataTypes/__init__.py +79 -7
- vtlengine/Exceptions/__init__.py +3 -5
- vtlengine/Exceptions/messages.py +65 -105
- vtlengine/Interpreter/__init__.py +83 -38
- vtlengine/Model/__init__.py +7 -9
- vtlengine/Operators/Aggregation.py +13 -7
- vtlengine/Operators/Analytic.py +48 -9
- vtlengine/Operators/Assignment.py +0 -1
- vtlengine/Operators/CastOperator.py +44 -44
- vtlengine/Operators/Clause.py +16 -10
- vtlengine/Operators/Comparison.py +20 -12
- vtlengine/Operators/Conditional.py +30 -13
- vtlengine/Operators/General.py +9 -4
- vtlengine/Operators/HROperators.py +4 -14
- vtlengine/Operators/Join.py +15 -14
- vtlengine/Operators/Numeric.py +32 -26
- vtlengine/Operators/RoleSetter.py +6 -2
- vtlengine/Operators/Set.py +12 -8
- vtlengine/Operators/String.py +9 -9
- vtlengine/Operators/Time.py +136 -116
- vtlengine/Operators/Validation.py +10 -4
- vtlengine/Operators/__init__.py +56 -69
- vtlengine/Utils/__init__.py +6 -1
- vtlengine/__extras_check.py +17 -0
- vtlengine/files/output/__init__.py +2 -1
- vtlengine/files/output/_time_period_representation.py +2 -1
- vtlengine/files/parser/__init__.py +47 -31
- vtlengine/files/parser/_rfc_dialect.py +1 -1
- vtlengine/files/parser/_time_checking.py +4 -4
- {vtlengine-1.0.3rc3.dist-info → vtlengine-1.1rc1.dist-info}/METADATA +17 -17
- vtlengine-1.1rc1.dist-info/RECORD +59 -0
- {vtlengine-1.0.3rc3.dist-info → vtlengine-1.1rc1.dist-info}/WHEEL +1 -1
- vtlengine/DataTypes/NumericTypesHandling.py +0 -38
- vtlengine-1.0.3rc3.dist-info/RECORD +0 -58
- {vtlengine-1.0.3rc3.dist-info → vtlengine-1.1rc1.dist-info}/LICENSE.md +0 -0
|
@@ -31,7 +31,8 @@ class ExprComp(VtlVisitor):
|
|
|
31
31
|
|
|
32
32
|
ExprComponent Definition.
|
|
33
33
|
|
|
34
|
-
_______________________________________________________________________________________
|
|
34
|
+
_______________________________________________________________________________________
|
|
35
|
+
"""
|
|
35
36
|
|
|
36
37
|
def visitExprComponent(self, ctx: Parser.ExprComponentContext):
|
|
37
38
|
"""
|
|
@@ -49,7 +50,7 @@ class ExprComp(VtlVisitor):
|
|
|
49
50
|
| constant # constantExprComp
|
|
50
51
|
| componentID # compId
|
|
51
52
|
;
|
|
52
|
-
"""
|
|
53
|
+
""" # noqa E501
|
|
53
54
|
ctx_list = list(ctx.getChildren())
|
|
54
55
|
c = ctx_list[0]
|
|
55
56
|
|
|
@@ -280,7 +281,7 @@ class ExprComp(VtlVisitor):
|
|
|
280
281
|
def visitCallComponent(self, ctx: Parser.CallComponentContext):
|
|
281
282
|
"""
|
|
282
283
|
callFunction: operatorID LPAREN (parameterComponent (COMMA parameterComponent)*)? RPAREN # callComponent
|
|
283
|
-
"""
|
|
284
|
+
""" # noqa E501
|
|
284
285
|
ctx_list = list(ctx.getChildren())
|
|
285
286
|
c = ctx_list[0]
|
|
286
287
|
|
|
@@ -296,7 +297,7 @@ class ExprComp(VtlVisitor):
|
|
|
296
297
|
def visitEvalAtomComponent(self, ctx: Parser.EvalAtomComponentContext):
|
|
297
298
|
"""
|
|
298
299
|
| EVAL LPAREN routineName LPAREN (componentID|scalarItem)? (COMMA (componentID|scalarItem))* RPAREN (LANGUAGE STRING_CONSTANT)? (RETURNS outputParameterTypeComponent)? RPAREN # evalAtomComponent
|
|
299
|
-
"""
|
|
300
|
+
""" # noqa E501
|
|
300
301
|
ctx_list = list(ctx.getChildren())
|
|
301
302
|
|
|
302
303
|
routine_name = Terminals().visitRoutineName(ctx_list[2])
|
|
@@ -347,7 +348,7 @@ class ExprComp(VtlVisitor):
|
|
|
347
348
|
def visitCastExprComponent(self, ctx: Parser.CastExprComponentContext):
|
|
348
349
|
"""
|
|
349
350
|
| CAST LPAREN exprComponent COMMA (basicScalarType|valueDomainName) (COMMA STRING_CONSTANT)? RPAREN # castExprComponent
|
|
350
|
-
"""
|
|
351
|
+
""" # noqa E501
|
|
351
352
|
ctx_list = list(ctx.getChildren())
|
|
352
353
|
c = ctx_list[0]
|
|
353
354
|
|
|
@@ -391,7 +392,6 @@ class ExprComp(VtlVisitor):
|
|
|
391
392
|
raise NotImplementedError
|
|
392
393
|
|
|
393
394
|
def visitParameterComponent(self, ctx: Parser.ParameterComponentContext):
|
|
394
|
-
|
|
395
395
|
ctx_list = list(ctx.getChildren())
|
|
396
396
|
c = ctx_list[0]
|
|
397
397
|
|
|
@@ -582,16 +582,19 @@ class ExprComp(VtlVisitor):
|
|
|
582
582
|
return self.visitDateDiffAtomComponent(ctx)
|
|
583
583
|
elif isinstance(ctx, Parser.DateAddAtomComponentContext):
|
|
584
584
|
return self.visitDateAddAtomComponentContext(ctx)
|
|
585
|
-
elif
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
585
|
+
elif isinstance(
|
|
586
|
+
ctx,
|
|
587
|
+
(
|
|
588
|
+
Parser.YearAtomComponentContext,
|
|
589
|
+
Parser.MonthAtomComponentContext,
|
|
590
|
+
Parser.DayOfMonthAtomComponentContext,
|
|
591
|
+
Parser.DayOfYearAtomComponentContext,
|
|
592
|
+
Parser.DayToYearAtomComponentContext,
|
|
593
|
+
Parser.DayToMonthAtomComponentContext,
|
|
594
|
+
Parser.YearToDayAtomComponentContext,
|
|
595
|
+
Parser.MonthToDayAtomComponentContext,
|
|
596
|
+
),
|
|
597
|
+
):
|
|
595
598
|
return self.visitTimeUnaryAtomComponent(ctx)
|
|
596
599
|
else:
|
|
597
600
|
raise NotImplementedError
|
|
@@ -650,7 +653,7 @@ class ExprComp(VtlVisitor):
|
|
|
650
653
|
"""
|
|
651
654
|
TIME_AGG LPAREN periodIndTo=STRING_CONSTANT (COMMA periodIndFrom=(STRING_CONSTANT| OPTIONAL ))?
|
|
652
655
|
(COMMA op=optionalExprComponent)? (COMMA (FIRST|LAST))? RPAREN # timeAggAtomComponent;
|
|
653
|
-
"""
|
|
656
|
+
""" # noqa E501
|
|
654
657
|
ctx_list = list(ctx.getChildren())
|
|
655
658
|
c = ctx_list[0]
|
|
656
659
|
|
|
@@ -684,7 +687,11 @@ class ExprComp(VtlVisitor):
|
|
|
684
687
|
# AST_ASTCONSTRUCTOR.17
|
|
685
688
|
raise SemanticError("1-4-2-2")
|
|
686
689
|
return TimeAggregation(
|
|
687
|
-
op=op,
|
|
690
|
+
op=op,
|
|
691
|
+
operand=operand_node,
|
|
692
|
+
period_to=period_to,
|
|
693
|
+
period_from=period_from,
|
|
694
|
+
conf=conf,
|
|
688
695
|
)
|
|
689
696
|
|
|
690
697
|
def visitCurrentDateAtomComponent(self, ctx: Parser.CurrentDateAtomComponentContext):
|
|
@@ -825,7 +832,6 @@ class ExprComp(VtlVisitor):
|
|
|
825
832
|
"""
|
|
826
833
|
|
|
827
834
|
def visitAnalyticFunctionsComponents(self, ctx: Parser.AnalyticFunctionsComponentsContext):
|
|
828
|
-
|
|
829
835
|
if isinstance(ctx, Parser.AnSimpleFunctionComponentContext):
|
|
830
836
|
return self.visitAnSimpleFunctionComponent(ctx)
|
|
831
837
|
elif isinstance(ctx, Parser.LagOrLeadAnComponentContext):
|
|
@@ -861,7 +867,11 @@ class ExprComp(VtlVisitor):
|
|
|
861
867
|
raise NotImplementedError
|
|
862
868
|
|
|
863
869
|
return Analytic(
|
|
864
|
-
op=op_node,
|
|
870
|
+
op=op_node,
|
|
871
|
+
operand=operand,
|
|
872
|
+
partition_by=partition_by,
|
|
873
|
+
order_by=order_by,
|
|
874
|
+
window=params,
|
|
865
875
|
)
|
|
866
876
|
|
|
867
877
|
def visitLagOrLeadAnComponent(self, ctx: Parser.LagOrLeadAnComponentContext):
|
|
@@ -891,7 +901,11 @@ class ExprComp(VtlVisitor):
|
|
|
891
901
|
continue
|
|
892
902
|
|
|
893
903
|
return Analytic(
|
|
894
|
-
op=op_node,
|
|
904
|
+
op=op_node,
|
|
905
|
+
operand=operand,
|
|
906
|
+
partition_by=partition_by,
|
|
907
|
+
order_by=order_by,
|
|
908
|
+
params=params,
|
|
895
909
|
)
|
|
896
910
|
|
|
897
911
|
def visitRankAnComponent(self, ctx: Parser.RankAnComponentContext):
|
|
@@ -911,7 +925,11 @@ class ExprComp(VtlVisitor):
|
|
|
911
925
|
continue
|
|
912
926
|
|
|
913
927
|
return Analytic(
|
|
914
|
-
op=op_node,
|
|
928
|
+
op=op_node,
|
|
929
|
+
operand=None,
|
|
930
|
+
partition_by=partition_by,
|
|
931
|
+
order_by=order_by,
|
|
932
|
+
window=None,
|
|
915
933
|
)
|
|
916
934
|
|
|
917
935
|
def visitRatioToReportAnComponent(self, ctx: Parser.RatioToReportAnComponentContext):
|
|
@@ -926,5 +944,9 @@ class ExprComp(VtlVisitor):
|
|
|
926
944
|
partition_by = Terminals().visitPartitionByClause(ctx_list[5])
|
|
927
945
|
|
|
928
946
|
return Analytic(
|
|
929
|
-
op=op_node,
|
|
947
|
+
op=op_node,
|
|
948
|
+
operand=operand,
|
|
949
|
+
partition_by=partition_by,
|
|
950
|
+
order_by=order_by,
|
|
951
|
+
window=params,
|
|
930
952
|
)
|
|
@@ -70,7 +70,6 @@ class Terminals(VtlVisitor):
|
|
|
70
70
|
return var_id_node
|
|
71
71
|
|
|
72
72
|
def visitVarIdExpr(self, ctx: Parser.VarIdExprContext):
|
|
73
|
-
|
|
74
73
|
if isinstance(ctx.children[0], Parser.VarIDContext):
|
|
75
74
|
return self.visitVarID(ctx.children[0])
|
|
76
75
|
|
|
@@ -127,7 +126,10 @@ class Terminals(VtlVisitor):
|
|
|
127
126
|
valueDomainID: IDENTIFIER ;
|
|
128
127
|
"""
|
|
129
128
|
return Collection(
|
|
130
|
-
name=ctx.children[0].getSymbol().text,
|
|
129
|
+
name=ctx.children[0].getSymbol().text,
|
|
130
|
+
children=[],
|
|
131
|
+
kind="ValueDomain",
|
|
132
|
+
type="",
|
|
131
133
|
)
|
|
132
134
|
|
|
133
135
|
def visitRulesetID(self, ctx: Parser.RulesetIDContext):
|
|
@@ -381,7 +383,7 @@ class Terminals(VtlVisitor):
|
|
|
381
383
|
| DATAPOINT_ON_VD (GLPAREN valueDomainName (MUL valueDomainName)* GRPAREN )? # dataPointVd
|
|
382
384
|
| DATAPOINT_ON_VAR (GLPAREN varID (MUL varID)* GRPAREN )? # dataPointVar
|
|
383
385
|
;
|
|
384
|
-
"""
|
|
386
|
+
""" # noqa E501
|
|
385
387
|
# AST_ASTCONSTRUCTOR.54
|
|
386
388
|
raise NotImplementedError
|
|
387
389
|
|
|
@@ -391,7 +393,7 @@ class Terminals(VtlVisitor):
|
|
|
391
393
|
| HIERARCHICAL_ON_VD ( GLPAREN vdName=IDENTIFIER (LPAREN valueDomainName (MUL valueDomainName)* RPAREN)? GRPAREN )? # hrRulesetVdType
|
|
392
394
|
| HIERARCHICAL_ON_VAR ( GLPAREN varName=varID (LPAREN varID (MUL varID)* RPAREN)? GRPAREN )? # hrRulesetVarType
|
|
393
395
|
;
|
|
394
|
-
"""
|
|
396
|
+
""" # noqa E501
|
|
395
397
|
# AST_ASTCONSTRUCTOR.55
|
|
396
398
|
raise NotImplementedError
|
|
397
399
|
|
|
@@ -483,7 +485,6 @@ class Terminals(VtlVisitor):
|
|
|
483
485
|
raise NotImplementedError
|
|
484
486
|
|
|
485
487
|
def visitScalarItem(self, ctx: Parser.ScalarItemContext):
|
|
486
|
-
|
|
487
488
|
ctx_list = list(ctx.getChildren())
|
|
488
489
|
c = ctx_list[0]
|
|
489
490
|
|
|
@@ -497,7 +498,7 @@ class Terminals(VtlVisitor):
|
|
|
497
498
|
def visitScalarWithCast(self, ctx: Parser.ScalarWithCastContext):
|
|
498
499
|
"""
|
|
499
500
|
| CAST LPAREN constant COMMA (basicScalarType) (COMMA STRING_CONSTANT)? RPAREN #scalarWithCast # noqa E501
|
|
500
|
-
"""
|
|
501
|
+
""" # noqa E501
|
|
501
502
|
ctx_list = list(ctx.getChildren())
|
|
502
503
|
c = ctx_list[0]
|
|
503
504
|
|
|
@@ -593,7 +594,7 @@ class Terminals(VtlVisitor):
|
|
|
593
594
|
|
|
594
595
|
def visitSignature(self, ctx: Parser.SignatureContext, kind="ComponentID"):
|
|
595
596
|
"""
|
|
596
|
-
|
|
597
|
+
VarID (AS alias)?
|
|
597
598
|
"""
|
|
598
599
|
|
|
599
600
|
ctx_list = list(ctx.getChildren())
|
|
@@ -672,8 +673,12 @@ class Terminals(VtlVisitor):
|
|
|
672
673
|
first = num_rows_1 # unbounded (default value)
|
|
673
674
|
second = num_rows_2 # current data point (default value)
|
|
674
675
|
|
|
675
|
-
if (
|
|
676
|
-
|
|
676
|
+
if (
|
|
677
|
+
mode_2 == "preceding"
|
|
678
|
+
and mode_1 == "preceding"
|
|
679
|
+
and num_rows_1 == -1
|
|
680
|
+
and num_rows_2 == -1
|
|
681
|
+
): # preceding and preceding (error)
|
|
677
682
|
raise Exception(
|
|
678
683
|
f"Cannot have 2 preceding clauses with unbounded in analytic clause, "
|
|
679
684
|
f"line {ctx_list[3].start.line}"
|
|
@@ -706,7 +711,8 @@ class Terminals(VtlVisitor):
|
|
|
706
711
|
return OrderBy(component=self.visitComponentID(ctx_list[0]).value, order="asc")
|
|
707
712
|
|
|
708
713
|
return OrderBy(
|
|
709
|
-
component=self.visitComponentID(ctx_list[0]).value,
|
|
714
|
+
component=self.visitComponentID(ctx_list[0]).value,
|
|
715
|
+
order=ctx_list[1].getSymbol().text,
|
|
710
716
|
)
|
|
711
717
|
|
|
712
718
|
def visitLimitClauseItem(self, ctx: Parser.LimitClauseItemContext):
|
|
@@ -735,5 +741,9 @@ def create_windowing(win_mode, values, modes):
|
|
|
735
741
|
values[e] = "CURRENT ROW"
|
|
736
742
|
|
|
737
743
|
return Windowing(
|
|
738
|
-
type_=win_mode,
|
|
744
|
+
type_=win_mode,
|
|
745
|
+
start=values[0],
|
|
746
|
+
stop=values[1],
|
|
747
|
+
start_mode=modes[0],
|
|
748
|
+
stop_mode=modes[1],
|
|
739
749
|
)
|
vtlengine/AST/ASTEncoders.py
CHANGED
vtlengine/AST/DAG/__init__.py
CHANGED
|
@@ -300,7 +300,6 @@ class DAGAnalyzer(ASTTemplate):
|
|
|
300
300
|
self.visit(node.right)
|
|
301
301
|
|
|
302
302
|
def visit_RegularAggregation(self, node: RegularAggregation) -> None:
|
|
303
|
-
|
|
304
303
|
self.visit(node.dataset)
|
|
305
304
|
for child in node.children:
|
|
306
305
|
self.isFromRegularAggregation = True
|
|
@@ -329,7 +328,6 @@ class DAGAnalyzer(ASTTemplate):
|
|
|
329
328
|
self.inputs.append(node.value)
|
|
330
329
|
|
|
331
330
|
def visit_ParamOp(self, node: ParamOp) -> None:
|
|
332
|
-
|
|
333
331
|
if self.udos and node.op in self.udos:
|
|
334
332
|
DO_AST: Operator = self.udos[node.op]
|
|
335
333
|
|
|
@@ -426,7 +424,6 @@ class HRDAGAnalyzer(DAGAnalyzer):
|
|
|
426
424
|
# def visit_Identifier(self, node: Identifier) -> None:
|
|
427
425
|
if node.kind == "CodeItemID": # and node.value not in self.alias:
|
|
428
426
|
if self.isFirstAssignment:
|
|
429
|
-
|
|
430
427
|
self.isFirstAssignment = False
|
|
431
428
|
self.outputs.append(node.value)
|
|
432
429
|
else:
|