use of alluxio.table.common.Layout in project alluxio by Alluxio.
the class TransformManagerTest method checkLayout.
/**
* Checks that the layouts of table partitions are the transformed layouts in info.
*
* @param info the job information
* @param table the table
*/
private void checkLayout(TransformJobInfo info, String table) throws IOException {
for (Map.Entry<String, Layout> specLayouts : info.getTransformedLayouts().entrySet()) {
String spec = specLayouts.getKey();
Layout layout = specLayouts.getValue();
Partition partition = mTableMaster.getTable(DB, table).getPartition(spec);
assertTrue(partition.isTransformed(info.getDefinition()));
assertEquals(layout, partition.getLayout());
}
}
use of alluxio.table.common.Layout in project alluxio by Alluxio.
the class HiveLayoutTest method factoryConversions.
@Test
public void factoryConversions() throws Exception {
HiveLayout layout = createRandom();
alluxio.grpc.table.Layout layoutProto = layout.toProto();
Layout layout2 = new HiveLayout.HiveLayoutFactory().create(layoutProto);
alluxio.grpc.table.Layout layout2Proto = layout2.toProto();
assertEquals(layoutProto, layout2Proto);
}
use of alluxio.table.common.Layout in project alluxio by Alluxio.
the class AlluxioCatalog method completeTransformTable.
/**
* Completes table transformation by updating the layouts of the table's partitions.
*
* @param journalContext the journal context
* @param dbName the database name
* @param tableName the table name
* @param definition the transformation definition
* @param transformedLayouts map from partition spec to the transformed layouts
*/
public void completeTransformTable(JournalContext journalContext, String dbName, String tableName, String definition, Map<String, Layout> transformedLayouts) throws IOException {
try (LockResource l = getDbLock(dbName)) {
// Check existence of table.
getTableInternal(dbName, tableName);
alluxio.proto.journal.Table.CompleteTransformTableEntry entry = alluxio.proto.journal.Table.CompleteTransformTableEntry.newBuilder().setDbName(dbName).setTableName(tableName).setDefinition(definition).putAllTransformedLayouts(Maps.transformValues(transformedLayouts, Layout::toProto)).build();
applyAndJournal(journalContext, Journal.JournalEntry.newBuilder().setCompleteTransformTable(entry).build());
}
}
use of alluxio.table.common.Layout in project alluxio by Alluxio.
the class HiveLayoutTest method registryCreate.
@Test
public void registryCreate() throws Exception {
HiveLayout layout = createRandom();
assertNotNull(new HiveLayout.HiveLayoutFactory().create(layout.toProto()));
LayoutRegistry registry = new LayoutRegistry();
registry.refresh();
Layout instance = registry.create(layout.toProto());
assertNotNull(instance);
assertEquals(layout.toProto(), instance.toProto());
}
use of alluxio.table.common.Layout in project alluxio by Alluxio.
the class TransformPlan method computeJobConfigs.
private ArrayList<JobConfig> computeJobConfigs(TransformDefinition definition) {
ArrayList<JobConfig> actions = new ArrayList<>();
Layout baseLayout = mBaseLayout;
boolean deleteSrc = false;
for (TransformAction action : definition.getActions()) {
actions.add(action.generateJobConfig(baseLayout, mTransformedLayout, deleteSrc));
baseLayout = mTransformedLayout;
deleteSrc = true;
}
if (actions.isEmpty()) {
throw new IllegalArgumentException("At least one action should be defined for the transformation");
}
return actions;
}
Aggregations