()
| 797 | } |
| 798 | |
| 799 | @Test |
| 800 | public void testSortUDF1() throws Exception { |
| 801 | PhysicalPlan php = new PhysicalPlan(); |
| 802 | PhysicalPlan ldFil1 = GenPhyOp.loadedFilter(); |
| 803 | php.merge(ldFil1); |
| 804 | |
| 805 | // set up order by * |
| 806 | String funcName = WeirdComparator.class.getName(); |
| 807 | POUserComparisonFunc comparator = new POUserComparisonFunc( |
| 808 | new OperatorKey("", r.nextLong()), -1, null, new FuncSpec(funcName)); |
| 809 | POSort sort = new POSort(new OperatorKey("", r.nextLong()), -1, ldFil1.getLeaves(), |
| 810 | null, new ArrayList<Boolean>(), comparator); |
| 811 | sort.setRequestedParallelism(20); |
| 812 | PhysicalPlan nesSortPlan = new PhysicalPlan(); |
| 813 | POProject topPrj = new POProject(new OperatorKey("", r.nextLong())); |
| 814 | topPrj.setColumn(1); |
| 815 | topPrj.setOverloaded(true); |
| 816 | topPrj.setResultType(DataType.TUPLE); |
| 817 | nesSortPlan.add(topPrj); |
| 818 | |
| 819 | POProject prjStar2 = new POProject(new OperatorKey("", r.nextLong())); |
| 820 | prjStar2.setResultType(DataType.TUPLE); |
| 821 | prjStar2.setStar(true); |
| 822 | nesSortPlan.add(prjStar2); |
| 823 | |
| 824 | nesSortPlan.connect(topPrj, prjStar2); |
| 825 | List<PhysicalPlan> nesSortPlanLst = new ArrayList<PhysicalPlan>(); |
| 826 | nesSortPlanLst.add(nesSortPlan); |
| 827 | |
| 828 | sort.setSortPlans(nesSortPlanLst); |
| 829 | |
| 830 | php.add(sort); |
| 831 | php.connect(ldFil1.getLeaves().get(0), sort); |
| 832 | // have a foreach which takes the sort output |
| 833 | // and send it two two udfs |
| 834 | List<String> udfs = new ArrayList<String>(); |
| 835 | udfs.add(COUNT.class.getName()); |
| 836 | udfs.add(SUM.class.getName()); |
| 837 | POForEach fe3 = GenPhyOp.topForEachOPWithUDF(udfs); |
| 838 | php.add(fe3); |
| 839 | php.connect(sort, fe3); |
| 840 | |
| 841 | // add a group above the foreach |
| 842 | PhysicalPlan grpChain1 = GenPhyOp.grpChain(); |
| 843 | php.merge(grpChain1); |
| 844 | php.connect(fe3,grpChain1.getRoots().get(0)); |
| 845 | |
| 846 | |
| 847 | udfs.clear(); |
| 848 | udfs.add(AVG.class.getName()); |
| 849 | POForEach fe4 = GenPhyOp.topForEachOPWithUDF(udfs); |
| 850 | php.addAsLeaf(fe4); |
| 851 | |
| 852 | PhysicalPlan grpChain2 = GenPhyOp.grpChain(); |
| 853 | php.merge(grpChain2); |
| 854 | php.connect(fe4,grpChain2.getRoots().get(0)); |
| 855 | |
| 856 | udfs.clear(); |
nothing calls this directly
no test coverage detected