Search in sources :

Example 6 with TransformPlan

use of alluxio.table.common.transform.TransformPlan in project alluxio by Alluxio.

the class AlluxioCatalogTest method getTransformPlanOutputUri.

@Test
public void getTransformPlanOutputUri() throws Exception {
    String dbName = "testdb";
    TestDatabase.genTable(1, 1, false);
    mCatalog.attachDatabase(NoopJournalContext.INSTANCE, TestUdbFactory.TYPE, "connect_URI", TestDatabase.TEST_UDB_NAME, dbName, Collections.emptyMap(), false);
    String tableName = TestDatabase.getTableName(0);
    Table table = mCatalog.getTable(dbName, tableName);
    ServerConfiguration.set(PropertyKey.MASTER_HOSTNAME, "localhost");
    ServerConfiguration.set(PropertyKey.MASTER_RPC_PORT, "8080");
    List<TransformPlan> plans = mCatalog.getTransformPlan(dbName, tableName, TRANSFORM_DEFINITION);
    assertEquals("alluxio://localhost:8080/", plans.get(0).getTransformedLayout().getLocation().getRootPath());
    ServerConfiguration.set(PropertyKey.MASTER_RPC_ADDRESSES, "host1:1,host2:2");
    plans = mCatalog.getTransformPlan(dbName, tableName, TRANSFORM_DEFINITION);
    assertEquals("alluxio://host1:1,host2:2/", plans.get(0).getTransformedLayout().getLocation().getRootPath());
    ServerConfiguration.set(PropertyKey.ZOOKEEPER_ENABLED, true);
    ServerConfiguration.set(PropertyKey.ZOOKEEPER_ADDRESS, "host:1000");
    plans = mCatalog.getTransformPlan(dbName, tableName, TRANSFORM_DEFINITION);
    assertEquals("alluxio://zk@host:1000/", plans.get(0).getTransformedLayout().getLocation().getRootPath());
}
Also used : UdbTable(alluxio.table.common.udb.UdbTable) TransformPlan(alluxio.table.common.transform.TransformPlan) Test(org.junit.Test)

Example 7 with TransformPlan

use of alluxio.table.common.transform.TransformPlan in project alluxio by Alluxio.

the class AlluxioCatalogTest method getTransformPlanTransformedLayout.

@Test
public void getTransformPlanTransformedLayout() throws Exception {
    String dbName = "testdb";
    TestDatabase.genTable(1, 1, false);
    mCatalog.attachDatabase(NoopJournalContext.INSTANCE, TestUdbFactory.TYPE, "connect_URI", TestDatabase.TEST_UDB_NAME, dbName, Collections.emptyMap(), false);
    String tableName = TestDatabase.getTableName(0);
    ServerConfiguration.set(PropertyKey.MASTER_HOSTNAME, "localhost");
    final TransformDefinition transformDefinition = TransformDefinition.parse("file.count.max=100;file.parquet.compression=uncompressed");
    List<TransformPlan> plans = mCatalog.getTransformPlan(dbName, tableName, transformDefinition);
    assertEquals(1, plans.size());
    alluxio.job.plan.transform.PartitionInfo transformedPartitionInfo = TransformActionUtils.generatePartitionInfo(plans.get(0).getTransformedLayout());
    assertEquals("uncompressed", transformedPartitionInfo.getSerdeProperties().get("file.parquet.compression"));
}
Also used : TransformDefinition(alluxio.table.common.transform.TransformDefinition) TransformPlan(alluxio.table.common.transform.TransformPlan) Test(org.junit.Test)

Aggregations

TransformPlan (alluxio.table.common.transform.TransformPlan)7 Test (org.junit.Test)4 UdbTable (alluxio.table.common.udb.UdbTable)3 Layout (alluxio.table.common.Layout)2 ArrayList (java.util.ArrayList)2 AlluxioURI (alluxio.AlluxioURI)1 Pair (alluxio.collections.Pair)1 JobConfig (alluxio.job.JobConfig)1 CompositeConfig (alluxio.job.workflow.composite.CompositeConfig)1 JournalContext (alluxio.master.journal.JournalContext)1 AddTransformJobInfoEntry (alluxio.proto.journal.Table.AddTransformJobInfoEntry)1 UdbPartition (alluxio.table.common.UdbPartition)1 HiveLayout (alluxio.table.common.layout.HiveLayout)1 TransformContext (alluxio.table.common.transform.TransformContext)1 TransformDefinition (alluxio.table.common.transform.TransformDefinition)1 IOException (java.io.IOException)1 HashMap (java.util.HashMap)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1