Skip to content

Commit

Permalink
Fixining bug.
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-joyle committed Dec 30, 2024
1 parent 8b14269 commit e740c3b
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -684,21 +684,29 @@ private static async Task<DValue<RecordValue>> LazyCheckPredicateAsync(
var leftScopeName = new DName(((StringValue)scopeNameResolver.GetField(FunctionJoinScopeInfo.LeftRecord.Value)).Value);
var rightScopeName = new DName(((StringValue)scopeNameResolver.GetField(FunctionJoinScopeInfo.RightRecord.Value)).Value);

var scopeValue = FormulaValue.NewRecordFromFields(
new NamedValue(leftScopeName, leftRow.Value),
new NamedValue(rightScopeName, rightRow.Value));

SymbolContext childContext = context.SymbolContext.WithScopeValues(scopeValue);

if (leftRow.IsError)
{
return leftRow;
}

else if (leftRow.IsBlank)
{
return null;
}

if (rightRow.IsError)
{
return rightRow;
}
}
else if (rightRow.IsBlank)
{
return null;
}

var scopeValue = FormulaValue.NewRecordFromFields(
new NamedValue(leftScopeName, leftRow.Value),
new NamedValue(rightScopeName, rightRow.Value));

SymbolContext childContext = context.SymbolContext.WithScopeValues(scopeValue);

var result = await predicate.EvalInRowScopeAsync(context.NewScope(childContext)).ConfigureAwait(false);
var include = false;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,4 +68,10 @@ Table({a:1,b:1},{a:1,b:1},Error({Kind:ErrorKind.Div0}))
Errors: Error 61-63: The '{ a:1 }' value is invalid in this context. It should be a reference to either 'T1' or 'T2' scope name.|Error 13-15: At least one 'T2' column must be declared to compose the join result.|Error 0-4: The function 'Join' has some invalid arguments.

>> Join([{a:1}],[{a:1}],true,JoinType.Inner,{a:1}.a As AAA)
Errors: Error 49-51: The '{ a:1 }' value is invalid in this context. It should be a reference to either 'LeftRecord' or 'RightRecord' scope name.|Error 5-12: At least one 'RightRecord' column must be declared to compose the join result.|Error 0-4: The function 'Join' has some invalid arguments.
Errors: Error 49-51: The '{ a:1 }' value is invalid in this context. It should be a reference to either 'LeftRecord' or 'RightRecord' scope name.|Error 5-12: At least one 'RightRecord' column must be declared to compose the join result.|Error 0-4: The function 'Join' has some invalid arguments.

>> Join([10,20], Table({Value:20}, Blank()), LeftRecord.Value=RightRecord.Value, JoinType.Left, RightRecord.Value As R2)
Table({R2:20,Value:20},{R2:Blank(),Value:10})

>> Join([10,20], Table({Value:20}, If(1/0, {Value:25})), LeftRecord.Value=RightRecord.Value, JoinType.Left, RightRecord.Value As R2)
Table(Error({Kind:ErrorKind.Div0}),{R2:20,Value:20},Error({Kind:ErrorKind.Div0}))

0 comments on commit e740c3b

Please sign in to comment.