Adding splat[] short hand to explode,collect,flatten,groupby,path,pivot,select and more

This commit is contained in:
Mike Farah
2024-06-16 10:48:01 +10:00
parent f1964dece0
commit d58870b056
14 changed files with 146 additions and 13 deletions
+22
View File
@@ -14,6 +14,17 @@ var flattenOperatorScenarios = []expressionScenario{
"D0, P[], (!!seq)::[1, 2, 3]\n",
},
},
{
description: "Flatten splat",
skipDoc: true,
document: `[1, [2], [[3]]]`,
expression: `flatten[]`,
expected: []string{
"D0, P[0], (!!int)::1\n",
"D0, P[0], (!!int)::2\n",
"D0, P[0], (!!int)::3\n",
},
},
{
description: "Flatten with depth of one",
document: `[1, [2], [[3]]]`,
@@ -22,6 +33,17 @@ var flattenOperatorScenarios = []expressionScenario{
"D0, P[], (!!seq)::[1, 2, [3]]\n",
},
},
{
description: "Flatten with depth and splat",
skipDoc: true,
document: `[1, [2], [[3]]]`,
expression: `flatten(1)[]`,
expected: []string{
"D0, P[0], (!!int)::1\n",
"D0, P[0], (!!int)::2\n",
"D0, P[0], (!!seq)::[3]\n",
},
},
{
description: "Flatten empty array",
document: `[[]]`,