Package core

Examples of core.Column


        if (inRelation1.getCardinality() != inRelation2.getCardinality())
            throw new IllegalArgumentException("Cannot union on relations of different cardinality");

        dummyRelation = caf.getSpaceForNewRelation(1);
        labelDummy(dummyRelation, "Union of "+inRelation1.toString(caf)+" and "+inRelation2.toString(caf));
        Column g = dummyRelation.getFirstCol();
        resultRelation = caf.getSpaceForNewRelation(inRelation1.getCardinality());
        labelResult(resultRelation, "Union of "+inRelation1.toString(caf)+" and "+inRelation2.toString(caf));
        Column b = inRelation2.getFirstCol();
        formulas.put(g.getCell(1), fillCount(b));

        Cell hij1 = caf.getLeftTopCellInRelation(resultRelation);
        Cell def1 = caf.getLeftTopCellInRelation(inRelation2);
        for (Column abc : inRelation1) {
View Full Code Here


        dummyRelation = caf.getSpaceForNewRelation(3);
        labelDummy(dummyRelation, "Sorting of "+inputRelation.toString(caf));
        resultRelation = caf.getSpaceForNewRelation(inputRelation.getCardinality());
        labelResult(resultRelation, "Sorting of "+inputRelation.toString(caf));

        Column a = inputRelation.getCol(sortingColIndexInInput);
        Column c = dummyRelation.getFirstCol();
        Column d = c.getNext();
        Cell a1 = a.getCell(1);
        Cell c1 = caf.getLeftTopCellInRelation(dummyRelation);
        Cell d1 = c1.nextInRow();
        Cell e1 = d1.nextInRow();
        Cell fg1 = e1.nextInRow();
View Full Code Here

                skipFirstComma = false;
            } else {
                sbWklejka1.append(",");
                sbWklejka2.append(",");
            }
            Column r1Col = inputRelation1.getCol(i);
            Column r2Col = inputRelation2.getCol(i);
            Cell r1Cell1 = r1Col.getCell(1);
            sbWklejka1.append(fillInsert1(r2Col, r1Cell1));
            sbWklejka2.append(fillInsert2(r1Col, r1Cell1));
        }
        Cell g1 = caf.getLeftTopCellInRelation(resultRelation);
        Cell h1 = g1.nextInRow();
        Cell a1 = caf.getLeftTopCellInRelation(inputRelation1);
        formulas.put(g1, fillComparison(sbWklejka1.toString(), sbWklejka2.toString(), a1));
        for (int i = 2; i <= inputRelation1.getCardinality(); i++) {
            a1 = a1.nextInRow();
            formulas.put(h1, fillCopy(g1, a1));
            h1 = h1.nextInRow();
        }

        skipFirstComma = true;
        sbWklejka1 = new StringBuilder();
        sbWklejka2 = new StringBuilder();
        for (int i = 1; i <= inputRelation1.getCardinality(); i++) {
            if (skipFirstComma) {
                skipFirstComma = false;
            } else {
                sbWklejka1.append(",");
                sbWklejka2.append(",");
            }
            Column r1Col = inputRelation1.getCol(i);
            Column r2Col = inputRelation2.getCol(i);
            Cell r1Cell2 = r1Col.getCell(2);
            sbWklejka1.append(fillInsert1(r2Col, r1Cell2));
            sbWklejka2.append(fillInsert2(r1Col, r1Cell2));
        }
        Cell g2 = caf.getLeftTopCellInRelation(resultRelation).nextInColumn();
View Full Code Here

            } else {
                sbWklejka1row1.append(",");
                sbWklejka1row2.append(",");
                sbWklejka2.append(",");
            }
            Column r1Col = inputRelation1.getCol(i);
            Column r2Col = inputRelation2.getCol(i);
            Cell r1Cell1 = r1Col.getCell(1);
            Cell r1Cell2 = r1Col.getCell(2);
            sbWklejka1row1.append(fillInsert1(r2Col, r1Cell1));
            sbWklejka1row2.append(fillInsert1(r2Col, r1Cell2));
            sbWklejka2.append(fillInsert2(r1Col, r1Cell2));
View Full Code Here

        labelResult(resultRelation, "Duplicate Removal of "+inputRelation.toString(caf));

        Cell a1 = caf.getLeftTopCellInRelation(inputRelation);
        Cell c1 = caf.getLeftTopCellInRelation(dummyRelation);
        Cell d1 = c1.nextInRow();
        Column c = dummyRelation.getFirstCol();
        String strC = c.toString(caf);
        String strMATCH = String.format(MATCH, strC, strC);
        String strD1 = d1.toString(caf);
        formulas.put(c1, String.format(FR_IF, a1.toString(caf)));
        formulas.put(d1, strMATCH);
