Search in sources :

Example 1 with ArrayStack

use of org.apache.commons.collections.ArrayStack in project incubator-atlas by apache.

the class DataSetLineageServiceTest method createTable.

private void createTable(String tableName, int numCols, boolean createLineage) throws Exception {
    String dbId = getEntityId(DATABASE_TYPE, "name", "Sales");
    Id salesDB = new Id(dbId, 0, DATABASE_TYPE);
    //Create the entity again and schema should return the new schema
    List<Referenceable> columns = new ArrayStack();
    for (int i = 0; i < numCols; i++) {
        columns.add(column("col" + random(), "int", "column descr"));
    }
    Referenceable sd = storageDescriptor("hdfs://host:8000/apps/warehouse/sales", "TextInputFormat", "TextOutputFormat", true, ImmutableList.of(column("time_id", "int", "time id")));
    Id table = table(tableName, "test table", salesDB, sd, "fetl", "External", columns);
    if (createLineage) {
        Id inTable = table("table" + random(), "test table", salesDB, sd, "fetl", "External", columns);
        Id outTable = table("table" + random(), "test table", salesDB, sd, "fetl", "External", columns);
        loadProcess("process" + random(), "hive query for monthly summary", "Tim ETL", ImmutableList.of(inTable), ImmutableList.of(table), "create table as select ", "plan", "id", "graph", "ETL");
        loadProcess("process" + random(), "hive query for monthly summary", "Tim ETL", ImmutableList.of(table), ImmutableList.of(outTable), "create table as select ", "plan", "id", "graph", "ETL");
    }
}
Also used : Referenceable(org.apache.atlas.typesystem.Referenceable) Id(org.apache.atlas.typesystem.persistence.Id) ArrayStack(org.apache.commons.collections.ArrayStack)

Example 2 with ArrayStack

use of org.apache.commons.collections.ArrayStack in project incubator-atlas by apache.

the class EntityLineageServiceTest method createTable.

private void createTable(String tableName, int numCols, boolean createLineage) throws Exception {
    String dbId = getEntityId(DATABASE_TYPE, "name", "Sales");
    Id salesDB = new Id(dbId, 0, DATABASE_TYPE);
    //Create the entity again and schema should return the new schema
    List<Referenceable> columns = new ArrayStack();
    for (int i = 0; i < numCols; i++) {
        columns.add(column("col" + random(), "int", "column descr"));
    }
    Referenceable sd = storageDescriptor("hdfs://host:8000/apps/warehouse/sales", "TextInputFormat", "TextOutputFormat", true, ImmutableList.of(column("time_id", "int", "time id")));
    Id table = table(tableName, "test table", salesDB, sd, "fetl", "External", columns);
    if (createLineage) {
        Id inTable = table("table" + random(), "test table", salesDB, sd, "fetl", "External", columns);
        Id outTable = table("table" + random(), "test table", salesDB, sd, "fetl", "External", columns);
        loadProcess("process" + random(), "hive query for monthly summary", "Tim ETL", ImmutableList.of(inTable), ImmutableList.of(table), "create table as select ", "plan", "id", "graph", "ETL");
        loadProcess("process" + random(), "hive query for monthly summary", "Tim ETL", ImmutableList.of(table), ImmutableList.of(outTable), "create table as select ", "plan", "id", "graph", "ETL");
    }
}
Also used : Referenceable(org.apache.atlas.typesystem.Referenceable) Id(org.apache.atlas.typesystem.persistence.Id) ArrayStack(org.apache.commons.collections.ArrayStack)

Example 3 with ArrayStack

use of org.apache.commons.collections.ArrayStack in project jmeter by apache.

the class FileServer method getBaseDirRelative.

/**
     * Calculates the relative path from {@link #DEFAULT_BASE} to the current base,
     * which must be the same as or a child of the default.
     * 
     * @return the relative path, or {@code "."} if the path cannot be determined
     */
public synchronized File getBaseDirRelative() {
    // Must first convert to absolute path names to ensure parents are available
    File parent = new File(DEFAULT_BASE).getAbsoluteFile();
    File f = base.getAbsoluteFile();
    ArrayStack l = new ArrayStack();
    while (f != null) {
        if (f.equals(parent)) {
            if (l.isEmpty()) {
                break;
            }
            File rel = new File((String) l.pop());
            while (!l.isEmpty()) {
                rel = new File(rel, (String) l.pop());
            }
            return rel;
        }
        l.push(f.getName());
        f = f.getParentFile();
    }
    return new File(".");
}
Also used : ArrayStack(org.apache.commons.collections.ArrayStack) File(java.io.File)

Aggregations

ArrayStack (org.apache.commons.collections.ArrayStack)3 Referenceable (org.apache.atlas.typesystem.Referenceable)2 Id (org.apache.atlas.typesystem.persistence.Id)2 File (java.io.File)1