@platforma-sdk/workflow-tengo 5.5.7 → 5.5.9

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.
Files changed (45) hide show
  1. package/dist/tengo/lib/pframes.xsv-import-pt.lib.tengo +9 -10
  2. package/dist/tengo/lib/pt.lib.tengo +55 -20
  3. package/dist/tengo/lib/pt.util.lib.tengo +9 -6
  4. package/dist/tengo/tpl/annotations.compute.plj.gz +0 -0
  5. package/dist/tengo/tpl/anonymize.deanonymize.plj.gz +0 -0
  6. package/dist/tengo/tpl/anonymize.impl.plj.gz +0 -0
  7. package/dist/tengo/tpl/check_network.create_workdir_from_storage.plj.gz +0 -0
  8. package/dist/tengo/tpl/check_network.download_blob.plj.gz +0 -0
  9. package/dist/tengo/tpl/check_network.run_hello_world.plj.gz +0 -0
  10. package/dist/tengo/tpl/check_network.run_hello_world_py.plj.gz +0 -0
  11. package/dist/tengo/tpl/check_network.upload_blob.plj.gz +0 -0
  12. package/dist/tengo/tpl/check_network.upload_template.plj.gz +0 -0
  13. package/dist/tengo/tpl/check_network.workdir_type_name_extractor.plj.gz +0 -0
  14. package/dist/tengo/tpl/exec.R.create-renv.plj.gz +0 -0
  15. package/dist/tengo/tpl/exec.conda.create-env.plj.gz +0 -0
  16. package/dist/tengo/tpl/exec.delayed-compute-allocation.impl.plj.gz +0 -0
  17. package/dist/tengo/tpl/exec.exec-impl.plj.gz +0 -0
  18. package/dist/tengo/tpl/exec.exec.plj.gz +0 -0
  19. package/dist/tengo/tpl/exec.load-software.impl.plj.gz +0 -0
  20. package/dist/tengo/tpl/exec.monetization_info.plj.gz +0 -0
  21. package/dist/tengo/tpl/exec.monetization_to_json.plj.gz +0 -0
  22. package/dist/tengo/tpl/exec.python.create-venv.plj.gz +0 -0
  23. package/dist/tengo/tpl/exec.python.install-deps.plj.gz +0 -0
  24. package/dist/tengo/tpl/exec.python.venv-bin-path.plj.gz +0 -0
  25. package/dist/tengo/tpl/ll.get-field.plj.gz +0 -0
  26. package/dist/tengo/tpl/pframes.export-multiple-pcolumns.plj.gz +0 -0
  27. package/dist/tengo/tpl/pframes.export-parquet-pcolumn-chunk.plj.gz +0 -0
  28. package/dist/tengo/tpl/pframes.export-pframe-for-ui.plj.gz +0 -0
  29. package/dist/tengo/tpl/pframes.export-pframe.plj.gz +0 -0
  30. package/dist/tengo/tpl/pframes.export-single-pcolumn.plj.gz +0 -0
  31. package/dist/tengo/tpl/pframes.import-dir.plj.gz +0 -0
  32. package/dist/tengo/tpl/pframes.parse-to-json.plj.gz +0 -0
  33. package/dist/tengo/tpl/pframes.process-pcolumn-data.plj.gz +0 -0
  34. package/dist/tengo/tpl/pframes.remove-nulls.plj.gz +0 -0
  35. package/dist/tengo/tpl/pframes.slice-data.plj.gz +0 -0
  36. package/dist/tengo/tpl/pframes.xsv-export-pframe.plj.gz +0 -0
  37. package/dist/tengo/tpl/pframes.xsv-import-if-not-null.plj.gz +0 -0
  38. package/dist/tengo/tpl/pframes.xsv-import-map.plj.gz +0 -0
  39. package/dist/tengo/tpl/pt.import-dir.plj.gz +0 -0
  40. package/dist/tengo/tpl/pt.workflow-run.plj.gz +0 -0
  41. package/dist/tengo/tpl/waiter.waiter.plj.gz +0 -0
  42. package/dist/tengo/tpl/workdir.save.plj.gz +0 -0
  43. package/dist/tengo/tpl/workflow.build-ctx.plj.gz +0 -0
  44. package/dist/tengo/tpl/workflow.query-anchored.plj.gz +0 -0
  45. package/package.json +3 -3
