Skip to content

Commit b1944ce

Browse files
- All working locally with repeats.
1 parent f9658c8 commit b1944ce

File tree

4 files changed

+51
-19
lines changed

4 files changed

+51
-19
lines changed

internal/stackql/drm/drm_cfg.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -558,7 +558,7 @@ func (dc *staticDRMConfig) GenerateInsertDML(
558558
}
559559
priorParameters := tabAnnotated.GetParameters()
560560
// TODO: fix this for dependent table where dependency has `IN` clause!!!
561-
transformedParams, paramErr := util.TransformSQLRawParameters(priorParameters, true)
561+
transformedParams, paramErr := util.TransformSQLRawParameters(priorParameters, false)
562562
if paramErr != nil {
563563
return nil, paramErr
564564
}

internal/stackql/router/parameter_router.go

Lines changed: 34 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -250,11 +250,12 @@ func (sp *standardParamSplitter) assembleSplitParams(
250250
combinations := combinationComposerObj.getCombinations()
251251
_, isAnythingSplit := len(combinations), combinationComposerObj.getIsAnythingSplit()
252252
for _, paramCombination := range combinations {
253+
com := paramCombination
253254
splitAnnotationCtx := taxonomy.NewStaticStandardAnnotationCtx(
254255
rawAnnotationCtx.GetSchema(),
255256
rawAnnotationCtx.GetHIDs(),
256257
rawAnnotationCtx.GetTableMeta().Clone(),
257-
paramCombination,
258+
com,
258259
)
259260
sp.splitAnnotationContextMap.Put(rawAnnotationCtx, splitAnnotationCtx)
260261
// TODO: this has gotta replace the original and also be duplicated
@@ -310,6 +311,8 @@ func (pr *standardParameterRouter) GetOnConditionDataFlows() (dataflow.Collectio
310311
}
311312
var dependencyTable sqlparser.TableExpr
312313
var dependencies []taxonomy.AnnotationCtx
314+
var destinations []taxonomy.AnnotationCtx
315+
313316
var destColumn *sqlparser.ColName
314317
var srcExpr sqlparser.Expr
315318
switch l := k.Left.(type) {
@@ -329,6 +332,12 @@ func (pr *standardParameterRouter) GetOnConditionDataFlows() (dataflow.Collectio
329332
} else {
330333
dependencies = append(dependencies, lhr)
331334
}
335+
splitDestinations, isDestinationSplit := splitAnnotationContextMap.Get(destHierarchy)
336+
if isDestinationSplit {
337+
destinations = append(destinations, splitDestinations...)
338+
} else {
339+
destinations = append(destinations, destHierarchy)
340+
}
332341
dependencyTable = candidateTable
333342
srcExpr = k.Left
334343
}
@@ -343,6 +352,12 @@ func (pr *standardParameterRouter) GetOnConditionDataFlows() (dataflow.Collectio
343352
} else {
344353
dependencies = append(dependencies, annCtx)
345354
}
355+
splitDestinations, isDestinationSplit := splitAnnotationContextMap.Get(destHierarchy)
356+
if isDestinationSplit {
357+
destinations = append(destinations, splitDestinations...)
358+
} else {
359+
destinations = append(destinations, destHierarchy)
360+
}
346361
dependencyTable = te
347362
}
348363
switch r := k.Right.(type) {
@@ -368,6 +383,12 @@ func (pr *standardParameterRouter) GetOnConditionDataFlows() (dataflow.Collectio
368383
} else {
369384
dependencies = append(dependencies, rhr)
370385
}
386+
splitDestinations, isDestinationSplit := splitAnnotationContextMap.Get(destHierarchy)
387+
if isDestinationSplit {
388+
destinations = append(destinations, splitDestinations...)
389+
} else {
390+
destinations = append(destinations, destHierarchy)
391+
}
371392
dependencyTable = candidateTable
372393
}
373394
case *sqlparser.FuncExpr:
@@ -381,16 +402,25 @@ func (pr *standardParameterRouter) GetOnConditionDataFlows() (dataflow.Collectio
381402
} else {
382403
dependencies = append(dependencies, annCtx)
383404
}
405+
splitDestinations, isDestinationSplit := splitAnnotationContextMap.Get(destHierarchy)
406+
if isDestinationSplit {
407+
destinations = append(destinations, splitDestinations...)
408+
} else {
409+
destinations = append(destinations, destHierarchy)
410+
}
384411
dependencyTable = te
385412
}
386413
if !selfTableCited {
387414
return nil, fmt.Errorf("table join ON comparison '%s' referencing incomplete", sqlparser.String(k))
388415
}
389-
// rv[dependencies] = destHierarchy
390416

391-
for _, dependency := range dependencies {
417+
for i, dependency := range dependencies {
392418
srcVertex := rv.UpsertStandardDataFlowVertex(dependency, dependencyTable)
393-
destVertex := rv.UpsertStandardDataFlowVertex(destHierarchy, destinationTable)
419+
destination := destHierarchy
420+
if i < len(destinations) {
421+
destination = destinations[i]
422+
}
423+
destVertex := rv.UpsertStandardDataFlowVertex(destination, destinationTable)
394424

395425
err := rv.AddOrUpdateEdge(
396426
srcVertex,

test/robot/functional/stackql_mocked_from_cmd_line.robot

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7382,6 +7382,6 @@ View Tuple Replacement Working As Exemplified by AWS EC2 Instances List and Deta
73827382
... ${inputStr}
73837383
... ${outputStr}
73847384
... ${EMPTY}
7385-
... stackql_approot=${TEST_TMP_EXEC_APP_ROOT}
73867385
... stdout=${CURDIR}/tmp/View-Tuple-Replacement-Working-As-Exemplified-by-AWS-EC2-Instances-List-and-Detail.tmp
73877386
... stderr=${CURDIR}/tmp/View-Tuple-Replacement-Working-As-Exemplified-by-AWS-EC2-Instances-List-and-Detail-stderr.tmp
7387+
... repeat_count=20

test/robot/lib/StackQLInterfaces.py

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -822,19 +822,21 @@ def should_stackql_exec_inline_equal_both_streams(
822822
*args,
823823
**cfg
824824
):
825-
result = self._run_stackql_exec_command(
826-
stackql_exe,
827-
okta_secret_str,
828-
github_secret_str,
829-
k8s_secret_str,
830-
registry_cfg,
831-
auth_cfg_str,
832-
sql_backend_cfg_str,
833-
query,
834-
*args,
835-
**cfg
836-
)
837-
return self._verify_both_streams(result, expected_output, expected_stderr_output)
825+
repeat_count = int(cfg.pop('repeat_count', 1))
826+
for _ in range(repeat_count):
827+
result = self._run_stackql_exec_command(
828+
stackql_exe,
829+
okta_secret_str,
830+
github_secret_str,
831+
k8s_secret_str,
832+
registry_cfg,
833+
auth_cfg_str,
834+
sql_backend_cfg_str,
835+
query,
836+
*args,
837+
**cfg
838+
)
839+
return self._verify_both_streams(result, expected_output, expected_stderr_output)
838840

839841

840842
@keyword

0 commit comments

Comments
 (0)