FailedChanges

Summary

  1. [SPARK-25718][SQL] Detect recursive reference in Avro schema and throw (details)
Commit 2eaf0587883ac3c65e77d01ffbb39f64c6152f87 by wenchen
[SPARK-25718][SQL] Detect recursive reference in Avro schema and throw
exception
## What changes were proposed in this pull request?
Avro schema allows recursive reference, e.g. the schema for linked-list
in https://avro.apache.org/docs/1.8.2/spec.html#schema_record
```
{
"type": "record",
"name": "LongList",
"aliases": ["LinkedLongs"],                      // old name for this
"fields" : [
   {"name": "value", "type": "long"},             // each element has a
long
   {"name": "next", "type": ["null", "LongList"]} // optional next
element
]
}
```
In current Spark SQL, it is impossible to convert the schema as
`StructType` . Run `SchemaConverters.toSqlType(avroSchema)` and we will
get stack overflow exception.
We should detect the recursive reference and throw exception for it.
## How was this patch tested?
New unit test case.
Closes #22709 from gengliangwang/avroRecursiveRef.
Authored-by: Gengliang Wang <gengliang.wang@databricks.com>
Signed-off-by: Wenchen Fan <wenchen@databricks.com>
The file was modifiedexternal/avro/src/main/scala/org/apache/spark/sql/avro/SchemaConverters.scala (diff)
The file was modifiedexternal/avro/src/test/scala/org/apache/spark/sql/avro/AvroSuite.scala (diff)