public CreateTable(Schema schema, String tableName) { _table = new MutableTable(tableName, TableType.TABLE, schema); }
public CreateTable(Schema schema, String tableName) { _table = new MutableTable(tableName, TableType.TABLE, schema); }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("sheet".equals(qName)) { String name = attributes.getValue("name"); assert name != null; String relationId = attributes.getValue("r:id"); assert relationId != null; if (_schema != null) { MutableTable table = new MutableTable(name, TableType.TABLE, _schema); _schema.addTable(table); } _tableNamesToRelationshipIds.put(name, relationId); } } }
@Override public void startElement(String uri, String localName, String qName, Attributes attributes) throws SAXException { if ("sheet".equals(qName)) { String name = attributes.getValue("name"); assert name != null; String relationId = attributes.getValue("r:id"); assert relationId != null; if (_schema != null) { MutableTable table = new MutableTable(name, TableType.TABLE, _schema); _schema.addTable(table); } _tableNamesToRelationshipIds.put(name, relationId); } } }
public AbstractTableCreationBuilder(U updateCallback, Schema schema, String name) { if (schema != null && schema.getTableByName(name) != null) { throw new IllegalArgumentException("A table with the name '" + name + "' already exists in schema: " + schema); } _updateCallback = updateCallback; _schema = MetaModelHelper.resolveUnderlyingSchema(schema); _table = new MutableTable(name, TableType.TABLE, schema); }
public AbstractTableCreationBuilder(U updateCallback, Schema schema, String name) { if (schema != null && schema.getTableByName(name) != null) { throw new IllegalArgumentException("A table with the name '" + name + "' already exists in schema: " + schema); } _updateCallback = updateCallback; _schema = MetaModelHelper.resolveUnderlyingSchema(schema); _table = new MutableTable(name, TableType.TABLE, schema); }
public CreateTable(String schemaName, String tableName) { _table = new MutableTable(tableName, TableType.TABLE, new MutableSchema(schemaName)); }
public CreateTable(String schemaName, String tableName) { _table = new MutableTable(tableName, TableType.TABLE, new MutableSchema(schemaName)); }
OutputDataStreamBuilderImpl(final String name) { _name = name; final MutableSchema schema = new MutableSchema(); schema.setName(null); _table = new MutableTable(name, TableType.TABLE, schema); schema.addTable(_table); }
@Override public MutableSchema build() { MutableSchema schema = new MutableSchema(_schemaName); MutableTable table = new MutableTable(_tableName, schema); table.addColumn(new MutableColumn(_columnName, ColumnType.MAP, table, 1, null, null, false, null, false, null)); schema.addTable(table); return schema; }
@Override public MutableSchema build() { MutableSchema schema = new MutableSchema(_schemaName); MutableTable table = new MutableTable(_tableName, schema); table.addColumn(new MutableColumn(_columnName, ColumnType.MAP, table, 1, null, null, false, null, false, null)); schema.addTable(table); return schema; }
/** * Creates a {@link MutableTable} based on this {@link SimpleTableDef}. Note * that the created table will not have any schema set. * * @return a table representation of this table definition. */ public MutableTable toTable() { String name = getName(); String[] columnNames = getColumnNames(); ColumnType[] columnTypes = getColumnTypes(); MutableTable table = new MutableTable(name, TableType.TABLE); for (int i = 0; i < columnNames.length; i++) { table.addColumn(new MutableColumn(columnNames[i], columnTypes[i], table, i, true)); } return table; }
/** * Creates a {@link MutableTable} based on this {@link SimpleTableDef}. Note * that the created table will not have any schema set. * * @return a table representation of this table definition. */ public MutableTable toTable() { String name = getName(); String[] columnNames = getColumnNames(); ColumnType[] columnTypes = getColumnTypes(); MutableTable table = new MutableTable(name, TableType.TABLE); for (int i = 0; i < columnNames.length; i++) { table.addColumn(new MutableColumn(columnNames[i], columnTypes[i], table, i, true)); } return table; }
@Override protected Schema getMainSchema() throws MetaModelException { final MutableSchema schema = new MutableSchema("sample_schema"); final MutableTable table = new MutableTable("sample_table", TableType.TABLE, schema); schema.addTable(table); table.addColumn(new MutableColumn("foo", ColumnType.INTEGER, table, 0, true)); table.addColumn(new MutableColumn("bar", ColumnType.VARCHAR, table, 1, true)); return schema; }
@Override public MutableTable buildTable() { final int tableObservations = getObservationCount(); // sort column names by copying them to a TreeSet final Set<String> columnNames = new TreeSet<String>(_columnBuilders.keySet()); final MutableTable table = new MutableTable(_tableName); int columnNumber = 0; for (final String columnName : columnNames) { final InferentialColumnBuilder columnBuilder = getColumnBuilder(columnName); final MutableColumn column = columnBuilder.build(); column.setTable(table); column.setColumnNumber(columnNumber); final int columnObservations = columnBuilder.getObservationCount(); if (tableObservations > columnObservations) { // there may be nulls - some records does not even contain the // column column.setNullable(true); } table.addColumn(column); columnNumber++; } return table; }
@Override protected void setValue(final String value) { if (value == null) { _comboBox.setSelectedItem(null); return; } if (_comboBox.getTable() == null) { final MutableTable placeholderTable = new MutableTable("table"); placeholderTable.addColumn(new MutableColumn(value, placeholderTable)); _comboBox.setModel(placeholderTable); } _comboBox.setSelectedItem(value); fireValueChanged(value); }
@Override protected void setValue(final String value) { if (getValue() == value) { return; } final Schema schema = _schemaRef.get(); final Table table; if (value == null) { table = null; } else if (schema == null) { table = new MutableTable(value); } else { table = schema.getTableByName(value); } _comboBox.setEditable(true); _comboBox.setSelectedItem(table); _comboBox.setEditable(false); fireValueChanged(); }
@Override protected Schema getMainSchema() throws MetaModelException { final MutableSchema schema = new MutableSchema(getMainSchemaName()); final Collection<String> topics = topicSupplier.get(); for (String topic : topics) { final MutableTable table = new MutableTable(topic, schema); table.addColumn(new MutableColumn(COLUMN_PARTITION, ColumnType.INTEGER, table).setPrimaryKey(true)); table.addColumn(new MutableColumn(COLUMN_OFFSET, ColumnType.BIGINT, table).setPrimaryKey(true)); table.addColumn(new MutableColumn(COLUMN_TIMESTAMP, ColumnType.TIMESTAMP, table)); table.addColumn(new MutableColumn(COLUMN_KEY, ColumnTypeImpl.convertColumnType(keyClass), table)); table.addColumn(new MutableColumn(COLUMN_VALUE, ColumnTypeImpl.convertColumnType(valueClass), table)); schema.addTable(table); } return schema; }
@Override protected Schema getMainSchema() throws MetaModelException { final MutableSchema schema = new MutableSchema(getMainSchemaName()); final Collection<String> topics = topicSupplier.get(); for (String topic : topics) { final MutableTable table = new MutableTable(topic, schema); table.addColumn(new MutableColumn(COLUMN_PARTITION, ColumnType.INTEGER, table).setPrimaryKey(true)); table.addColumn(new MutableColumn(COLUMN_OFFSET, ColumnType.BIGINT, table).setPrimaryKey(true)); table.addColumn(new MutableColumn(COLUMN_TIMESTAMP, ColumnType.TIMESTAMP, table)); table.addColumn(new MutableColumn(COLUMN_KEY, ColumnTypeImpl.convertColumnType(keyClass), table)); table.addColumn(new MutableColumn(COLUMN_VALUE, ColumnTypeImpl.convertColumnType(valueClass), table)); schema.addTable(table); } return schema; }
@Override protected Schema getMainSchema() throws MetaModelException { final MutableSchema schema = new MutableSchema(getMainSchemaName()); for (XmlSaxTableDef tableDef : _tableDefs) { final String rowXpath = tableDef.getRowXpath(); final MutableTable table = new MutableTable(getTableName(tableDef)).setSchema(schema).setRemarks("XPath: " + rowXpath); final MutableColumn rowIndexColumn = new MutableColumn(COLUMN_NAME_ROW_ID, ColumnType.INTEGER) .setColumnNumber(0).setNullable(false).setTable(table).setRemarks("Row/tag index (0-based)"); table.addColumn(rowIndexColumn); for (String valueXpath : tableDef.getValueXpaths()) { final MutableColumn column = new MutableColumn(getName(tableDef, valueXpath)).setRemarks("XPath: " + valueXpath); if (valueXpath.startsWith("index(") && valueXpath.endsWith(")")) { column.setType(ColumnType.INTEGER); } else { column.setType(ColumnType.STRING); } column.setTable(table); table.addColumn(column); } schema.addTable(table); } return new ImmutableSchema(schema); }