[Bug] When the Schema structure is incorrect, SQL queries return Not a record: "string"
- Dominant language
- Java
- Stars
- 15.3k
- Forks
- 3.8k
- Avg merge
- 1d 14h
- Merged PRs (30d)
- 160
Description
### Search before asking
- [X] I searched in the [issues](https://github.com/apache/pulsar/issues) and found nothing similar.
### Version
master
### Minimal reproduce step
## Create producer
`Producer p = pulsarClient.newProducer(Schema.JSON(String.class)).create()`
It would generate the following schema:
```json
{
"version": 0,
"schemaInfo": {
"name": "schema-test-2",
"schema": "\"string\"",
"type": "JSON",
"timestamp": 1691379461556,
"properties": {
"__alwaysAllowNull": "true",
"__jsr310ConversionEnabled": "false"
}
}
}
```
And query from `Trino`:
```sql
select * from pulsar."public/default"."schema-test-2";
```

`Trino` service did not report any exception.

### What did you expect to see?
Query success.
### What did you see instead?
Query 20230807_075157_00000_b7hfa failed: Not a record: "string"
### Anything else?
This exception was thrown from there:
https://github.com/apache/pulsar/blob/2ab184e49a036a1dd10dc537bef4ab034a5ad5e0/pulsar-client/src/main/java/org/apache/pulsar/client/impl/schema/generic/GenericSchemaImpl.java#L43-L46
Because there are a large amount of these types of codes in our production environment, we hope that they can be compatible in this situation in the `pulsar-sql` module.
When parsing the Schema encounters exceptions, use defaultSchema to regenerate, like this:

### Are you willing to submit a PR?
- [X] I'm willing to submit a PR!
Contributor guide
Assessment
This issue has not been assessed yet.