/** * @return The engine name we are built on, e.g., "spark" or "java_collections" */ public String getEngine() { return this.getManager().getEngine(); }
/** * Typically, levels are automatically computed from the data, but in some rare instances, the user may want to * specify the levels explicitly, e.g., when the data column does not contain all the levels desired. * * @param levels * @param isOrdered a flag indicating whether the levels actually have "less than" and "greater than" left-to-right order * meaning * @throws DDFException */ public void setLevels(List<String> levels, boolean isOrdered) throws DDFException { this.setLevels(levels, null, isOrdered); }
public static DDFManager get(String engineType) throws DDFException { return DDFManager.get(EngineType.fromString(engineType)); }
/** * Instantiates a new DDF of the type specified in ddf.ini as "DDF", passing in this DDFManager as the sole argument * * @return the newly instantiated DDF * @throws DDFException */ public DDF newDDF() throws DDFException { DDF ddf = this.newDDF(new Class<?>[] { DDFManager.class }, new Object[] { this }); ddf.getPersistenceHandler().setPersistable(false); return ddf; }
public void removeDDF(DDF ddf) throws DDFException { ddf.getRepresentationHandler().uncacheAll(); ddf.getRepresentationHandler().reset(); mDDFCache.removeDDF(ddf); }
public void createTableSmiths2() throws DDFException { manager.sql("drop table if exists smiths2", false); manager.sql("create table smiths2 (subject string, variable string, value double) " + "ROW FORMAT DELIMITED FIELDS TERMINATED BY ','", false); manager.sql("load data local inpath '../resources/test/smiths2' into table smiths2", false); }
@Test public void testVectorVariance() throws DDFException { DDF ddf2 = manager.sql2ddf("select * from airline", false); Double[] a = ddf2.getVectorVariance("year"); assert (a != null); assert (a.length == 2); }
@Override public DDF sql2ddf(String command, Schema schema, DataSourceDescriptor dataSource) throws DDFException { return this.sql2ddf(command, schema, dataSource, null); }
public SqlResult sql(String command, DataSourceDescriptor dataSource) throws DDFException { return this.getDummyDDF().getSqlHandler(). sqlHandle(command, null, dataSource); }
public DDFManager.EngineType getEngineType() { return this.getManager().getEngineType(); }
public void export2csv(String fileURL, String fieldSeparator, Boolean hasHead) throws DDFException { this.getManager().export2csv(this, fileURL, fieldSeparator, hasHead); }
/** * Instantiate a new Vector based on an existing DDF, given a column name. The column name is not verified for * correctness; any errors would only show up on actual usage. * * @param theDDF * @param theColumnName */ public Vector(DDF theDDF, String theColumnName) { this.initialize(theDDF, theColumnName); }
/** * @param name the DDF name to set */ protected void setName(String name) throws DDFException { if(name != null) validateName(name); this.mName = name; }
/** * Override to remove our List<?> snapshot from a local variable for serialization */ @Override public void afterSerialization() throws DDFException { mData = null; mUnitType = null; super.afterSerialization(); }
public void createTableMtcars() throws DDFException { manager.sql("drop table if exists mtcars", false); manager.sql("CREATE TABLE mtcars (" + "mpg double, cyl int, disp double, hp int, drat double, wt double, qsec double, vs int, am int, gear int, carb int" + ") ROW FORMAT DELIMITED FIELDS TERMINATED BY ' '", false); manager.sql("load data local inpath '../resources/test/mtcars' into table mtcars", false); }
@Override public DDF sql2ddf(String command, DataFormat dataFormat) throws DDFException { return this.sql2ddf(command, null, null, dataFormat); }
/** * Instantiate a new Vector with the given T array. Uses the default engine. * * @param data * @param theColumnName * @throws DDFException */ public Vector(String theColumnName, T[] data) throws DDFException { this.initialize(theColumnName, data, null); }
public void createTableMovie() throws DDFException { manager.sql("drop table if exists movie", false); manager.sql("create table movie (" + "idx string,title string,year int,length int,budget double,rating double,votes int," + "r1 double,r2 double,r3 double,r4 double,r5 double,r6 double,r7 double,r8 double,r9 double,r10 double," + "mpaa string,Action int,Animation int,Comedy int,Drama int,Documentary int,Romance int,Short int" + ") ROW FORMAT DELIMITED FIELDS TERMINATED BY ','", false); manager.sql("load data local inpath '../resources/test/movies.csv' into table movie", false); }
/** * Instantiate a new Vector with the given T array. Uses the default engine. * * @param data * @param theColumnName * @param engineName * @throws DDFException */ public Vector(String theColumnName, T[] data, String engineName) throws DDFException { this.initialize(theColumnName, data, engineName); }
public void createTableCarOwner() throws DDFException { manager.sql("drop table if exists carowner", false); manager.sql("CREATE TABLE carowner (" + "name string, cyl int, disp double" + ") ROW FORMAT DELIMITED FIELDS TERMINATED BY ' '", false); manager.sql("load data local inpath '../resources/test/carowner' into table carowner", false); }