本文整理汇总了Java中org.apache.metamodel.schema.ColumnType类的典型用法代码示例。如果您正苦于以下问题:Java ColumnType类的具体用法?Java ColumnType怎么用?Java ColumnType使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ColumnType类属于org.apache.metamodel.schema包,在下文中一共展示了ColumnType类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: addColumn
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
private void addColumn(Column rawColumn, MTable mTable) {
String columnName = rawColumn.getName();
ColumnType columnType = rawColumn.getType();
if (ColumnType.STRING.getName().equalsIgnoreCase(columnType.getName())) {
columnType = ColumnTypeImpl.convertColumnType(Types.VARCHAR);
}
int jdbcType = columnType.getJdbcType();
int typeInfo = -1;
if (jdbcType == Types.VARCHAR) {
Integer columnSize = rawColumn.getColumnSize();
if (columnSize == null) {
// FIXME: what is the proper length value?
typeInfo = 128;
} else {
typeInfo = columnSize;
}
}
LOG.debug("add column. columnName=" + columnName + ", jdbcType=" + jdbcType + ", typeInfo=" + typeInfo);
MColumn mColumn = new MColumn(columnName, jdbcType, typeInfo, mTable);
pm.makePersistent(mColumn);
}
开发者ID:bitnine-oss,项目名称:octopus,代码行数:23,代码来源:JDOMetaContext.java
示例2: SimpleTableDefPanel
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
public SimpleTableDefPanel(final SimpleTableDef tableDef) {
_tableName = tableDef.getName();
final String[] names = tableDef.getColumnNames();
final ColumnType[] types = tableDef.getColumnTypes();
_tableModel = new DefaultTableModel(new String[] { "Field name", "Type" }, 0);
for (int i = 0; i < names.length; i++) {
addField(names[i], types[i]);
}
_table = new DCTable(_tableModel);
_table.setSortable(false);
_table.setColumnControlVisible(false);
_table.setRowHeight(DCTable.EDITABLE_TABLE_ROW_HEIGHT);
setLayout(new BorderLayout());
add(createButtonPanel(), BorderLayout.NORTH);
add(_table.toPanel(), BorderLayout.CENTER);
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:20,代码来源:SimpleTableDefPanel.java
示例3: addField
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
private void addField(String name, ColumnType columnType) {
if (name == null) {
name = "";
}
final JXTextField nameTextField = WidgetFactory.createTextField();
nameTextField.setText(name);
if (columnType == null) {
columnType = ColumnType.VARCHAR;
}
final DCComboBox<ColumnType> typeComboBox = new DCComboBox<>(getAvailableColumnTypes());
typeComboBox.setRenderer(new EnumComboBoxListRenderer());
typeComboBox.setSelectedItem(columnType);
_tableModel.addRow(new Object[] { nameTextField, typeComboBox });
updateUI();
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:18,代码来源:SimpleTableDefPanel.java
示例4: createMetadata
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
private AnalysisJobMetadata createMetadata() {
final String jobName = "job-name";
final String jobVersion = "job-version";
final String jobDescription = "job-description";
final String author = "author";
final Date createdDate = new Date();
final Date updatedDate = new Date();
final String datastoreName = "orderdb";
final List<String> sourceColumnPaths = new ArrayList<>();
final List<ColumnType> sourceColumnTypes = new ArrayList<>();
final Map<String, String> variables = new HashMap<>();
final Map<String, String> properties = new HashMap<>();
return new ImmutableAnalysisJobMetadata(jobName, jobVersion, jobDescription, author, createdDate, updatedDate,
datastoreName, sourceColumnPaths, sourceColumnTypes, variables, properties);
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:17,代码来源:OpenAnalysisJobAsTemplateDialogTest.java
示例5: testInitializeReordered
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
public void testInitializeReordered() throws Exception {
final DataCleanerConfiguration configuration = new DataCleanerConfigurationImpl();
try (AnalysisJobBuilder ajb = new AnalysisJobBuilder(configuration)) {
ajb.addSourceColumn(new MutableColumn("foo", ColumnType.VARCHAR));
ajb.addSourceColumn(new MutableColumn("bar", ColumnType.VARCHAR));
ajb.addSourceColumn(new MutableColumn("baz", ColumnType.NVARCHAR));
final AnalyzerComponentBuilder<StringAnalyzer> beanJobBuilder = ajb.addAnalyzer(StringAnalyzer.class);
final ConfiguredPropertyDescriptor property =
beanJobBuilder.getDescriptor().getConfiguredPropertiesForInput().iterator().next();
// initialize with "baz" + "foo"
final MultipleInputColumnsPropertyWidget widget =
new MultipleInputColumnsPropertyWidget(beanJobBuilder, property);
final InputColumn<?>[] value =
new InputColumn[] { ajb.getSourceColumnByName("baz"), ajb.getSourceColumnByName("foo") };
widget.initialize(value);
assertEquals("baz,foo,bar", getAvailableCheckBoxValues(widget));
assertEquals("[MetaModelInputColumn[baz], MetaModelInputColumn[foo]]", Arrays.toString(widget.getValue()));
}
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:24,代码来源:MultipleInputColumnsPropertyWidgetTest.java
示例6: getOutputDataStreams
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
public OutputDataStream[] getOutputDataStreams() {
final OutputDataStreamBuilder builder = OutputDataStreams.pushDataStream(OUTPUT_DATA_STREAM_NAME);
boolean foundOutputDataStream = false;
for (final CoalesceUnit unit : _units) {
// Not necessarily initialized yet, so no _initializedUnits available
final InputColumn<?>[] updatedInputColumns = unit.getUpdatedInputColumns(_inputs, false);
if (unit.getInputColumnNames().length == updatedInputColumns.length) {
// Valid Unit
foundOutputDataStream = true;
final CoalesceUnit updatedCoalesceUnit = unit.getUpdatedCoalesceUnit(updatedInputColumns);
final Class<?> dataType = updatedCoalesceUnit.getOutputDataType();
final String columnName = updatedCoalesceUnit.getSuggestedOutputColumnName();
final ColumnType columnType = ColumnTypeImpl.convertColumnType(dataType);
builder.withColumn(columnName, columnType);
} else {
logger.info("Missing columns detected, skipping coalesce unit");
}
}
if (!foundOutputDataStream) {
return new OutputDataStream[0];
}
return new OutputDataStream[] { builder.toOutputDataStream() };
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:25,代码来源:FuseStreamsComponent.java
示例7: setUp
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
if (jdbcDatastore == null) {
jdbcDatastore = new JdbcDatastore("my datastore", "jdbc:hsqldb:mem:UpdateTable_testErrorHandlingOption",
"org.hsqldb.jdbcDriver");
final UpdateableDatastoreConnection con = jdbcDatastore.openConnection();
final UpdateableDataContext dc = con.getUpdateableDataContext();
if (dc.getDefaultSchema().getTableByName("test_table") == null) {
dc.executeUpdate(cb -> {
final Table table = cb.createTable(dc.getDefaultSchema(), "test_table").withColumn("foo")
.ofType(ColumnType.VARCHAR).withColumn("bar").ofType(ColumnType.INTEGER).withColumn("baz")
.ofType(ColumnType.VARCHAR).execute();
cb.insertInto(table).value("foo", "a").value("bar", 1).value("baz", "lorem").execute();
cb.insertInto(table).value("foo", "b").value("bar", 2).value("baz", "ipsum").execute();
cb.insertInto(table).value("foo", "c").value("bar", 3).value("baz", "dolor").execute();
cb.insertInto(table).value("foo", "d").value("bar", 4).value("baz", "sit").execute();
cb.insertInto(table).value("foo", "e").value("bar", 5).value("baz", "amet").execute();
});
}
con.close();
}
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:25,代码来源:UpdateTableAnalyzerTest.java
示例8: shouldReturnAStringTypeForLiteralColumn
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Test
public void shouldReturnAStringTypeForLiteralColumn() {
final Column literalColumn = new MutableColumn("foo", ColumnType.CHAR);
Object result = TypeConverter.convertType("bla", literalColumn);
assertTrue(result instanceof String);
assertEquals("bla", result);
result = TypeConverter.convertType(24, literalColumn);
assertTrue(result instanceof String);
assertEquals("24", result);
result = TypeConverter.convertType(24.3d, literalColumn);
assertTrue(result instanceof String);
assertEquals("24.3", result);
result = TypeConverter.convertType(dateValue, literalColumn);
assertTrue(result instanceof String);
assertEquals(dateValue.toString(), result);
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:22,代码来源:TypeConverterTest.java
示例9: setUp
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
updateableDatastore = new PojoDatastore("my datastore");
final UpdateableDatastoreConnection con = updateableDatastore.openConnection();
final UpdateableDataContext dc = con.getUpdateableDataContext();
if (dc.getDefaultSchema().getTableByName(TEST_TABLE_NAME) == null) {
dc.executeUpdate(cb -> {
cb.createTable(dc.getDefaultSchema(), TEST_TABLE_NAME).withColumn(VARCHAR_COLUMN_NAME)
.ofType(ColumnType.VARCHAR).withColumn(INTEGER_COLUMN_NAME).ofType(ColumnType.INTEGER)
.execute();
cb.insertInto(TEST_TABLE_NAME).value(VARCHAR_COLUMN_NAME, VARCHAR_COLUMN_VALUE)
.value(INTEGER_COLUMN_NAME, INTEGER_COLUMN_VALUE).execute();
});
}
con.close();
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:17,代码来源:DeleteFromTableAnalyzerTest.java
示例10: addColumnToOutputStream
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
public void addColumnToOutputStream(final OutputDataStreamBuilder outputDataStreamBuilder,
final InputColumn<?> inputColumn) {
switch (this) {
case FIRST_VALUE:
case LAST_VALUE:
case RANDOM_VALUE:
outputDataStreamBuilder.withColumnLike(inputColumn);
break;
case SUM:
case AVG:
outputDataStreamBuilder.withColumn(inputColumn.getName(), ColumnType.NUMBER);
break;
case CONCAT_VALUES:
outputDataStreamBuilder.withColumn(inputColumn.getName(), ColumnType.STRING);
break;
case CREATE_LIST:
outputDataStreamBuilder.withColumn(inputColumn.getName(), ColumnType.LIST);
break;
default:
throw new UnsupportedOperationException("Unsupported aggregation type: " + this);
}
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:24,代码来源:GrouperTransformer.java
示例11: getOutputDataStreams
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
public OutputDataStream[] getOutputDataStreams() {
final OutputDataStreamBuilder outputDataStreamBuilder = OutputDataStreams.pushDataStream("output");
outputDataStreamBuilder.withColumnLike(groupKey);
outputDataStreamBuilder.withColumn("row_count", ColumnType.INTEGER);
for (int i = 0; i < aggregatedValues.length; i++) {
final InputColumn<?> inputColumn = aggregatedValues[i];
final AggregationType aggregationType =
(aggregationTypes.length <= i ? AggregationType.CREATE_LIST : aggregationTypes[i]);
if (aggregationType != null) {
aggregationType.addColumnToOutputStream(outputDataStreamBuilder, inputColumn);
}
}
final OutputDataStream stream = outputDataStreamBuilder.toOutputDataStream();
return new OutputDataStream[] { stream };
}
开发者ID:datacleaner,项目名称:DataCleaner,代码行数:19,代码来源:GrouperTransformer.java
示例12: convert
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
private Object convert(String stringValue, ColumnType type) {
if (stringValue == null || stringValue.length() == 0) {
return null;
}
if (type == ColumnType.FLOAT) {
return Float.parseFloat(stringValue);
} else if (type == ColumnType.DOUBLE) {
return Double.parseDouble(stringValue);
} else if (type == ColumnType.DATE) {
try {
Date date = new SimpleDateFormat("yyyyMMdd").parse(stringValue);
return date;
} catch (ParseException e) {
throw new IllegalArgumentException(stringValue);
}
} else {
return stringValue;
}
}
开发者ID:datacleaner,项目名称:metamodel_extras,代码行数:21,代码来源:DbaseDataContext.java
示例13: setUp
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
protected void setUp() throws Exception {
super.setUp();
if (jdbcDatastore == null) {
jdbcDatastore = new JdbcDatastore("my datastore",
"jdbc:hsqldb:mem:InsertIntoTable_testErrorHandlingOption", "org.hsqldb.jdbcDriver");
final UpdateableDatastoreConnection con = jdbcDatastore.openConnection();
final UpdateableDataContext dc = con.getUpdateableDataContext();
if (dc.getDefaultSchema().getTableByName("test_table") == null) {
dc.executeUpdate(new UpdateScript() {
@Override
public void run(UpdateCallback cb) {
cb.createTable(dc.getDefaultSchema(), "test_table").withColumn("foo")
.ofType(ColumnType.VARCHAR).withColumn("bar").ofType(ColumnType.INTEGER).execute();
}
});
}
con.close();
}
}
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:21,代码来源:InsertIntoTableAnalyzerTest.java
示例14: testConfigurableBeanConfiguration
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
public void testConfigurableBeanConfiguration() throws Exception {
AnalysisJobBuilder ajb = new AnalysisJobBuilder(new AnalyzerBeansConfigurationImpl());
try {
List<TableDataProvider<?>> tableDataProviders = Collections.emptyList();
ajb.setDatastore(new PojoDatastore("ds", tableDataProviders));
ajb.addSourceColumn(new MutableColumn("foo", ColumnType.VARCHAR));
AnalyzerJobBuilder<CompletenessAnalyzer> analyzer = ajb.addAnalyzer(CompletenessAnalyzer.class);
analyzer.getConfigurableBean().setValueColumns(ajb.getSourceColumns().toArray(new InputColumn[0]));
analyzer.getConfigurableBean().fillAllConditions(Condition.NOT_BLANK_OR_NULL);
assertTrue(analyzer.isConfigured(true));
} finally {
ajb.close();
}
}
开发者ID:datacleaner,项目名称:AnalyzerBeans,代码行数:17,代码来源:CompletenessAnalyzerTest.java
示例15: getColumnType
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
private ColumnType getColumnType(ValueMetaInterface valueMeta) {
switch (valueMeta.getType()) {
case ValueMetaInterface.TYPE_STRING:
return ColumnType.VARCHAR;
case ValueMetaInterface.TYPE_INTEGER:
return ColumnType.INTEGER;
case ValueMetaInterface.TYPE_DATE:
return ColumnType.DATE;
case ValueMetaInterface.TYPE_BOOLEAN:
return ColumnType.BOOLEAN;
case ValueMetaInterface.TYPE_NUMBER:
return ColumnType.DOUBLE;
case ValueMetaInterface.TYPE_BINARY:
return ColumnType.BINARY;
case ValueMetaInterface.TYPE_BIGNUMBER:
return ColumnType.DECIMAL;
}
throw new RuntimeException("It is currently not possible to profile values of type: " + valueMeta.getTypeDesc());
}
开发者ID:datacleaner,项目名称:pdi-datacleaner,代码行数:20,代码来源:KettleDataContext.java
示例16: getMainSchema
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
protected Schema getMainSchema() throws MetaModelException {
final MutableSchema schema = new MutableSchema(_schemaName);
final MutableTable primaryTable = new MutableTable(_tableName).setSchema(schema);
primaryTable.addColumn(new MutableColumn("foo").setColumnNumber(0).setType(ColumnType.VARCHAR)
.setTable(primaryTable));
primaryTable.addColumn(new MutableColumn("bar").setColumnNumber(1).setType(ColumnType.VARCHAR)
.setTable(primaryTable));
primaryTable.addColumn(new MutableColumn("baz").setColumnNumber(2).setType(ColumnType.VARCHAR)
.setTable(primaryTable));
final MutableTable emptyTable = new MutableTable("an_empty_table").setSchema(schema);
emptyTable.addColumn(new MutableColumn("foo").setColumnNumber(0).setType(ColumnType.VARCHAR)
.setTable(emptyTable));
emptyTable.addColumn(new MutableColumn("bar").setColumnNumber(1).setType(ColumnType.VARCHAR)
.setTable(emptyTable));
schema.addTable(primaryTable);
schema.addTable(emptyTable);
return schema;
}
开发者ID:apache,项目名称:metamodel,代码行数:24,代码来源:MockDataContext.java
示例17: createColumns
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
/**
* Builds columns based on row/cell values.
*
* @param table
* @param wb
* @param row
*/
private void createColumns(MutableTable table, Workbook wb, Row row) {
if (row == null) {
logger.warn("Cannot create columns based on null row!");
return;
}
final short rowLength = row.getLastCellNum();
final int offset = getColumnOffset(row);
// build columns based on cell values.
try (final ColumnNamingSession columnNamingSession = _configuration.getColumnNamingStrategy()
.startColumnNamingSession()) {
for (int j = offset; j < rowLength; j++) {
final Cell cell = row.getCell(j);
final String intrinsicColumnName = ExcelUtils.getCellValue(wb, cell);
final ColumnNamingContext columnNamingContext = new ColumnNamingContextImpl(table, intrinsicColumnName,
j);
final String columnName = columnNamingSession.getNextColumnName(columnNamingContext);
final Column column = new MutableColumn(columnName, ColumnType.VARCHAR, table, j, true);
table.addColumn(column);
}
}
}
开发者ID:apache,项目名称:metamodel,代码行数:31,代码来源:DefaultSpreadsheetReaderDelegate.java
示例18: getExpectedColumnType
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
/**
* Tries to infer the {@link ColumnType} of this {@link SelectItem}. For expression based select items, this is not
* possible, and the method will return null.
*
* @return
*/
public ColumnType getExpectedColumnType() {
if (_subQuerySelectItem != null) {
return _subQuerySelectItem.getExpectedColumnType();
}
if (_function != null) {
if (_column != null) {
return _function.getExpectedColumnType(_column.getType());
} else {
return _function.getExpectedColumnType(null);
}
}
if (_column != null) {
return _column.getType();
}
return null;
}
开发者ID:apache,项目名称:metamodel,代码行数:23,代码来源:SelectItem.java
示例19: getMainSchema
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
protected Schema getMainSchema() throws MetaModelException {
if (_schema == null) {
MutableSchema schema = new MutableSchema(getMainSchemaName());
for (SimpleTableDef tableDef : _tableDefs) {
MutableTable table = tableDef.toTable().setSchema(schema);
List<Column> rowIdColumns = table.getColumnsOfType(ColumnType.ROWID);
for (Column column : rowIdColumns) {
if (column instanceof MutableColumn) {
((MutableColumn) column).setPrimaryKey(true);
}
}
schema.addTable(table);
}
_schema = schema;
}
return _schema;
}
开发者ID:apache,项目名称:metamodel,代码行数:22,代码来源:MongoDbDataContext.java
示例20: rewriteColumnType
import org.apache.metamodel.schema.ColumnType; //导入依赖的package包/类
@Override
public String rewriteColumnType(ColumnType columnType, Integer columnSize) {
if (columnType == ColumnType.INTEGER) {
return "INT";
}
if(columnType == ColumnType.STRING) {
return "STRING";
}
// Hive does not support VARCHAR without a width, nor VARCHAR(MAX).
// Returning max allowable column size instead.
if (columnType == ColumnType.VARCHAR && columnSize == null) {
return super.rewriteColumnType(columnType, 65535);
}
return super.rewriteColumnType(columnType, columnSize);
}
开发者ID:apache,项目名称:metamodel,代码行数:18,代码来源:HiveQueryRewriter.java
注:本文中的org.apache.metamodel.schema.ColumnType类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论