diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/tdsToRelation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/tdsToRelation.pure index a3e86a27fca..5af8f0d6fd6 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/tdsToRelation.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/tdsToRelation.pure @@ -70,13 +70,12 @@ function meta::pure::tds::toRelation::transform(a:AppliedFunction[1], extensions appliedFunction(project_C_MANY__FuncColSpecArray_1__Relation_1_, [$a.parameters->at(0)->transform($extensions), $columns]); ), - //TODO activate when relation inference is fixed on project - // pair(project_TabularDataSet_1__ColumnSpecification_MANY__TabularDataSet_1_->cast(@Function), - // | - // let columns = $a.parameters->at(1)->colsToColSpecArrayInstance($extensions); + pair(project_TabularDataSet_1__ColumnSpecification_MANY__TabularDataSet_1_->cast(@Function), + | + let columns = $a.parameters->at(1)->colsToColSpecArrayInstance($extensions); - // appliedFunction(project_Relation_1__FuncColSpecArray_1__Relation_1_, [$a.parameters->at(0)->transform($extensions), $columns]); - // ), + appliedFunction(project_Relation_1__FuncColSpecArray_1__Relation_1_, [$a.parameters->at(0)->transform($extensions), $columns]); + ), pair(groupBy_K_MANY__Function_MANY__AggregateValue_MANY__String_MANY__TabularDataSet_1_->cast(@Function), | let groupByColumns = $a.parameters->at(1)->fromCollection()->cast(@Lambda); diff --git a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/testTdsToRelation.pure b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/testTdsToRelation.pure index 5eae6c1c5ab..89ca7d87f53 100644 --- a/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/testTdsToRelation.pure +++ b/legend-engine-core/legend-engine-core-pure/legend-engine-pure-code-compiled-core/src/main/resources/core/pure/tds/relation/testTdsToRelation.pure @@ -69,38 +69,37 @@ function <> meta::pure::tds::toRelation::testProjectSingle():Boolean[ ); } -//TODO activate when relation inference is fixed on project -// function <> meta::pure::tds::toRelation::testTDSProjectSingle():Boolean[1] -// { -// test( -// {| TestClass.all() -// ->project(col(x | $x.string, 'str')) -// ->project(col(x:TDSRow[1] | $x.getString('str')->toOne() + 'abc', 'newCol'))}, -// {| TestClass.all() -// ->project(~[str: x | $x.string]) -// ->project(~[newCol : x | $x.str->toOne() + 'abc'])} -// ); -// } - -// function <> meta::pure::tds::toRelation::testTDSProjectMulti():Boolean[1] -// { -// test( -// {| TestClass.all() -// ->project([col(x | $x.string, 'str'), col(x | $x.integer, 'int')]) -// ->project([ -// col(x:TDSRow[1] | $x.getString('str')->toOne() + 'abc', 'newCol'), -// col(x:TDSRow[1] | $x.getString('str')->toOne() + 'def', 'newCol2') -// ])}, -// {| TestClass.all() -// ->project(~[str: x | $x.string, int: x | $x.integer]) -// ->project(~[ -// newCol : x | $x.str->toOne() + 'abc', -// newCol2 : x | $x.str->toOne() + 'def' -// ]) -// } -// ); -// } +function <> meta::pure::tds::toRelation::testTDSProjectSingle():Boolean[1] +{ + test( + {| TestClass.all() + ->project(col(x | $x.string, 'str')) + ->project(col(x:TDSRow[1] | $x.getString('str')->toOne() + 'abc', 'newCol'))}, + {| TestClass.all() + ->project(~[str: x | $x.string]) + ->project(~[newCol : x | $x.str->toOne() + 'abc'])} + ); +} + +function <> meta::pure::tds::toRelation::testTDSProjectMulti():Boolean[1] +{ + test( + {| TestClass.all() + ->project([col(x | $x.string, 'str'), col(x | $x.integer, 'int')]) + ->project([ + col(x:TDSRow[1] | $x.getString('str')->toOne() + 'abc', 'newCol'), + col(x:TDSRow[1] | $x.getString('str')->toOne() + 'def', 'newCol2') + ])}, + {| TestClass.all() + ->project(~[str: x | $x.string, int: x | $x.integer]) + ->project(~[ + newCol : x | $x.str->toOne() + 'abc', + newCol2 : x | $x.str->toOne() + 'def' + ]) + } + ); +} function <> meta::pure::tds::toRelation::testExtendSingle():Boolean[1] {