sws-spark-dissemination-helper 0.0.192__py3-none-any.whl → 0.0.193__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.
- sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py +39 -7
- {sws_spark_dissemination_helper-0.0.192.dist-info → sws_spark_dissemination_helper-0.0.193.dist-info}/METADATA +1 -1
- {sws_spark_dissemination_helper-0.0.192.dist-info → sws_spark_dissemination_helper-0.0.193.dist-info}/RECORD +5 -5
- {sws_spark_dissemination_helper-0.0.192.dist-info → sws_spark_dissemination_helper-0.0.193.dist-info}/WHEEL +0 -0
- {sws_spark_dissemination_helper-0.0.192.dist-info → sws_spark_dissemination_helper-0.0.193.dist-info}/licenses/LICENSE +0 -0
|
@@ -169,11 +169,15 @@ class SWSGoldIcebergSparkHelper:
|
|
|
169
169
|
display_decimals = int(rule["display_decimals"])
|
|
170
170
|
|
|
171
171
|
# Count actual decimal places in the current value
|
|
172
|
-
#
|
|
172
|
+
# Handle both regular decimals and scientific notation
|
|
173
|
+
# Convert scientific notation to decimal format first
|
|
174
|
+
value_str_normalized = F.when(
|
|
175
|
+
F.col(value_column).cast("string").rlike("[eE]"),
|
|
176
|
+
F.format_number(F.col(value_column).cast("double"), 20),
|
|
177
|
+
).otherwise(F.col(value_column).cast("string"))
|
|
178
|
+
|
|
173
179
|
actual_decimals = F.length(
|
|
174
|
-
F.regexp_extract(
|
|
175
|
-
F.col(value_column).cast("string"), DECIMAL_PLACES_REGEX, 1
|
|
176
|
-
)
|
|
180
|
+
F.regexp_extract(value_str_normalized, DECIMAL_PLACES_REGEX, 1)
|
|
177
181
|
)
|
|
178
182
|
|
|
179
183
|
# Add decimals condition
|
|
@@ -237,10 +241,14 @@ class SWSGoldIcebergSparkHelper:
|
|
|
237
241
|
)
|
|
238
242
|
|
|
239
243
|
# Only round if actual decimals >= target decimals, otherwise keep original
|
|
244
|
+
# Handle both regular decimals and scientific notation for default case
|
|
245
|
+
value_str_normalized_default = F.when(
|
|
246
|
+
F.col(value_column).cast("string").rlike("[eE]"),
|
|
247
|
+
F.format_number(F.col(value_column).cast("double"), 20),
|
|
248
|
+
).otherwise(F.col(value_column).cast("string"))
|
|
249
|
+
|
|
240
250
|
actual_decimals_default = F.length(
|
|
241
|
-
F.regexp_extract(
|
|
242
|
-
F.col(value_column).cast("string"), DECIMAL_PLACES_REGEX, 1
|
|
243
|
-
)
|
|
251
|
+
F.regexp_extract(value_str_normalized_default, DECIMAL_PLACES_REGEX, 1)
|
|
244
252
|
)
|
|
245
253
|
default_rounded = F.when(
|
|
246
254
|
actual_decimals_default >= lit(default_decimals), default_rounded
|
|
@@ -869,3 +877,27 @@ frozenset({"1", "2", "6", "7", "5", "8", "0", "4", "3", "9"})
|
|
|
869
877
|
frozenset({"1", "2", "6", "7", "5", "8", "0", "4", "3", "9"})
|
|
870
878
|
1
|
|
871
879
|
1
|
|
880
|
+
1
|
|
881
|
+
frozenset({"2", "4", "5", "7", "9", "3", "1", "0", "6", "8"})
|
|
882
|
+
1
|
|
883
|
+
1
|
|
884
|
+
2
|
|
885
|
+
frozenset({"2", "4", "5", "7", "9", "3", "1", "0", "6", "8"})
|
|
886
|
+
2
|
|
887
|
+
1
|
|
888
|
+
1
|
|
889
|
+
frozenset({"2", "4", "5", "7", "9", "3", "1", "0", "6", "8"})
|
|
890
|
+
1
|
|
891
|
+
1
|
|
892
|
+
2
|
|
893
|
+
frozenset({"2", "4", "5", "7", "9", "3", "1", "0", "6", "8"})
|
|
894
|
+
2
|
|
895
|
+
1
|
|
896
|
+
1
|
|
897
|
+
frozenset({"2", "4", "5", "7", "9", "3", "1", "0", "6", "8"})
|
|
898
|
+
1
|
|
899
|
+
1
|
|
900
|
+
1
|
|
901
|
+
frozenset({'2', '4', '5', '7', '9', '3', '1', '0', '6', '8'})
|
|
902
|
+
1
|
|
903
|
+
1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: sws-spark-dissemination-helper
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.193
|
|
4
4
|
Summary: A Python helper package providing streamlined Spark functions for efficient data dissemination processes
|
|
5
5
|
Project-URL: Repository, https://github.com/un-fao/fao-sws-it-python-spark-dissemination-helper
|
|
6
6
|
Author-email: Daniele Mansillo <danielemansillo@gmail.com>
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
sws_spark_dissemination_helper/SWSBronzeIcebergSparkHelper.py,sha256=N0eQ2LXtpPeZQCWYi85sMLmpXRzLA2erECiba8tqOAY,29595
|
|
2
2
|
sws_spark_dissemination_helper/SWSDatatablesExportHelper.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
3
3
|
sws_spark_dissemination_helper/SWSEasyIcebergSparkHelper.py,sha256=csqKyYglBkJSBvEkEa1_keHarZZAIJHaV0d64gGJy98,26379
|
|
4
|
-
sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py,sha256=
|
|
4
|
+
sws_spark_dissemination_helper/SWSGoldIcebergSparkHelper.py,sha256=0LonVBX39-cEzo7tul06YX6G70BVo7zDE_uA2Lu-4Cc,33441
|
|
5
5
|
sws_spark_dissemination_helper/SWSPostgresSparkReader.py,sha256=5do-Cz2_GAEwNxPWRnnITjADMX8Wgi3aj_ynpQCUNmI,18467
|
|
6
6
|
sws_spark_dissemination_helper/SWSSilverIcebergSparkHelper.py,sha256=PGZPq_oNKRGOseYGuNujbcS8y-WuLmoDMN95faq0Css,26359
|
|
7
7
|
sws_spark_dissemination_helper/__init__.py,sha256=42TPbk7KxAud_qY3Sr_F4F7VjyofUlxEJkUXAFQsjRo,327
|
|
8
8
|
sws_spark_dissemination_helper/constants.py,sha256=MzuC7pqsXF89r-FK7hhmWaZSk5x3GB_YPVSfuK3NYVY,14056
|
|
9
9
|
sws_spark_dissemination_helper/utils.py,sha256=Ge8zXsUIcvFihALDNLF5kCu_tAdRQUE04xE6Yn9xQF4,22008
|
|
10
|
-
sws_spark_dissemination_helper-0.0.
|
|
11
|
-
sws_spark_dissemination_helper-0.0.
|
|
12
|
-
sws_spark_dissemination_helper-0.0.
|
|
13
|
-
sws_spark_dissemination_helper-0.0.
|
|
10
|
+
sws_spark_dissemination_helper-0.0.193.dist-info/METADATA,sha256=ZRxTBrv7G6LjvMrRpDNDEdAxCPIW0hjCmLIvZrE-hY0,2822
|
|
11
|
+
sws_spark_dissemination_helper-0.0.193.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
|
|
12
|
+
sws_spark_dissemination_helper-0.0.193.dist-info/licenses/LICENSE,sha256=zFzeb_j_6pXEHwH8Z0OpIkKFJk7vmhZjdem-K0d4zU4,1073
|
|
13
|
+
sws_spark_dissemination_helper-0.0.193.dist-info/RECORD,,
|
|
File without changes
|