Skip to content

Commit

Permalink
update join processing for joins with N children (#3106)
Browse files Browse the repository at this point in the history
  • Loading branch information
AFine-gs authored Sep 19, 2024
1 parent 253bcf4 commit fe561d8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -125,3 +125,16 @@ function <<meta::pure::profiles::test.Test>> meta::analytics::lineage::tests::re


}

###Pure
import meta::analytics::lineage::*;
import meta::relational::tests::*;
import meta::relational::tests::model::simple::*;
function <<meta::pure::profiles::test.Test>> meta::analytics::lineage::tests::relational::testProjectWithIsolatedFilterMultiJoinTrees():Boolean[1]
{
let fn = { |Order.all()-> filter( p| $p.pnlContact->exists(l|$l.address.name == 'Main St' && $l.firm.legalName == 'Co' ))
->project([ f|$f.quantity ], ['quantity'])};
let lineage = computeLineage($fn,simpleRelationalMapping, meta::external::store::relational::tests::testRuntime(), meta::relational::extension::relationalExtensions());
assertSameElements(['Lambda', 'db_db', 'db_dbInc', 'tb_dbIncdefaultaddressTable', 'tb_dbIncdefaultfirmTable', 'tb_dbIncdefaultpersonTable', 'tb_dbdefaultaccountTable', 'tb_dbdefaultorderPnlTable', 'tb_dbdefaultorderTable', 'tb_dbdefaultsalesPersonTable'],$lineage.databaseLineage.nodes.data.id);

}
Original file line number Diff line number Diff line change
Expand Up @@ -725,12 +725,18 @@ function <<access.private>> meta::pure::lineage::scanRelations::extractSourceCol
if($reqTableAliasColumn->isEmpty() || $select.data->isEmpty(),
|[],
|let rootTree = $select.data->toOne();
let childTrees = $rootTree->children()->map(child | $child->extractLine());
let childTrees = $rootTree->children()->map(child | $child->extractJoinChildren());
let sourceOperation = $rootTree->concatenate($childTrees)->filter(tree | $tree.alias.name == $reqTableAliasColumn.alias.name).alias->toOne();
$reqTableAliasColumn->toOne()->extractSourceColumn($sourceOperation, $relationIdentifiers, $sourceTree);
);
}

function <<access.private>> meta::pure::lineage::scanRelations::extractJoinChildren(j:JoinTreeNode[1]):JoinTreeNode[*]
{
$j->concatenate(if($j->children()->isEmpty(),|[],|$j->children()->map(c|$c->extractJoinChildren())));
}


function <<access.private>> meta::pure::lineage::scanRelations::extractSourceRelation(sourceOperation:RelationalOperationElement[1], relationIdentifiers:String[*]):NamedRelation[1]
{
$sourceOperation->match([
Expand Down

0 comments on commit fe561d8

Please sign in to comment.