Skip to content

Commit

Permalink
Fix router to handle dynamic column specifications (finos#2381)
Browse files Browse the repository at this point in the history
  • Loading branch information
aziemchawdhary-gs authored Oct 18, 2023
1 parent dc5064b commit bf16495
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ function meta::pure::router::routing::processColSpecParams(fe:FunctionExpression
]))->cast(@ValueSpecification);

let nfe = ^$fe(parametersValues = $parametersValues);
let colSpec = $nfe->reactivate($inScopeVars)->evaluateAndDeactivate()->cast(@ColumnSpecification<Any>)->toOne();
$nfe->reactivate($inScopeVars)->evaluateAndDeactivate()->cast(@ColumnSpecification<Any>);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,22 @@ function <<test.Test>> meta::relational::tests::projection::simple::testAllOneSi
assertEquals('select "root".FIRSTNAME as "firstName" from personTable as "root"', $result->sqlRemoveFormatting());
}

function meta::relational::tests::projection::simple::getCols():ColumnSpecification<Person>[*]
{
[
col(x : Person[1] | $x.firstName, 'firstName'),
col(x : Person[1] | $x.lastName, 'lastName')
];
}

function <<test.Test>> meta::relational::tests::projection::simple::testAllOneSimplePropertyWithColsFromFunction():Boolean[1]
{
let result = execute(|Person.all()->project(meta::relational::tests::projection::simple::getCols()), simpleRelationalMapping, testRuntime(), meta::relational::extension::relationalExtensions());
assertSize($result.values.rows, 7 );
assertEquals('Allen,Anthony,David,Fabrice,Harris,Hill,Hill,John,John,Johnson,Oliver,Peter,Roberts,Smith', $result.values.rows->map(r|$r.values)->sort()->makeString(','));
assertEquals('select "root".FIRSTNAME as "firstName", "root".LASTNAME as "lastName" from personTable as "root"', $result->sqlRemoveFormatting());
}

function <<test.Test>> meta::relational::tests::projection::simple::testAllOneSimplePropertyUsingVariable():Boolean[1]
{
let p = [#/Person/firstName#];
Expand Down

0 comments on commit bf16495

Please sign in to comment.