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

Inferring schema from CSV string literal

    XMLWordPrintableJSON

    Details

    • Type: Improvement
    • Status: Resolved
    • Priority: Minor
    • Resolution: Fixed
    • Affects Version/s: 2.4.0
    • Fix Version/s: 3.0.0
    • Component/s: SQL
    • Labels:
      None

      Description

      Need to add new function - schema_of_csv(). The function should infer schema of CSV string literal. The result of the function is a schema in DDL format.

      One of the use cases is passing output of schema_of_csv() to from_csv() (see SPARK-25393). The new function should allow schema inferring from an example. Let's say csv_col is a column containing CSV string with the same schema. It should be possible to pass a CSV string with the same schema to schema_of_csv() which infers schema for the particular example.

      select from_csv(csv_col, schema_of_csv('1,a,0.1'))
      from csv_table;
      

        Attachments

          Activity

            People

            • Assignee:
              maxgekk Maxim Gekk
              Reporter:
              maxgekk Maxim Gekk
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: