Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-13822 Follow-ups of DataFrame/Dataset API unification
  3. SPARK-14063

SQLContext.range should return Dataset[java.lang.Long]

    XMLWordPrintableJSON

Details

    • Sub-task
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • 2.0.0
    • SQL
    • None

    Description

      SPARK-13894 changed the return type of range from Dataset[Row] to Dataset[Long]. The problem is that due to https://issues.scala-lang.org/browse/SI-4388, Scala compiles primitive types in generics into just Object, i.e. range at bytecode level now just returns Dataset[Object]. This is really bad for Java users because they are losing type safety and also need to add a type cast every time they use range.

      Talked to retronym who suggested the best approach is to return Dataset[java.lang.Long]. The small downside is that when Scala users want to explicitly type a closure used on the dataset returned by range, they would need to use java.lang.Long instead of the Scala Long.

      Attachments

        Activity

          People

            rxin Reynold Xin
            rxin Reynold Xin
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: