wsjz commented on issue #2729: Doris could not 'show tables' by JDBC
URL: 
https://github.com/apache/incubator-doris/issues/2729#issuecomment-573071387
 
 
   > I got the exception when attempted to use mysql connector to construct 
palo catalog for **Presto**.
   > with palo catalog, I could "show schemas" and "use", but when I performed 
"show tables", presto printed the exception:
   > 
   > java.sql.SQLException: 'TABLE' is not a number
   > at com.mysql.jdbc.SQLError.createSQLException(SQLError.java:965)
   > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3933)
   > at com.mysql.jdbc.MysqlIO.checkErrorPacket(MysqlIO.java:3869)
   > at com.mysql.jdbc.MysqlIO.sendCommand(MysqlIO.java:2524)
   > at com.mysql.jdbc.MysqlIO.sqlQueryDirect(MysqlIO.java:2675)
   > at com.mysql.jdbc.ConnectionImpl.execSQL(ConnectionImpl.java:2465)
   > at 
com.mysql.jdbc.PreparedStatement.executeInternal(PreparedStatement.java:1912)
   > at 
com.mysql.jdbc.PreparedStatement.executeQuery(PreparedStatement.java:2020)
   > at 
com.mysql.jdbc.DatabaseMetaDataUsingInfoSchema.executeMetadataQuery(DatabaseMetaDataUsingInfoSchema.java:65)
   > at 
com.mysql.jdbc.DatabaseMetaDataUsingInfoSchema.getTables(DatabaseMetaDataUsingInfoSchema.java:1190)
   
   for the mysql connector in presto,it uses  JDBC to connect mysql server,and 
we should get the table metadata first. but  I find JDBC will create the SQL 
when get table metadata:
   
   
   `SELECT
   TABLE_SCHEMA AS TABLE_CAT, NULL AS TABLE_SCHEM, TABLE_NAME,
    CASE WHEN TABLE_TYPE='BASE TABLE'
    THEN CASE WHEN TABLE_SCHEMA = 'mysql' OR TABLE_SCHEMA = 'performance_schema'
    THEN 'SYSTEM TABLE' ELSE 'TABLE'END WHEN TABLE_TYPE='TEMPORARY'
    THEN 'LOCAL_TEMPORARY' ELSE TABLE_TYPE END AS TABLE_TYPE, TABLE_COMMENT AS 
REMARKS, NULL AS TYPE_CAT, NULL AS TYPE_SCHEM, NULL AS TYPE_NAME, NULL AS 
SELF_REFERENCING_COL_NAME, NULL AS REF_GENERATION
    FROM INFORMATION_SCHEMA.TABLES
    WHERE TABLE_SCHEMA LIKE 'table_name'
    AND TABLE_NAME LIKE '%'
    HAVING TABLE_TYPE IN ('TABLE','VIEW',null,null,null)
    ORDER BY TABLE_TYPE, TABLE_SCHEMA, TABLE_NAME`
   
   That's the SQL that causes  " 'TABLE' is not a number "  as before.
   But when I take out the NULL from  IN predicate,it run successfully!!!
   That's to say, the NULL is regarded as type "number", so 'TABLE' and 'VIEW' 
in  IN predicate are also   "number" rather than "string".

----------------------------------------------------------------
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]


With regards,
Apache Git Services

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to