private Set<String> getColumnFamilies() { return getTable().getColumns().stream().map(column -> { if (column instanceof HBaseColumn) { return ((HBaseColumn) column).getColumnFamily(); } else { String columnName = column.getName(); String[] columnNameParts = columnName.split(":"); if (columnNameParts.length > 0 && columnNameParts.length < 3) { return columnNameParts[0]; } else { throw new MetaModelException("Can't determine column family for column \"" + columnName + "\"."); } } }).distinct().collect(Collectors.toSet()); }
private Set<String> getColumnFamilies() { return getTable().getColumns().stream().map(column -> { if (column instanceof HBaseColumn) { return ((HBaseColumn) column).getColumnFamily(); } else { String columnName = column.getName(); String[] columnNameParts = columnName.split(":"); if (columnNameParts.length > 0 && columnNameParts.length < 3) { return columnNameParts[0]; } else { throw new MetaModelException("Can't determine column family for column \"" + columnName + "\"."); } } }).distinct().collect(Collectors.toSet()); }
sb.append(_table.getQualifiedLabel()); sb.append(" ("); List<Column> columns = _table.getColumns(); for (int i = 0; i < columns.size(); i++) { if (i != 0) {
sb.append(_table.getQualifiedLabel()); sb.append(" ("); List<Column> columns = _table.getColumns(); for (int i = 0; i < columns.size(); i++) { if (i != 0) {
public static Map<String, ?> getMappingSource(final MutableTable table) { if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { // do nothing - the ID is a client-side construct continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } HashMap<String, Map<String, Map<String, String>>> docTypeMap = new HashMap<>(); docTypeMap.put("properties", propertiesMap); final Map<String, Map<String, Map<String, Map<String, String>>>> mapping = new HashMap<>(); mapping.put(table.getName(), docTypeMap); return mapping; }
public static Map<String, ?> getMappingSource(final MutableTable table) { if (table.getColumnByName(FIELD_ID) == null) { final MutableColumn idColumn = new MutableColumn(FIELD_ID, ColumnType.STRING).setTable(table).setPrimaryKey( true); table.addColumn(0, idColumn); } final Map<String, Map<String, String>> propertiesMap = new LinkedHashMap<>(); for (Column column : table.getColumns()) { final String columnName = column.getName(); if (FIELD_ID.equals(columnName)) { // do nothing - the ID is a client-side construct continue; } final String fieldName = getValidatedFieldName(columnName); final Map<String, String> propertyMap = new HashMap<>(); final String type = getType(column); propertyMap.put("type", type); propertiesMap.put(fieldName, propertyMap); } HashMap<String, Map<String, Map<String, String>>> docTypeMap = new HashMap<>(); docTypeMap.put("properties", propertiesMap); final Map<String, Map<String, Map<String, Map<String, String>>>> mapping = new HashMap<>(); mapping.put(table.getName(), docTypeMap); return mapping; }
private Column getTextContentColumn(MutableTable table, String preferredColumnName) { MutableColumn column = null; for (Column col : table.getColumns()) { if (NATIVE_TYPE_TEXT.equals(col.getNativeType())) { column = (MutableColumn) col; break; } } if (column == null && preferredColumnName != null) { logger.info("Creating text content column for table: " + table.getName()); column = new MutableColumn(preferredColumnName + TEXT_CONTENT_TEMP_SUFFIX, ColumnType.STRING, table, table .getColumnCount(), true); column.setNativeType(NATIVE_TYPE_TEXT); table.addColumn(column); } return column; }
private Collection<List<Object[]>> runTransformer(JsonNode data) { final DataSetHeader header = new SimpleDataSetHeader(table.getColumns()); final List<Throwable> errors = new ArrayList<>(); final AtomicInteger tasksPending = new AtomicInteger();
@Override public OutputDataStreamBuilder likeTable(final Table table) { final List<Column> existingColumns = _table.getColumns(); for (final Column column : existingColumns) { _table.removeColumn(column); } final List<Column> newColumns = table.getColumns(); for (final Column column : newColumns) { withColumn(column.getName(), column.getType()); } return this; }
private MutableColumn getIdColumn(MutableTable table) { MutableColumn column = null; for (Column col : table.getColumns()) { if (NATIVE_TYPE_PRIMARY_KEY.equals(col.getNativeType())) { column = (MutableColumn) col; break; } } if (column == null) { String tableName = table.getName(); logger.info("Creating id column for table: " + tableName); column = new MutableColumn(tableName + "_metamodel_surrogate_id", ColumnType.INTEGER, table, table .getColumnCount(), false); column.setNativeType(NATIVE_TYPE_PRIMARY_KEY); column.setIndexed(true); table.addColumn(column); } return column; }
List<Column> primaryColumns = new ArrayList<Column>(primaryTable.getColumns()); List<Column> foreignColumns = new ArrayList<Column>(foreignTable.getColumns()); + primaryTableName); if (logger.isDebugEnabled()) { logger.debug(primaryTableName + " columns: " + Arrays.toString(primaryTable.getColumns().toArray()));
final List<Column> currentColumns = new ArrayList<>(existingTable.getColumns()); for (final Column column : currentColumns) { jobBuilder.removeSourceColumn(column);
@Override public Table execute() { final ExcelUpdateCallback updateCallback = getUpdateCallback(); final MutableTable table = getTable(); final Sheet sheet = updateCallback.createSheet(table.getName()); final int lineNumber = updateCallback.getConfiguration().getColumnNameLineNumber(); if (lineNumber != ExcelConfiguration.NO_COLUMN_NAME_LINE) { final int zeroBasedLineNumber = lineNumber - 1; final Row row = sheet.createRow(zeroBasedLineNumber); for (final Column column : table.getColumns()) { final int columnNumber = column.getColumnNumber(); row.createCell(columnNumber).setCellValue(column.getName()); } } final MutableSchema schema = (MutableSchema) getSchema(); schema.addTable((MutableTable) table); return table; } }
@Override public Table execute() { final ExcelUpdateCallback updateCallback = getUpdateCallback(); final MutableTable table = getTable(); final Sheet sheet = updateCallback.createSheet(table.getName()); final int lineNumber = updateCallback.getConfiguration().getColumnNameLineNumber(); if (lineNumber != ExcelConfiguration.NO_COLUMN_NAME_LINE) { final int zeroBasedLineNumber = lineNumber - 1; final Row row = sheet.createRow(zeroBasedLineNumber); for (final Column column : table.getColumns()) { final int columnNumber = column.getColumnNumber(); row.createCell(columnNumber).setCellValue(column.getName()); } } final MutableSchema schema = (MutableSchema) getSchema(); schema.addTable((MutableTable) table); return table; } }
final ProvisionedThroughput provisionedThroughput = new ProvisionedThroughput(readCapacity, writeCapacity); for (Column column : table.getColumns()) { if (column.isPrimaryKey()) { final KeyType keyType = getKeyType(column.getRemarks());