Hive2DatabaseMeta extends DatabaseMetaWithVersion { @Override public String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc, boolean addFieldname, boolean addCr ) { String retval = ""; String fieldname = v.getName(); int length = v.getLength(); int precision = v.getPrecision(); if ( addFieldname ) { retval += fieldname + " "; } int type = v.getType(); switch ( type ) { case ValueMetaInterface.TYPE_BOOLEAN: retval += "BOOLEAN"; break; case ValueMetaInterface.TYPE_DATE: retval += "DATE"; break; case ValueMetaInterface.TYPE_TIMESTAMP: retval += "TIMESTAMP"; break; case ValueMetaInterface.TYPE_STRING: retval += "STRING"; break; case ValueMetaInterface.TYPE_NUMBER: case ValueMetaInterface.TYPE_INTEGER: case ValueMetaInterface.TYPE_BIGNUMBER: if ( precision == 0 ) { if ( length > 9 ) { if ( length < 19 ) { retval += "BIGINT"; } else { retval += "FLOAT"; } } else { retval += "INT"; } } else { if ( length > 15 ) { retval += "FLOAT"; } else { retval += "DOUBLE"; } } break; } return retval; } Hive2DatabaseMeta( DriverLocator driverLocator, NamedClusterService namedClusterService,
                            MetastoreLocator metastoreLocator ); @Override int[] getAccessTypeList(); @Override String getAddColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc,
                                       String pk, boolean semicolon ); @Override String getDriverClass(); @Override String getFieldDefinition( ValueMetaInterface v, String tk, String pk, boolean useAutoinc,
                                    boolean addFieldname, boolean addCr ); @Override String getModifyColumnStatement( String tablename, ValueMetaInterface v, String tk, boolean useAutoinc,
                                          String pk, boolean semicolon ); @Override String getURL( String hostname, String port, String databaseName ); @Override String[] getUsedLibraries(); @Override String getSelectCountStatement( String tableName ); @Override String generateColumnAlias( int columnIndex, String suggestedName ); String getStartQuote(); String getEndQuote(); @Override String[] getTableTypes(); @Override String[] getViewTypes(); @Override String getTruncateTableStatement( String tableName ); @Override boolean supportsSetCharacterStream(); @Override boolean supportsBatchUpdates(); @Override boolean supportsTimeStampToDateConversion(); @Override List<String> getNamedClusterList(); @Override void putOptionalOptions( Map<String, String> extraOptions ); static final String URL_PREFIX; static final String SELECT_COUNT_1_FROM; static final String ALIAS_SUFFIX; static final String VIEW; static final String VIRTUAL_VIEW; static final String TRUNCATE_TABLE; static final int[] ACCESS_TYPE_LIST; }
@Test public void testGetFieldDefinition() { assertGetFieldDefinition( new ValueMetaInternetAddress(), "internetAddressName", "" ); }