Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-41861

Make v2 ScanBuilders' build() return typed scan

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Trivial
    • Resolution: Fixed
    • 3.3.1
    • 3.4.0
    • Spark Core
    • None

    Description

      The `ScanBuilder` interface has the `build()` method to return `Scan` objects. All the different implementations of it return scans that are of the type of the builder itself. Eg `ParquetScanBuilder` will return a `ParquetScan`, `TextScanBuilder` a `TextScan` etc. However, in the method overrides declaration, the return type is not changed to the more specific type but left as a generic `Scan`. This is a bit problematic when one has to work with scan object because a manual cast is required, even if we know for a fact that a `ParquetScanBuilder`'s `build()` method will return a `ParquetScan`. For ease of developement (and for stricter correctness checks, as we wouldn't want a `ParquetScanBuilder` to return a non-parquet scan I would assume), it would be very nice if the `build()` methods of each implementation of `ScanBuilder`s returned a more strictly typed object instead of the generic `Scan` object

      Attachments

        Activity

          People

            LorenzoMartini94 Lorenzo Martini
            LorenzoMartini94 Lorenzo Martini
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: