Search in sources :

Example 6 with InvalidHbaseSchemaException

use of com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException in project pinpoint by naver.

the class TableChangeMapper method mapColumnFamilies.

private List<ColumnFamilyChange> mapColumnFamilies(List<Table.CreateColumnFamily> createColumnFamilies) {
    if (CollectionUtils.isEmpty(createColumnFamilies)) {
        return Collections.emptyList();
    }
    Map<String, ColumnFamilyChange> createColumnFamilyChanges = new LinkedHashMap<>();
    for (Table.CreateColumnFamily createColumnFamily : createColumnFamilies) {
        String columnFamilyName = createColumnFamily.getName();
        ColumnFamilyChange columnFamilyChange = columnFamilyChangeMapper.mapCreate(createColumnFamily);
        if (createColumnFamilyChanges.put(columnFamilyName, columnFamilyChange) != null) {
            throw new InvalidHbaseSchemaException("Duplicate ColumnFamily name : " + columnFamilyName);
        }
    }
    return new ArrayList<>(createColumnFamilyChanges.values());
}
Also used : Table(com.navercorp.pinpoint.hbase.schema.definition.xml.Table) InvalidHbaseSchemaException(com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException) ArrayList(java.util.ArrayList) ColumnFamilyChange(com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyChange) LinkedHashMap(java.util.LinkedHashMap)

Example 7 with InvalidHbaseSchemaException

use of com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException in project pinpoint by naver.

the class TableChangeMapper method map.

public TableChange map(ChangeSet.CreateTable createTable) {
    String tableName = createTable.getName();
    if (StringUtils.isEmpty(tableName)) {
        throw new InvalidHbaseSchemaException("Table name must not be empty");
    }
    TableConfiguration tableConfiguration = tableConfigurationMapper.mapConfiguration(createTable.getConfiguration());
    List<ColumnFamilyChange> columnFamilyChanges = mapColumnFamilies(createTable.getCreateColumnFamily());
    CreateTableChange.SplitOption splitOption = splitOptionMapper.mapSplitOption(createTable.getSplit());
    return new CreateTableChange(tableName, tableConfiguration, columnFamilyChanges, splitOption);
}
Also used : InvalidHbaseSchemaException(com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException) CreateTableChange(com.navercorp.pinpoint.hbase.schema.reader.core.CreateTableChange) ColumnFamilyChange(com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyChange) TableConfiguration(com.navercorp.pinpoint.hbase.schema.reader.core.TableConfiguration)

Aggregations

InvalidHbaseSchemaException (com.navercorp.pinpoint.hbase.schema.reader.InvalidHbaseSchemaException)7 ColumnFamilyChange (com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyChange)3 ChangeSet (com.navercorp.pinpoint.hbase.schema.reader.core.ChangeSet)2 CreateColumnFamilyChange (com.navercorp.pinpoint.hbase.schema.reader.core.CreateColumnFamilyChange)2 CreateTableChange (com.navercorp.pinpoint.hbase.schema.reader.core.CreateTableChange)2 TableChange (com.navercorp.pinpoint.hbase.schema.reader.core.TableChange)2 LinkedHashMap (java.util.LinkedHashMap)2 HbaseSystemException (com.navercorp.pinpoint.common.hbase.HbaseSystemException)1 HbaseSchemaManagerTask (com.navercorp.pinpoint.hbase.manager.task.HbaseSchemaManagerTask)1 Table (com.navercorp.pinpoint.hbase.schema.definition.xml.Table)1 HbaseSchemaParseException (com.navercorp.pinpoint.hbase.schema.reader.HbaseSchemaParseException)1 ColumnFamilyConfiguration (com.navercorp.pinpoint.hbase.schema.reader.core.ColumnFamilyConfiguration)1 ModifyTableChange (com.navercorp.pinpoint.hbase.schema.reader.core.ModifyTableChange)1 TableConfiguration (com.navercorp.pinpoint.hbase.schema.reader.core.TableConfiguration)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 HTableDescriptor (org.apache.hadoop.hbase.HTableDescriptor)1 Test (org.junit.Test)1