[ 
https://issues.apache.org/jira/browse/FLINK-3445?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15154335#comment-15154335
 ] 

Ken Geis commented on FLINK-3445:
---------------------------------

One can get ResultSetMetaData by preparing a statement and not executing it. 
There is, of course, some cost, but it should not be expensive.

If it turns out that some databases execute the query in order to get the 
metadata, the common pattern for applying the false filter that you suggest is:
{code:sql}
SELECT * FROM (<provided query>) WHERE 1 = 2
{code}
This makes it robust to whether there is already a WHERE clause and works on 
any database that can handle inline views in SQL, which is almost all modern 
databases.

About fieldNames, when I have DataSets from the JDBCInputFormat, I'd like to 
join them like {{a.join(b).where("AWARD_ID").equalTo("AWARD_ID")}} but the 
fields are named f# so I need to join them like 
{{a.join(b).where(0).equalTo(0)}} or {{a.join(b).where("f1").equalTo("f1")}}.

> make JDBCInputFormat implement ResultTypeQueryable
> --------------------------------------------------
>
>                 Key: FLINK-3445
>                 URL: https://issues.apache.org/jira/browse/FLINK-3445
>             Project: Flink
>          Issue Type: Improvement
>    Affects Versions: 0.10.2
>            Reporter: Ken Geis
>
> A JDBC statement can be interrogated to see what columns and types it will 
> return. Flink should be able to use this to make JDBCInputFormat implement 
> ResultTypeQueryable to provide type information without needing to code again.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to