vtlengine 1.2.0__py3-none-any.whl → 1.2.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.

@@ -591,16 +591,25 @@ class InterpreterAnalyzer(ASTTemplate):
591
591
  else:
592
592
  operand_comp = self.visit(node.operand)
593
593
  component_name = operand_comp.name
594
+ id_names = self.regular_aggregation_dataset.get_identifiers_names()
594
595
  measure_names = self.regular_aggregation_dataset.get_measures_names()
596
+ attribute_names = self.regular_aggregation_dataset.get_attributes_names()
595
597
  dataset_components = self.regular_aggregation_dataset.components.copy()
596
- for name in measure_names:
597
- if name != operand_comp.name:
598
- dataset_components.pop(name)
598
+ for name in measure_names + attribute_names:
599
+ dataset_components.pop(name)
600
+
601
+ dataset_components[operand_comp.name] = Component(
602
+ name=operand_comp.name,
603
+ data_type=operand_comp.data_type,
604
+ role=operand_comp.role,
605
+ nullable=operand_comp.nullable,
606
+ )
599
607
 
600
608
  if self.only_semantic or self.regular_aggregation_dataset.data is None:
601
609
  data = None
602
610
  else:
603
- data = self.regular_aggregation_dataset.data[dataset_components.keys()]
611
+ data = self.regular_aggregation_dataset.data[id_names].copy()
612
+ data[operand_comp.name] = operand_comp.data
604
613
 
605
614
  operand = Dataset(
606
615
  name=self.regular_aggregation_dataset.name,
@@ -103,12 +103,12 @@ class Aggregation(Operator.Unary):
103
103
  elif measure.data_type == Duration:
104
104
  if mode == "input":
105
105
  data[measure.name] = data[measure.name].map(
106
- lambda x: PERIOD_IND_MAPPING[x], # type: ignore[index]
106
+ lambda x: PERIOD_IND_MAPPING[x],
107
107
  na_action="ignore",
108
108
  )
109
109
  else:
110
110
  data[measure.name] = data[measure.name].map(
111
- lambda x: PERIOD_IND_MAPPING_REVERSE[x], # type: ignore[index]
111
+ lambda x: PERIOD_IND_MAPPING_REVERSE[x],
112
112
  na_action="ignore",
113
113
  )
114
114
  elif measure.data_type == Boolean:
@@ -157,15 +157,19 @@ class If(Operator):
157
157
  op=cls.op,
158
158
  type=SCALAR_TYPES_CLASS_REVERSE[condition.data_type],
159
159
  )
