Java Code Examples for org.pentaho.metadata.model.concept.types.DataType#STRING

The following examples show how to use org.pentaho.metadata.model.concept.types.DataType#STRING . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: PhysicalTableImporter.java    From pentaho-metadata with GNU Lesser General Public License v2.1 6 votes vote down vote up
private static DataType getDataType( ValueMetaInterface v ) {
  switch ( v.getType() ) {
    case ValueMetaInterface.TYPE_BIGNUMBER:
    case ValueMetaInterface.TYPE_INTEGER:
    case ValueMetaInterface.TYPE_NUMBER:
      return DataType.NUMERIC;
    case ValueMetaInterface.TYPE_BINARY:
      return DataType.BINARY;
    case ValueMetaInterface.TYPE_BOOLEAN:
      return DataType.BOOLEAN;
    case ValueMetaInterface.TYPE_DATE:
    case ValueMetaInterface.TYPE_TIMESTAMP:
      return DataType.DATE;
    case ValueMetaInterface.TYPE_STRING:
      return DataType.STRING;
    case ValueMetaInterface.TYPE_NONE:
    default:
      return DataType.UNKNOWN;
  }
  // the enum data type no longer supports length and precision
  // dataTypeSettings.setLength(v.getLength());
  // dataTypeSettings.setPrecision(v.getPrecision());

}
 
Example 2
Source File: MQLEditorServiceCWMDelegate.java    From mql-editor with GNU Lesser General Public License v2.1 6 votes vote down vote up
private DataType getDataType( ColumnType type ) {
  switch ( type ) {
    case BOOLEAN:
      return DataType.BOOLEAN;
    case DATE:
      return DataType.DATE;
    case FLOAT:
    case NUMERIC:
      return DataType.NUMERIC;
    case TEXT:
      return DataType.STRING;
    default:
      return DataType.UNKNOWN;

  }
}
 
Example 3
Source File: MQLEditorServiceDelegate.java    From mql-editor with GNU Lesser General Public License v2.1 6 votes vote down vote up
private DataType getDataType( ColumnType type ) {
  switch ( type ) {
    case BOOLEAN:
      return DataType.BOOLEAN;
    case DATE:
      // As we are crafting an open formula function to handle dates, the parameter data type needs to be a String.
      // This will eventually be handled by the Metadata layer.
      return DataType.STRING;
      // return DataType.DATE;
    case FLOAT:
    case NUMERIC:
      return DataType.NUMERIC;
    case TEXT:
      return DataType.STRING;
    default:
      return DataType.UNKNOWN;

  }
}
 
Example 4
Source File: CsvDataTypeEvaluator.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
public DataType evaluateDataType( List<String> columnValues ) {
  CountItemsList<DataType> columnTypes = new CountItemsList<DataType>();
  for ( String value : columnValues ) {
    DataType type = DataTypeDetector.getDataType( value );
    if ( type == DataType.STRING ) {
      return DataType.STRING;
    }
    columnTypes.add( type );
  }
  return columnTypes.getItemOfMaxCount();
}
 
Example 5
Source File: SQLModelGenerator.java    From pentaho-metadata with GNU Lesser General Public License v2.1 5 votes vote down vote up
private static DataType converDataType( int type ) {
  switch ( type ) {
    case Types.FLOAT:
    case Types.BIT:
    case Types.DOUBLE:
    case Types.SMALLINT:
    case Types.REAL:
    case Types.DECIMAL:
    case Types.BIGINT:
    case Types.INTEGER:
    case Types.NUMERIC:
      return DataType.NUMERIC;

    case Types.BINARY:
    case Types.CLOB:
    case Types.BLOB:
      return DataType.BINARY;

    case Types.BOOLEAN:
      return DataType.BOOLEAN;

    case Types.DATE:
      return DataType.DATE;

    case Types.TIMESTAMP:
      return DataType.DATE;

    case Types.LONGVARCHAR:
    case Types.VARCHAR:
      return DataType.STRING;

    default:
      return DataType.UNKNOWN;
  }
}