Re: spark jdbc

2021-12-17 Thread Sean Owen
I'm not sure we want to do that. If you "SELECT foo AS bar", then the
column name is foo but the column label is bar. We probably want to return
the latter.

On Fri, Dec 17, 2021 at 9:07 AM Gary Liu  wrote:

> In spark sql jdbc module, it's using getColumnLabel to get column names
> from the remote database, but in some databases, like SAS, it returns
> column description instead. Should getColumnName be used?
>
> This is from the SAS technical support:
>
> In the documentation,
> https://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html
> (we adhere to the JDBC spec for the driver code )
>
>
>
> getColumnLabel() Gets the designated column's suggested title for use in
> printouts and displays.
>
> getColumnName() Get the designated column's name.
>
>
>
> In the spark code, they use
>
>
>
> while (i < ncols) {
>
>   val columnName = rsmd.getColumnLabel(i + 1)
>
>
>
> The appropriate method should be rsmd.getColumnName(i+1).
>
> --
> Gary Liu
>


spark jdbc

2021-12-17 Thread Gary Liu
In spark sql jdbc module, it's using getColumnLabel to get column names
from the remote database, but in some databases, like SAS, it returns
column description instead. Should getColumnName be used?

This is from the SAS technical support:

In the documentation,
https://docs.oracle.com/javase/7/docs/api/java/sql/ResultSetMetaData.html
(we adhere to the JDBC spec for the driver code )



getColumnLabel() Gets the designated column's suggested title for use in
printouts and displays.

getColumnName() Get the designated column's name.



In the spark code, they use



while (i < ncols) {

  val columnName = rsmd.getColumnLabel(i + 1)



The appropriate method should be rsmd.getColumnName(i+1).

-- 
Gary Liu