160
- if not isinstance(left, Scalar) or not isinstance(right, Scalar):
161
- nullable = condition.nullable
162
- else:
163
- if left.data_type == Null or right.data_type == Null:
164
- nullable = True
165
- if isinstance(left, DataComponent):
166
- nullable |= left.nullable
167
- if isinstance(right, DataComponent):
168
- nullable |= right.nullable
160
+
161
+ if (
162
+ isinstance(left, Scalar)
163
+ and isinstance(right, Scalar)
164
+ and (left.data_type == Null or right.data_type == Null)
165
+ ):
166
+ nullable = True
167
+ if isinstance(left, DataComponent) and isinstance(right, DataComponent):
168
+ nullable = left.nullable or right.nullable
169
+ elif isinstance(left, DataComponent):
170
+ nullable = left.nullable or right.data_type == Null
171
+ elif isinstance(right, DataComponent):
172
+ nullable = left.data_type == Null or right.nullable
169
173
  return DataComponent(
170
174
  name=comp_name,
171
175
  data=None,
@@ -433,11 +437,9 @@ class Case(Operator):
433
437
  raise SemanticError("2-1-9-4", op=cls.op, name=condition.name)
434
438
 
435
439
  nullable = any(
436
- (thenOp.nullable if isinstance(thenOp, DataComponent) else thenOp.data_type == Null)
437
- for thenOp in ops
440
+ (op.nullable if isinstance(op, DataComponent) else op.data_type == Null)
441
+ for op in ops
438
442
  )
439
- nullable |= any(condition.nullable for condition in conditions)
440
-
441
443
  data_type = ops[0].data_type
442
444
  for op in ops[1:]:
443
445
  data_type = binary_implicit_promotion(data_type, op.data_type)
@@ -9,6 +9,7 @@ from typing import Any, Dict, List, Optional
9
9
  import pandas as pd
10
10
 
11
11
  from vtlengine.AST import BinOp
12
+ from vtlengine.AST.Grammar.tokens import CROSS_JOIN, FULL_JOIN, INNER_JOIN, LEFT_JOIN
12
13
  from vtlengine.DataTypes import binary_implicit_promotion
13
14
  from vtlengine.Exceptions import SemanticError
14
15
  from vtlengine.Model import Component, Dataset, Role
@@ -276,6 +277,7 @@ class Join(Operator):
276
277
 
277
278
 
278
279
  class InnerJoin(Join):
280
+ op = INNER_JOIN
279
281
  how = "inner"
280
282
 
281
283
  @classmethod
@@ -296,10 +298,12 @@ class InnerJoin(Join):
296
298
 
297
299
 
298
300
  class LeftJoin(Join):
301
+ op = LEFT_JOIN
299
302
  how = "left"
300
303
 
301
304
 
302
305
  class FullJoin(Join):
306
+ op = FULL_JOIN
303
307
  how = "outer"
304
308
 
305
309
  @classmethod
@@ -320,6 +324,7 @@ class FullJoin(Join):
320
324
 
321
325
 
322
326
  class CrossJoin(Join):
327
+ op = CROSS_JOIN
323
328
  how = "cross"
324
329
 
325
330
  @classmethod
@@ -24,11 +24,11 @@ class VirtualCounter:
24
24
  @classmethod
25
25
  def _new_ds_name(cls) -> str:
26
26
  cls.dataset_count += 1
27
- name = f"@VDS_{copy(cls.dataset_count)}"
27
+ name = f"__VDS_{copy(cls.dataset_count)}__"
28
28
  return name
29
29
 
30
30
  @classmethod
31
31
  def _new_dc_name(cls) -> str:
32
32
  cls.component_count += 1
33
- name = f"@VDC_{copy(cls.component_count)}"
33
+ name = f"__VDC_{copy(cls.component_count)}__"
34
34
  return name
vtlengine/__init__.py CHANGED
@@ -2,4 +2,4 @@ from vtlengine.API import generate_sdmx, prettify, run, run_sdmx, semantic_analy
2
2
 
3
3
  __all__ = ["semantic_analysis", "run", "generate_sdmx", "run_sdmx", "prettify"]
4
4
 
5
- __version__ = "1.2.0"
5
+ __version__ = "1.2.1rc1"
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: vtlengine
3
- Version: 1.2.0
3
+ Version: 1.2.1rc1
4
4
  Summary: Run and Validate VTL Scripts
5
5
  License: AGPL-3.0
6
6
  Keywords: vtl,sdmx,vtlengine,Validation and Transformation Language
@@ -26,19 +26,19 @@ vtlengine/DataTypes/TimeHandling.py,sha256=CYnC0sb1qbRjTnCSsA3wgez7QftOzrXHxbuZX
26
26
  vtlengine/DataTypes/__init__.py,sha256=LYXrde68bYm7MLeMLmr4haeOTSE4Fnpq9G2Ewy7DiaU,23084
27
27
  vtlengine/Exceptions/__init__.py,sha256=rSSskV_qCBFzg_W67Q1QBAL7Lnq88D7yi2BDYo1hytw,4727
28
28
  vtlengine/Exceptions/messages.py,sha256=h2RHfgolbNsYXO39FXT3NTe2RwG-1AK5NL9k6utPtCA,19658
29
- vtlengine/Interpreter/__init__.py,sha256=PKFBU6HW6_tIoycZU49GexxNbK-_CNWlQ7BFKAiy2Z8,85030
29
+ vtlengine/Interpreter/__init__.py,sha256=aO7CGEzFgg0W6kkXFYHzogVxsiVI0l9pJ3wH8m1WuPE,85502
30
30
  vtlengine/Model/__init__.py,sha256=xWrwhdUOj8Y-5x38zP5XnmFPw8IkBVBBG2bPsUBGLA8,15869
31
- vtlengine/Operators/Aggregation.py,sha256=aB64ZcH3oR0WEYMFlwkML2CEc3pggKoFpIb_CoOCgJM,12002
31
+ vtlengine/Operators/Aggregation.py,sha256=BI4cHzdWWtxEHisg1cr87twg8gvc1MHfR05JsiXpo6M,11956
32
32
  vtlengine/Operators/Analytic.py,sha256=adm8y4mTeen4iVMsQvcvxM9U5f6Xj9UNjdCQI2OBINE,12934
33
33
  vtlengine/Operators/Assignment.py,sha256=xyJgGPoFYbq6mzX06gz7Q7L8jXJxpUkgzdY3Lrne2hw,793
34
34
  vtlengine/Operators/Boolean.py,sha256=3U5lHkxW5d7QQdGDNxXeXqejlPfFrXKG8_TqknrC8Ls,2856
35
35
  vtlengine/Operators/CastOperator.py,sha256=pXTSs0UYBeR5hS3J2HWUyaHmoZoifl2EFch6ol_Taok,17115
36
36
  vtlengine/Operators/Clause.py,sha256=Lu6zjcUBkShN6kQmjEZu_7ytaFGwfH-yB4ROoCSkLGI,15505
37
37
  vtlengine/Operators/Comparison.py,sha256=CRMvs9qXVXUW32pxAnCua8b7ZHpJy0-Egvs691ekOCk,17403
38
- vtlengine/Operators/Conditional.py,sha256=NDJa3yMdcfk8ninE1skNa5JBxLgTIKAKOeBDxlzm3oo,20258
38
+ vtlengine/Operators/Conditional.py,sha256=lu0S06GtBzVR_pbq9_QyAGeUC0Xcawag-3wBh5W93Xc,20340
39
39
  vtlengine/Operators/General.py,sha256=ltRK8Sw686sb4rC5ji2OX-GYVxaK_PpL0Lev8P5OFHI,6828
40
40
  vtlengine/Operators/HROperators.py,sha256=YybwD70906AA00c0k4IP6sjeta0pg7hqb2EUVsFqdmA,8979
41
- vtlengine/Operators/Join.py,sha256=WhHnepjNrQiYC3keo5uuJ5RhcMxklccyKaOUOH2G5Zc,18229
41
+ vtlengine/Operators/Join.py,sha256=lYmC_jGlJ4RRmn2vplB13Ysrxgv6O8sNFEHQYZzun5s,18393
42
42
  vtlengine/Operators/Numeric.py,sha256=icYTWzEsw6VQFLYc5Wucgr8961d8ZwTFx_wfZ8Wp9Co,12083
43
43
  vtlengine/Operators/RoleSetter.py,sha256=mHZIdcHC3wflj81ekLbioDG1f8yHZXYDQFymV-KnyXA,2274
44
44
  vtlengine/Operators/Set.py,sha256=f1uLeY4XZF0cWEwpXRB_CczgbXr6s33DYPuFt39HlEg,7084
@@ -46,10 +46,10 @@ vtlengine/Operators/String.py,sha256=ghWtYl6oUEAAzynY1a9Hg4yqRA9Sa7uk2B6iF9uuSqQ
46
46
  vtlengine/Operators/Time.py,sha256=ESn6ldPg73bdZxOXZYJuIwCLDQnXDGTqR1y7ckQmV1M,43025
47
47
  vtlengine/Operators/Validation.py,sha256=tnHRZ7o0Z_AE1Bb2DtRVP6pGGUtSs5KVwNSEJxzzGnk,10162
48
48
  vtlengine/Operators/__init__.py,sha256=N1zi9RFC_l0qggRm5IPLOkPFtFS4CGAg-r1taHOrbTI,37667
49
- vtlengine/Utils/__Virtual_Assets.py,sha256=t6cAikOjDVHilORXD6pzC3_twrl6BOutkSaaipQqEwU,856
49
+ vtlengine/Utils/__Virtual_Assets.py,sha256=0jPXysZrBr0hYVzqFoyg9La8ZcZoZ01Ql245X5vrth4,862
50
50
  vtlengine/Utils/__init__.py,sha256=zhGPJA8MjHmtEEwMS4CxEFYL0tk2L5F0YPn7bitdRzM,8954
51
51
  vtlengine/__extras_check.py,sha256=Wr-lxGZhXJZEacVV5cUkvKt7XM-mry0kYAe3VxNrVcY,614
52
- vtlengine/__init__.py,sha256=H1x4pfJSReVNIm472bKjZUbUf3Z0eusLQ4j-T9S5L2E,188
52
+ vtlengine/__init__.py,sha256=l8c8MEFiqOOnoRwhFkch3oZAxLsyNg2vIj0c96LYZmU,191
53
53
  vtlengine/files/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
54
54
  vtlengine/files/output/__init__.py,sha256=4tmf-p1Y1u5Ohrwt3clQA-FMGaijKI3HC_iwn3H9J8c,1250
55
55
  vtlengine/files/output/_time_period_representation.py,sha256=D5XCSXyEuX_aBzTvBV3sZxACcgwXz2Uu_YH3loMP8q0,1610
@@ -57,7 +57,7 @@ vtlengine/files/parser/__init__.py,sha256=JamEIWI0pFZxT0sKYE6Fii8H2JQcsFn4Nf3T0O
57
57
  vtlengine/files/parser/_rfc_dialect.py,sha256=Y8kAYBxH_t9AieN_tYg7QRh5A4DgvabKarx9Ko3QeCQ,462
58
58
  vtlengine/files/parser/_time_checking.py,sha256=UAC_Pv-eQJKrhgTguWb--xfqMMs6quyMeiAkGBt_vgI,4725
59
59
  vtlengine/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
60
- vtlengine-1.2.0.dist-info/LICENSE.md,sha256=2xqHuoHohba7gpcZZKtOICRjzeKsQANXG8WoV9V35KM,33893
61
- vtlengine-1.2.0.dist-info/METADATA,sha256=L-6dsHpZwMO9A7T3UoSvXpU4NEEbgyvdZjneTzNGD1s,4132
62
- vtlengine-1.2.0.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
- vtlengine-1.2.0.dist-info/RECORD,,
60
+ vtlengine-1.2.1rc1.dist-info/LICENSE.md,sha256=2xqHuoHohba7gpcZZKtOICRjzeKsQANXG8WoV9V35KM,33893
61
+ vtlengine-1.2.1rc1.dist-info/METADATA,sha256=OgvVzj7n35H2Z9qPn3vzXcUXAPiFcYUzzACX7PA053A,4135
62
+ vtlengine-1.2.1rc1.dist-info/WHEEL,sha256=b4K_helf-jlQoXBBETfwnf4B04YC67LOev0jo4fX5m8,88
63
+ vtlengine-1.2.1rc1.dist-info/RECORD,,