@@ -202,9 +202,9 @@ importFileParquet := func(xsvFile, xsvType, spec, ops) {
202
202
  if ops.dataOnly {
203
203
  pfd := smart.mapBuilder()
204
204
  for col in spec.columns {
205
- id := util.xsvColumnId(col)
206
- field := pf.getFutureInputField(col.column + ".data")
207
- pfd.createInputField(id).set(field)
205
+ colId := util.xsvColumnId(col)
206
+ colData := pf.getFutureInputField(col.column + ".data")
207
+ pfd.createInputField(colId).set(colData)
208
208
  }
209
209
  return pfd.lockAndBuild()
210
210
  }
@@ -212,18 +212,17 @@ importFileParquet := func(xsvFile, xsvType, spec, ops) {
212
212
  result := {}
213
213
  axesSpec := slices.map(spec.axes, func(ax) { return ax.spec })
214
214
  for col in spec.columns {
215
+ colId := util.xsvColumnId(col)
215
216
  colSpec := getColumnSpec(axesSpec, col)
216
- data := pf.getFutureInputField(col.column + ".data")
217
-
218
- id := util.xsvColumnId(col)
217
+ colData := pf.getFutureInputField(col.column + ".data")
219
218
  if ops.splitDataAndSpec {
220
- result[id] = {
219
+ result[colId] = {
221
220
  spec: colSpec,
222
- data: data
221
+ data: colData
223
222
  }
224
223
  } else {
225
- result[id + ".spec"] = colSpec
226
- result[id + ".data"] = data
224
+ result[colId + ".spec"] = colSpec
225
+ result[colId + ".data"] = colData
227
226
  }
228
227
  }
229
228
  return result
@@ -305,15 +305,32 @@ workflow := func() {
305
305
 
306
306
  inFiles := []
307
307
 
308
+
309
+
310
+
311
+
312
+
313
+
314
+
315
+
316
+
308
317
  inFrames := {}
309
318
 
310
319
  outFiles := []
311
320
 
312
321
  outContentFiles := []
313
322
 
314
- outFramesSpecs := {}
315
323
 
316
- outFramesRename := {}
324
+
325
+
326
+
327
+
328
+
329
+
330
+
331
+
332
+
333
+ outFramesInfo := {}
317
334
 
318
335
  anonymousFilesCounter := 0
319
336
  anonymousDFCounter := 0
@@ -710,14 +727,16 @@ workflow := func() {
710
727
  _saveFileContent: func(name) {
711
728
  outContentFiles = append(outContentFiles, name)
712
729
  },
713
- _saveFrameSpecs: func(name, rename, specs) {
730
+ _saveFrameInfo: func(name, rename, colInfo) {
714
731
  ll.assert(
715
- outFramesSpecs[name] == undefined,
732
+ outFramesInfo[name] == undefined,
716
733
  "frame with name '%s' already saved, please pick a different name",
717
734
  name
718
735
  )
719
- outFramesSpecs[name] = specs
720
- outFramesRename[name] = rename
736
+ outFramesInfo[name] = {
737
+ colInfo: colInfo,
738
+ rename: rename
739
+ }
721
740
  },
722
741
 
723
742
 
@@ -857,12 +876,9 @@ workflow := func() {
857
876
  }
858
877
 
859
878
  outFrames := {}
860
- for frameName, specsById in outFramesSpecs {
861
- columnIds := []
862
- for columnId, _ in specsById {
863
- columnIds = append(columnIds, columnId)
864
- }
865
- outFrames[outFramesRename[frameName]] = columnIds;
879
+ for _, frameInfo in outFramesInfo {
880
+ columnIds := maps.getKeys(frameInfo.colInfo)
881
+ outFrames[frameInfo.rename] = columnIds
866
882
  }
867
883
 
868
884
  inFramesDistilled := maps.mapValues(inFrames, func(frame) {
@@ -924,13 +940,13 @@ workflow := func() {
924
940
 
925
941
 
926
942
  getFrameDirect: func(frameName) {
927
- specs := outFramesSpecs[frameName]
928
- ll.assert(!is_undefined(specs), "saveFrameDirect was not called for frame '%s'", frameName)
943
+ frameInfo := outFramesInfo[frameName]
944
+ ll.assert(!is_undefined(frameInfo), "saveFrameDirect was not called for frame '%s'", frameName)
929
945
 
930
946
  pf := pframesBuilder.pFrameBuilder()
931
- for columnId, columnSpec in specs {
932
- columnData := ptResult.resolveOutput(["outFrames", outFramesRename[frameName], columnId])
933
- pf.add(columnId, columnSpec, columnData)
947
+ for columnId, columnInfo in frameInfo.colInfo {
948
+ columnData := ptResult.resolveOutput(["outFrames", frameInfo.rename, columnId])
949
+ pf.add(columnInfo.id, columnInfo.spec, columnData)
934
950
  }
935
951
  return pf.build()
936
952
  }
@@ -1258,12 +1274,31 @@ _newDataFrame = func(parentWorkflow, dfName) {
1258
1274
  ll.assert(len(frameName) > 0, "frameName must be a non-empty string")
1259
1275
  util.validateParamsForSaveFrameDirect(params)
1260
1276
 
1261
- specs := util.makeFrameSpecs(params)
1277
+ projection := []
1278
+ translation := {}
1279
+ columnCount := 0
1280
+ renameColumn := func(column) {
1281
+ columnCount += 1
1282
+ name := "col" + string(columnCount)
1283
+ translation[column] = name
1284
+ projection = append(projection, exp.col(column).alias(name))
1285
+ }
1286
+ for ax in params.axes {
1287
+ renameColumn(ax.column)
1288
+ }
1289
+ for col in params.columns {
1290
+ renameColumn(col.column)
1291
+ }
1292
+ df := self.select(projection...)
1293
+
1294
+ colInfo := util.makeFrameColumnInfo(params, translation)
1262
1295
  sequentialFrameName := parentWorkflow._newUniquePFrameName()
1263
- parentWorkflow._saveFrameSpecs(frameName, sequentialFrameName, specs)
1296
+ parentWorkflow._saveFrameInfo(frameName, sequentialFrameName, colInfo)
1264
1297
 
1265
- step := util.makeWriteFrameStep(sequentialFrameName, dfName, params)
1298
+ step := util.makeWriteFrameStep(sequentialFrameName, df._getDfName(), params, translation)
1266
1299
  parentWorkflow.addRawStep(step)
1300
+
1301
+ return self
1267
1302
  },
1268
1303
 
1269
1304
 
@@ -93,7 +93,7 @@ validateParamsForFrameFromColumnBundle := func(params) {
93
93
  validation.assertType(params, _FRAME_FROM_COLUMN_BUNDLE_PARAMS_SCHEMA, "Invalid params structure")
94
94
  }
95
95
 
96
- makeFrameSpecs := func(params) {
96
+ makeFrameColumnInfo := func(params, translation) {
97
97
  axes := []
98
98
  for entry in params.axes {
99
99
  spec := {
@@ -128,25 +128,28 @@ makeFrameSpecs := func(params) {
128
128
  if !is_undefined(entry.spec.parentAxes) && len(entry.spec.parentAxes) > 0 {
129
129
  spec.parentAxes = slices.sortUnique(entry.spec.parentAxes)
130
130
  }
131
- columns[entry.column] = spec
131
+ columns[translation[entry.column]] = {
132
+ id: entry.column,
133
+ spec: spec
134
+ }
132
135
  }
133
136
  return columns
134
137
  }
135
138
 
136
- makeWriteFrameStep := func(frameName, dfName, params) {
139
+ makeWriteFrameStep := func(frameName, dfName, params, translation) {
137
140
  step := {
138
141
  type: "write_frame",
139
142
  inputTable: dfName,
140
143
  frameName: frameName,
141
144
  axes: slices.map(params.axes, func(entry) {
142
145
  return {
143
- column: entry.column,
146
+ column: translation[entry.column],
144
147
  type: entry.spec.type
145
148
  }
146
149
  }),
147
150
  columns: slices.map(params.columns, func(entry) {
148
151
  return {
149
- column: entry.column,
152
+ column: translation[entry.column],
150
153
  type: entry.spec.valueType
151
154
  }
152
155
  }),
@@ -398,7 +401,7 @@ renameJoinColumns := func(request, rename) {
398
401
  export ll.toStrict({
399
402
  validateParamsForSaveFrameDirect: validateParamsForSaveFrameDirect,
400
403
  validateParamsForFrameFromColumnBundle: validateParamsForFrameFromColumnBundle,
401
- makeFrameSpecs: makeFrameSpecs,
404
+ makeFrameColumnInfo: makeFrameColumnInfo,
402
405
  makeWriteFrameStep: makeWriteFrameStep,
403
406
  makeFrameColumnRef: makeFrameColumnRef,
404
407
  renameJoinColumns: renameJoinColumns,
Binary file
Binary file
Binary file
Binary file
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@platforma-sdk/workflow-tengo",
3
- "version": "5.5.7",
3
+ "version": "5.5.9",
4
4
  "description": "Tengo SDK library",
5
5
  "type": "module",
6
6
  "types": "./dist/index.d.ts",
@@ -18,8 +18,8 @@
18
18
  "dependencies": {
19
19
  "@milaboratories/software-pframes-conv": "2.2.9",
20
20
  "@platforma-open/milaboratories.software-small-binaries": "^1.15.23",
21
- "@platforma-open/milaboratories.software-ptabler": "1.13.2",
22
- "@platforma-open/milaboratories.software-ptexter": "1.2.0"
21
+ "@platforma-open/milaboratories.software-ptexter": "1.2.0",
22
+ "@platforma-open/milaboratories.software-ptabler": "1.13.2"
23
23
  },
24
24
  "devDependencies": {
25
25
  "@platforma-sdk/tengo-builder": "2.3.3"