You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Wenchen Fan (Jira)" <ji...@apache.org> on 2026/07/02 12:55:00 UTC

[jira] [Resolved] (SPARK-57855) Refactor JDBC value getters into a sealed type for readability

     [ https://issues.apache.org/jira/browse/SPARK-57855?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Wenchen Fan resolved SPARK-57855.
---------------------------------
    Fix Version/s: 4.3.0
       Resolution: Fixed

Issue resolved by pull request 56936
[https://github.com/apache/spark/pull/56936]

> Refactor JDBC value getters into a sealed type for readability
> --------------------------------------------------------------
>
>                 Key: SPARK-57855
>                 URL: https://issues.apache.org/jira/browse/SPARK-57855
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 5.0.0
>            Reporter: Abdelrahman Gamal
>            Assignee: Abdelrahman Gamal
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 4.3.0
>
>
> JdbcUtils.makeGetter maps each column type to a per-column reader. The reader type
> JDBCValueGetter is just a type alias for (ResultSet, InternalRow, Int) => Unit, so
> each case in makeGetter returns an anonymous function. Because of this, a getter
> cannot be named or referred to, and makeGetter mixes the choice of getter with the
> logic of each getter in one long block.
> This change makes JDBCValueGetter a sealed trait with one named case per getter.
> makeGetter then just selects the right getter for the column type. This makes the
> code easier to read and maintain: each getter is a named, separate piece, and
> makeGetter clearly shows only which getter is used for each type. The getter logic
> is unchanged and all the types are private, so there is no behavior or API change.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org