DataFrameJoiner { public Table leftOuter(Table... tables) { return leftOuter(false, tables); } DataFrameJoiner(Table table, String... joinColumnNames); Table inner(Table... tables); Table inner(boolean allowDuplicateColumnNames, Table... tables); Table inner(Table table2, String col2Name); Table inner(Table table2, String[] col2Names); Table inner(Table table2, String col2Name, boolean allowDuplicateColumnNames); Table inner(Table table2, boolean allowDuplicateColumnNames, String... col2Names); Table fullOuter(Table... tables); Table fullOuter(boolean allowDuplicateColumnNames, Table... tables); Table fullOuter(Table table2, String col2Name); Table leftOuter(Table... tables); Table leftOuter(boolean allowDuplicateColumnNames, Table... tables); Table leftOuter(Table table2, String[] col2Names); Table leftOuter(Table table2, String col2Name); Table leftOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names); Table rightOuter(Table... tables); Table rightOuter(boolean allowDuplicateColumnNames, Table... tables); Table rightOuter(Table table2, String col2Name); Table rightOuter(Table table2, String[] col2Names); Table rightOuter(Table table2, boolean allowDuplicateColumnNames, String... col2Names);  }
@Test public void leftOuterJoinWithDuplicateColumnNames() { Table table1 = DUPLICATE_COL_NAME_DOGS.where(DUPLICATE_COL_NAME_DOGS.booleanColumn("Good").isTrue()); Table table2 = DUPLICATE_COL_NAME_DOGS.where(DUPLICATE_COL_NAME_DOGS.booleanColumn("Good").isFalse()); Table joined = table1.joinOn("ID").leftOuter(table2, true, "ID"); assertEquals(5, joined.columnCount()); assertEquals(4, joined.rowCount()); assertEquals(4, joined.column("ID").size()); }
@Test public void leftOuterJoinWithDoubles() { Table joined = DOUBLE_INDEXED_PEOPLE.joinOn("ID").leftOuter(DOUBLE_INDEXED_DOGS, "ID"); assertEquals(3, joined.columnCount()); assertEquals(4, joined.rowCount()); assertEquals(4, joined.column("ID").size()); }
@Test public void leftOuterJoinWithDoubles2() { Table joined = DOUBLE_INDEXED_DOGS.joinOn("ID").leftOuter(DOUBLE_INDEXED_PEOPLE, "ID"); assertEquals(3, joined.columnCount()); assertEquals(4, joined.rowCount()); assertEquals(4, joined.column("ID").size()); }
@Test public void leftOuterJoinWithDoubles3() { Table joined = DOUBLE_INDEXED_DOGS.joinOn("ID").leftOuter(DOUBLE_INDEXED_PEOPLE); assertEquals(3, joined.columnCount()); assertEquals(4, joined.rowCount()); assertEquals(4, joined.column("ID").size()); }
@Test public void leftOuterJoinWithDoubles4() { Table joined = DOUBLE_INDEXED_DOGS.joinOn("ID").leftOuter(DOUBLE_INDEXED_PEOPLE, DOUBLE_INDEXED_CATS); assertEquals(3, joined.columnCount()); assertEquals(4, joined.rowCount()); assertEquals(4, joined.column("ID").size()); }
@Test public void leftOuterJoin() { Table joined = SP500.joinOn("Date").leftOuter(ONE_YEAR, "Date"); assertEquals(3, joined.columnCount()); assertEquals(6, joined.rowCount()); assertEquals(6, joined.column("Date").size()); }
@Test public void leftOuterJoinDuplicateKeysFirstTable() { Table joined = ANIMAL_NAMES.joinOn("Animal").leftOuter(ANIMAL_FEED, "Animal"); assertEquals(3, joined.columnCount()); assertEquals(6, joined.rowCount()); assertEquals(6, joined.column("Animal").size()); }
@Test public void leftOuterJoinDuplicateKeysSecondTable() { Table joined = ANIMAL_FEED.joinOn("Animal").leftOuter(ANIMAL_NAMES, "Animal"); assertEquals(3, joined.columnCount()); assertEquals(6, joined.rowCount()); assertEquals(6, joined.column("Animal").size()); }
@Test public void leftJoinStudentInstructorOnStateAge() { Table table1 = createSTUDENT(); Table table2 = createINSTRUCTOR(); Table joined = table1.joinOn("State", "Age").leftOuter(true, table2); assertEquals(15, joined.columnCount()); assertEquals(10, joined.rowCount()); assertEquals(10, joined.column("State").size()); assertEquals(10, joined.column("Age").size()); }
@Test public void leftJoinHouseBoatOnBedroomsOwner() { Table table1 = createHOUSE(); Table table2 = createBOAT(); Table joined = table1.joinOn("Bedrooms", "Owner").leftOuter(table2, new String[] {"Bedrooms", "Owner"}); assertEquals(6, joined.columnCount()); assertEquals(4, joined.rowCount()); }
@Test public void leftJoinHouseBoatBnBOnStyleTypeBedroomsOwner() { Table table1 = createHOUSE(); Table table2 = createBOAT(); Table joined = table1 .joinOn("Style", "Bedrooms", "Owner") .leftOuter(table2, new String[] {"Type", "Bedrooms", "Owner"}); assertEquals(5, joined.columnCount()); assertEquals(4, joined.rowCount()); }
@Test public void leftJoinStudentInstructorOnStateName() { Table table1 = createSTUDENT(); Table table2 = createINSTRUCTOR(); Table joined = table1.joinOn("State", "FirstName").leftOuter(table2, true, "State", "First"); assertEquals(15, joined.columnCount()); assertEquals(10, joined.rowCount()); }
@Test public void leftOuterJoinOnPartiallyMismatchedColNames() { Table table1 = createANIMALHOMES(); Table table2 = createDOUBLEINDEXEDPEOPLENameDwellingYearsMoveInDate(); Table joined = table1.joinOn("Name", "Home", "Age").leftOuter(table2, true, "Name", "Dwelling", "Years"); assert (joined.columnNames().containsAll(Arrays.asList("Name", "Home", "Age"))); assertEquals(7, joined.columnCount()); assertEquals(8, joined.rowCount()); }
@Test public void leftOuterJoinOnAgeMoveInDate() { Table table1 = createANIMALHOMES(); Table table2 = createDOUBLEINDEXEDPEOPLENameHomeAgeMoveInDate(); Table joined = table1.joinOn("Age", "MoveInDate").leftOuter(true, table2); assertEquals(8, joined.columnCount()); assertEquals(9, joined.rowCount()); }