lfyzjck commented on issue #2757: URL: https://github.com/apache/incubator-doris/issues/2757#issuecomment-647297399
Presto raise TableNotFoundException because it could not found any valid columns from Doris. I just found that the way Doris stored dataType is different with MySQL in `information_schema.columns` where Presto get table schema from. Doris:  MySQL:  The key is that dataType size is stored in other columns in MySQL. in Presto BaseJdbcClient.java ``` public List<JdbcColumnHandle> getColumns(ConnectorSession session, JdbcTableHandle tableHandle) { try (Connection connection = connectionFactory.openConnection(JdbcIdentity.from(session))) { try (ResultSet resultSet = getColumns(tableHandle, connection.getMetaData())) { List<JdbcColumnHandle> columns = new ArrayList<>(); while (resultSet.next()) { JdbcTypeHandle typeHandle = new JdbcTypeHandle( resultSet.getInt("DATA_TYPE"), resultSet.getInt("COLUMN_SIZE"), resultSet.getInt("DECIMAL_DIGITS")); Optional<ReadMapping> columnMapping = toPrestoType(session, typeHandle); // skip unsupported column types if (columnMapping.isPresent()) { String columnName = resultSet.getString("COLUMN_NAME"); boolean nullable = columnNullable == resultSet.getInt("NULLABLE"); columns.add(new JdbcColumnHandle(connectorId, columnName, typeHandle, columnMapping.get().getType(), nullable)); } } if (columns.isEmpty()) { // In rare cases (e.g. PostgreSQL) a table might have no columns. throw new TableNotFoundException(tableHandle.getSchemaTableName()); } return ImmutableList.copyOf(columns); } } catch (SQLException e) { throw new PrestoException(JDBC_ERROR, e); } } ``` ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