View Full Code Here

        labelResult(resultRelation, "Semi Join of "+ inputRelation1.toString(caf) + " and " + inputRelation2.toString(caf));

        for (int row = 1; row <= 2; row++) {
            Cell keyResult = resultRelation.getFirstCol().getCell(row);
            Cell keyFirstRel = inputRelation1.getCol(index1).getCell(row);
            Column keyColSecondRel = inputRelation2.getCol(index2);
            formulas.put(keyResult, fillIf(keyFirstRel, keyColSecondRel));

            Cell res = keyResult.nextInRow();
            int i = 1;
            for (Column c : inputRelation1) {
View Full Code Here

        Relation furtherDummyRelation = caf.getSpaceForNewRelation(7);
        dummyRelation = extend(dummyRelation, furtherDummyRelation);

        //finding row numbers in the input relation that correspond to the group by keys
        Column h = furtherDummyRelation.getFirstCol();
        Column a = sortedInput1.getCol(index1);
        Column e = standarizationResult1.getFirstCol();
        for (int row = 1; row <= 2; row++) {
            formulas.put(h.getCell(row), fillMatch(e.getCell(row), a));
        }

        Column o = h.getNext();
        Column i = sortedInput2.getCol(index2);
        Column m = standarizationResult2.getFirstCol();
        for (int row = 1; row <= 2; row++) {
            formulas.put(o.getCell(row), fillMatch(m.getCell(row), i));
        }

        //multiplying the group bys so we know how many results there are for a given key
        Column p = o.getNext();
        Column noInSortedGroupBy1 = standarizationResult1.getLastCol();
        Column noInSortedGroupBy2 = standarizationResult2.getLastCol();
        for (int row = 1; row <= 2; row++) {
            formulas.put(p.getCell(row), fillIfErrorTimes(noInSortedGroupBy1.getCell(row), noInSortedGroupBy2.getCell(row)));
        }

        //filling Q
        Column q = p.getNext();
        formulas.put(q.getCell(1), "0");
        formulas.put(q.getCell(2), fillIfErrorPlus(p.getCell(1), q.getCell(1)));

        //filling R
        Column r = q.getNext();
        formulas.put(r.getCell(1), fillSum(p));

        //filling S
        Column s = r.getNext();
        for (int row = 1; row <= 2; row++) {
            formulas.put(s.getCell(row), fillIfMatch(r, q));
        }

        //filling T
        Column t = s.getNext();
        formulas.put(t.getCell(1), fillIfIsNa1(s.getCell(1)));
        formulas.put(t.getCell(2), fillIfIsNa2(s.getCell(1), s.getCell(2), t.getCell(1)));

        //dummy constructed with extend
        labelDummy(dummyRelation, "Equality Join of " + inputRelation1.toString(caf) + " and " + inputRelation2.toString(caf));
        resultRelation = caf.getSpaceForNewRelation(inputRelation1.getCardinality() + inputRelation2.getCardinality() - 1);
        labelResult(resultRelation, "Equality Join of " + inputRelation1.toString(caf) + " and " + inputRelation2.toString(caf));

        //producing the common index
        Column u = resultRelation.getFirstCol();
        for (int row = 1; row <= 2; row++) {
            formulas.put(u.getCell(row), fillIndex(e, s.getCell(row)));
        }

        //copying the reminder of the first relation
        int[] indexesWithouTheKey1 = new int[sortedInput1.getCardinality() - 1];
        dummy = 0;
        for (int c = 1; c <= sortedInput1.getCardinality(); c++) {
            if (c != index1) {
                indexesWithouTheKey1[dummy++] = c;
            }
        }

        Column v = u.getNext();
        for (int colInd : indexesWithouTheKey1) {
            for (int row = 1; row <= 2; row++) {
                formulas.put(v.getCell(row), fillIndexIndex1(sortedInput1.getCol(colInd), h, noInSortedGroupBy1, s.getCell(row), t.getCell(row)));
            }
            v = v.getNext();
        }

        //copying the reminder of the second relation
        int[] indexesWithouTheKey2 = new int[sortedInput2.getCardinality() - 1];
        dummy = 0;
        for (int c = 1; c <= sortedInput2.getCardinality(); c++) {
            if (c != index2) {
                indexesWithouTheKey2[dummy++] = c;
            }
        }

        Column w = v;
        for (int colInd : indexesWithouTheKey2) {
            for (int row = 1; row <= 2; row++) {
                formulas.put(w.getCell(row), fillIndexIndex2(sortedInput2.getCol(colInd), o, noInSortedGroupBy1, s.getCell(row), t.getCell(row)));
            }
            w = w.getNext();
        }
    }
View Full Code Here

TOP

Related Classes of core.Column

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.