Closed fcollin closed 3 years ago
Does MYCAT, MYDB or MYTABLE contain underscores _
?
yes they contain underscores !
Can you share actual query that's getting issued to Trino? Am i right they are not properly escaped?
ie. youre seeing
AND TABLE_NAME LIKE 'some_table' ESCAPE '\'
and not
AND TABLE_NAME LIKE 'some\_table' ESCAPE '\'
?
here is the request issued to Trino
SELECT TABLE_CAT, TABLE_SCHEM, TABLE_NAME, COLUMN_NAME, DATA_TYPE, TYPE_NAME, COLUMN_SIZE, BUFFER_LENGTH, DECIMAL_DIGITS, NUM_PREC_RADIX, NULLABLE, REMARKS, COLUMN_DEF, SQL_DATA_TYPE, SQL_DATETIME_SUB, CHAR_OCTET_LENGTH, ORDINAL_POSITION, IS_NULLABLE, SCOPE_CATALOG, SCOPE_SCHEMA, SCOPE_TABLE, SOURCE_DATA_TYPE, IS_AUTOINCREMENT, IS_GENERATEDCOLUMN FROM system.jdbc.columns WHERE TABLE_CAT = 'MY_HIVE_METASTORE' AND TABLE_SCHEM LIKE 'MY_HIVE_DB' ESCAPE '\ ' AND TABLE_NAME LIKE 'MY_HIVE_TABLE' ESCAPE '\ ' AND COLUMN_NAME LIKE '%' ESCAPE '\ ' ORDER BY TABLE_CAT, TABLE_SCHEM, TABLE_NAME, ORDINAL_POSITION
The reason for this is incorrect use of JDBC API by the application. In particular, https://docs.oracle.com/javase/8/docs/api/java/sql/DatabaseMetaData.html#getColumns-java.lang.String-java.lang.String-java.lang.String-java.lang.String- has the signature
ResultSet getColumns(String catalog,
String schemaPattern,
String tableNamePattern,
String columnNamePattern)
throws SQLException
the schema or table name should not be passed as is.
instead, the underscores should be escaped using metadata.getSearchStringEscape()
.
Sadly, it seems Tableau Desktop doesn't do that, resulting in queries with disappointing performance. Could you please report the problem to Tableau?
As a workaround, we could perhaps introduce a JDBC configuration option for compatibility with such incorrectly behaving application.
Once set, it would treat tableNamePattern
as literal table name (not a pattern) and same for schemaPattern
and columnNamePattern
.
@electrum @kokosing @losipiuk WDYT?
I will raise the issue to Tableau tomorrow. It will be wonderfull if I can get a workaround quickly.
Tks a lot for your help.
As a workaround, we could perhaps introduce a JDBC configuration option for compatibility with such incorrectly behaving application. Once set, it would treat
tableNamePattern
as literal table name (not a pattern) and same forschemaPattern
andcolumnNamePattern
.@electrum @kokosing @losipiuk WDYT?
I think that is a reasonable idea. The downside is that that it takes down the pressure from reporting the root cause issue to misbehaving client application developers. But still given fact that we saw the problem many times already, I think it makes sense to add such a config option.
Hello,
When I try to connect to Presto from Tableau Desktop using a JDBC connection, Presto JDBC is running the following statement.
It is not efficient and raise the following exception in 30-40s
It seems to work in less than 200 ms when I rewrite the query swapping like by =
If someone can help ....
Tks and regards
Frederic