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

Allow customizable column name in ScalaReflection.schemaFor

Attach filesAttach ScreenshotVotersWatch issueWatchersCreate sub-taskLinkCloneUpdate Comment AuthorReplace String in CommentUpdate Comment VisibilityDelete Comments
    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Resolved
    • Minor
    • Resolution: Incomplete
    • 2.1.0
    • None
    • Spark Core

    Description

      When creating StructType using ScalaRelfection.schemaFor, the column names are defined by scala case class parameter names. This causes minor inconvenience when reading/writing data between Python and Scala which follow different naming conventions. Ideally, we should allow customize column names using Scala annotations in a similar fashion to Jackson serialization libraries.

      For example, we could define schema as :

      case class MySchema(@fieldName("long_field") longField: Long, @fieldName("int_field") intField: Int)

      The field/column names can now be customized.

      Attachments

        Activity

          This comment will be Viewable by All Users Viewable by All Users
          Cancel

          People

            Unassigned Unassigned
            smartnose Wei Liu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Time Tracking

                Estimated:
                Original Estimate - 24h
                24h
                Remaining:
                Remaining Estimate - 24h
                24h
                Logged:
                Time Spent - Not Specified
                Not Specified

                Slack

                  Issue deployment