@BeforeClass public static void startServer() throws Exception { Thread.sleep(1000); // LOG = LoggerFactory.getLogger(BaseTest.class); // manager = DDFManager.get("spark"); /* manager = DDFManager.get("jdbc", new JDBCDataSourceDescriptor(new DataSourceURI("jdbc:mysql://localhost/testdb"), new JDBCDataSourceDescriptor.JDBCDataSourceCredentials("pauser", "papwd"), null)); DataSourceDescriptor ds = manager.getDataSourceDescriptor(); if (ds instanceof JDBCDataSourceDescriptor) { System.out.println("hello"); } DDF ret = manager.sql2ddf("select * from testtable", "jdbc");*/ // Add 2 test ddfs. manager = DDFManager.get("spark"); manager.setEngineName("spark"); Schema schema = new Schema("tablename1", "d d,d d"); DDF ddf = manager.newDDF(manager, new Class<?>[] {DDFManager.class}, "spark", "adatao", "a", schema); Schema schema2 = new Schema("tablename2", "d d,d d"); DDF ddf2 = manager.newDDF(manager, new Class<?>[] {DDFManager.class}, "spark", "adatao", "b", schema2); parser = new CCJSqlParserManager(); }
@Override public DDF residuals() throws DDFException { SparkDDF predictionDDF = (SparkDDF) this.getDDF(); JavaRDD<double[]> predictionRDD = predictionDDF.getJavaRDD(double[].class); JavaRDD<double[]> result = predictionRDD.map(new MetricsMapperResiduals()); if (result == null) mLog.error(">> javaRDD result of MetricMapper residuals is null"); if (predictionDDF.getManager() == null) mLog.error(">> predictionDDF.getManager() is null"); if (result.rdd() == null) mLog.error(">> result.rdd() is null"); if (predictionDDF.getSchema() == null) mLog.error(">> predictionDDF.getSchema() is null"); if (predictionDDF.getName() == null) mLog.error(">> predictionDDF.getName() is null"); Schema schema = new Schema("residuals double"); DDFManager manager = this.getDDF().getManager(); DDF residualDDF = manager.newDDF( manager, result.rdd(), new Class<?>[] {RDD.class, double[].class}, null, schema); if (residualDDF == null) mLog.error(">>>>>>>>>>>.residualDDF is null"); return residualDDF; }