From 11e2f8e4d736169b6ff3dd20caf8d0259fc2283c Mon Sep 17 00:00:00 2001 From: aryanjha Date: Thu, 22 Dec 2022 14:26:15 -0500 Subject: [PATCH] Fixed the bug of missing relation names in join relational algebra statements Signed-off-by: Michael Mior Signed-off-by: Michael Mior --- src/RelExpr.js | 2 ++ src/RelExprTree.js | 2 ++ src/RelOp.js | 8 +++++--- src/RelOp.test.js | 11 +++++------ 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/src/RelExpr.js b/src/RelExpr.js index 5931c0b2c..e82e86350 100644 --- a/src/RelExpr.js +++ b/src/RelExpr.js @@ -101,6 +101,8 @@ const RelExpr: StatelessFunctionalComponent = (props) => { ); diff --git a/src/RelExprTree.js b/src/RelExprTree.js index b8b36c319..b652a3cf2 100644 --- a/src/RelExprTree.js +++ b/src/RelExprTree.js @@ -104,6 +104,8 @@ const RelExprTree: StatelessFunctionalComponent = (props) => { ); case 'except': diff --git a/src/RelOp.js b/src/RelOp.js index b9e1a8f83..acfb0ce60 100644 --- a/src/RelOp.js +++ b/src/RelOp.js @@ -139,23 +139,25 @@ export const Intersect: StatelessFunctionalComponent<{||}> = () => ( export const Join: StatelessFunctionalComponent<{ type: string, condition: string, + left: string, + right: string, }> = (props) => { if (props.type === 'left') { return ( - ⟕{props.condition} + {props.left} ⟕{props.condition} {props.right} ); } else if (props.type === 'right') { return ( - ⟖{props.condition} + {props.left} ⟖{props.condition} {props.right} ); } else { return ( - ⋈{props.condition} + {props.left} ⋈{props.condition} {props.right} ); } diff --git a/src/RelOp.test.js b/src/RelOp.test.js index 10063e18a..89843a4fb 100644 --- a/src/RelOp.test.js +++ b/src/RelOp.test.js @@ -15,7 +15,6 @@ import { Join, Union, } from './RelOp'; -import {exprToString} from './util'; each([ ['unary operators', ], @@ -88,23 +87,23 @@ it('renders a Product', () => { /** @test {Join} */ it('renders an inner Join', () => { const {container} = render( - + ); - expect(container).toContainHTML('⋈foo=3 ∧ bar=2'); + expect(container).toContainHTML('A ⋈foo=3 ∧ bar=2 B'); }); /** @test {Join} */ it('renders a left outer Join', () => { const {container} = render( - + ); - expect(container).toContainHTML('⟕foo=3 ∧ bar=2'); + expect(container).toContainHTML('A ⟕foo=3 ∧ bar=2 B'); }); /** @test {Join} */ it('renders a right outer Join', () => { const {container} = render( - + ); expect(container).toContainHTML('⟖foo=3 ∧ bar=2'); });