public static Schema wrapIfAppropriate(Schema schema) { if (schema.getTableCount() > 1) { return schema; } else { return new DefaultTableAliasedSchema(schema); } }
public static Schema wrapIfAppropriate(Schema schema) { if (schema.getTableCount() > 1) { return schema; } else { return new DefaultTableAliasedSchema(schema); } }
protected Table getPreviewTable(final DataContext dc) { final Schema schema = dc.getDefaultSchema(); if (schema.getTableCount() == 0) { return null; } return schema.getTable(0); }
name = name.toLowerCase(); final boolean isInformationSchema = name.startsWith("information") && name.endsWith("schema"); if (!isInformationSchema && schema.getTableCount() > highestTableCount) { highestTableCount = schema.getTableCount(); result = schema;
name = name.toLowerCase(); final boolean isInformationSchema = name.startsWith("information") && name.endsWith("schema"); if (!isInformationSchema && schema.getTableCount() > highestTableCount) { highestTableCount = schema.getTableCount(); result = schema;
private void validateCsvHeaders(final CsvDataContext dc) { final Schema schema = dc.getDefaultSchema(); if (schema.getTableCount() == 0) { // nothing to worry about, we will create the table ourselves return; } final Table table = schema.getTable(0); // verify that table names correspond to what we need! for (final String columnName : conditionColumnNames) { final Column column = table.getColumnByName(columnName); if (column == null) { throw new IllegalStateException("Error log file does not have required column header: " + columnName); } } final Column column = table.getColumnByName(ERROR_MESSAGE_COLUMN_NAME); if (column == null) { throw new IllegalStateException( "Error log file does not have required column: " + ERROR_MESSAGE_COLUMN_NAME); } }
private void setSchemaTree(final Datastore datastore, final boolean expandTree, final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTableCount(); if (datastoreSize == 1) { _schemaTreePanel.setDatastore(datastore, true); } else { _schemaTreePanel.setDatastore(datastore, expandTree); } } }
private void addTableToSource(final DatastoreConnection con) { if (con != null) { final Schema defaultSchema = con.getSchemaNavigator().getDefaultSchema(); final int datastoreSize = defaultSchema.getTableCount(); if (datastoreSize == 1) { final List<Column> columns = defaultSchema.getTable(0).getColumns(); _analysisJobBuilder.addSourceColumns(columns); } } }
private void validateCsvHeaders(final CsvDataContext dc) { final Schema schema = dc.getDefaultSchema(); if (schema.getTableCount() == 0) {
private void validateCsvHeaders(final CsvDataContext dc) { final Schema schema = dc.getDefaultSchema(); if (schema.getTableCount() == 0) { // nothing to worry about, we will create the table ourselves return; } final Table table = schema.getTable(0); // verify that table names correspond to what we need! for (final String columnName : columnNames) { final Column column = table.getColumnByName(columnName); if (column == null) { throw new IllegalStateException("Error log file does not have required column header: " + columnName); } } if (additionalErrorLogValues != null) { for (final InputColumn<?> inputColumn : additionalErrorLogValues) { final String columnName = translateAdditionalErrorLogColumnName(inputColumn.getName()); final Column column = table.getColumnByName(columnName); if (column == null) { throw new IllegalStateException( "Error log file does not have required column header: " + columnName); } } } final Column column = table.getColumnByName(ERROR_MESSAGE_COLUMN_NAME); if (column == null) { throw new IllegalStateException( "Error log file does not have required column: " + ERROR_MESSAGE_COLUMN_NAME); } }
public void setSchema(final Datastore datastore, final Schema schema) { _panelAroundButton.setVisible(CreateTableDialog.isCreateTableAppropriate(datastore, schema)); final String previousValue = getValue(); _schemaRef.set(schema); _datastoreRef.set(datastore); if (schema == null) { _comboBox.setModel(new DefaultComboBoxModel<>(new Table[1])); } else { final List<Table> tables = new ArrayList<>(schema.getTables()); tables.add(0, null); _comboBox.setModel(new DefaultComboBoxModel<>(tables.toArray(new Table[0]))); if (previousValue == null) { if (schema.getTableCount() == 1) { // if there is only 1 table, select that final Table table = schema.getTable(0); _comboBox.setSelectedItem(table); } } else { // select table by name final Table table = schema.getTableByName(previousValue); _comboBox.setSelectedItem(table); } } }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof Schema) { Schema other = (Schema) obj; EqualsBuilder eb = new EqualsBuilder(); eb.append(getName(), other.getName()); eb.append(getQuote(), other.getQuote()); if (eb.isEquals()) { try { int tableCount1 = getTableCount(); int tableCount2 = other.getTableCount(); eb.append(tableCount1, tableCount2); } catch (Exception e) { // might occur when schemas are disconnected. Omit this // check then. } } return eb.isEquals(); } return false; }
@Override public boolean equals(Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if (obj instanceof Schema) { Schema other = (Schema) obj; EqualsBuilder eb = new EqualsBuilder(); eb.append(getName(), other.getName()); eb.append(getQuote(), other.getQuote()); if (eb.isEquals()) { try { int tableCount1 = getTableCount(); int tableCount2 = other.getTableCount(); eb.append(tableCount1, tableCount2); } catch (Exception e) { // might occur when schemas are disconnected. Omit this // check then. } } return eb.isEquals(); } return false; }