[ 
https://issues.apache.org/jira/browse/SPARK-24849?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16548878#comment-16548878
 ] 

Maxim Gekk commented on SPARK-24849:
------------------------------------

[~maropu] This is a part of my work on customer's issue. There are multiple 
folders of AVRO files with pretty wide and nested schemas. I need 
programmatically create tables on top of each folder. To do that I read a file 
in a folder via Scala API, take schema, convert it to DDL string (here I need 
the changes) and put the string to SQL CREATE TABLE.

> Convert StructType to DDL string
> --------------------------------
>
>                 Key: SPARK-24849
>                 URL: https://issues.apache.org/jira/browse/SPARK-24849
>             Project: Spark
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 2.3.1
>            Reporter: Maxim Gekk
>            Priority: Minor
>
> Need to add new methods which should convert a value of StructType to a 
> schema in DDL format . It should be possible to use the former string in new 
> table creation by just copy-pasting of new method results. The existing 
> methods simpleString(), catalogString() and sql() put ':' between top level 
> field name and its type, and wrap by the *struct* word
> {code}
> ds.schema.catalogString
> struct<metaData:struct<eventId:string ...
> {code}
> Output of new method should be
> {code}
> metaData struct<eventId:string ...
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)

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

Reply via email to