DataSQRL / sqrl

Flexible development framework for building streaming data applications in SQL with Kafka, Flink, Postgres, GraphQL, and more.
https://www.datasqrl.com/
97 stars 14 forks source link

Map column in nested Avro schema causes exception #1002

Closed mbroecheler closed 1 week ago

mbroecheler commented 1 week ago

Getting the following exception:

java.lang.UnsupportedOperationException: Unsupported type when convertTypeToSpec: MAP
        at org.apache.calcite.sql.type.SqlTypeUtil.convertTypeToSpec(SqlTypeUtil.java:1122)
        at org.apache.calcite.sql.type.SqlTypeUtil.convertTypeToSpec(SqlTypeUtil.java:1144)
        at org.apache.calcite.sql.type.SqlTypeUtil.lambda$convertTypeToSpec$3(SqlTypeUtil.java:1118)
        at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:195)
        at java.base/java.util.Spliterators$ArraySpliterator.forEachRemaining(Spliterators.java:948)
        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)

For schema:

{
  "type": "record",
  "name": "ClusterEvent",
  "fields": [
    {
      "name": "createdAt",
      "type": "long"
    },
    {
      "name": "details",
      "type": {
        "type": "record",
        "name": "Details",
        "fields": [
          {
            "name": "component",
            "type": ["null", "string"],
            "default": null
          },
          {
            "name": "count",
            "type": ["null", "long"],
            "default": null
          },
          {
            "name": "host",
            "type": ["null", "string"],
            "default": null
          },
          {
            "name": "kind",
            "type": ["null", "string"],
            "default": null
          },
          {
           "name": "mapField",
             "type": {
               "type": "map",
               "values": "string"
              },
           "doc": "A map with string values"
          },
          {
            "name": "message",
            "type": "string"
          },
          {
            "name": "name",
            "type": "string"
          },
          {
            "name": "namespace",
            "type": ["null", "string"],
            "default": null
          },
          {
            "name": "reason",
            "type": ["null", "string"],
            "default": null
          },
          {
            "name": "tip",
            "type": "string"
          }
        ]
      }
    },
    {
      "name": "eventType",
      "type": "string"
    },
    {
      "name": "timestamp",
      "type" : {
        "type" : "long",
        "logicalType" : "timestamp-millis"
      }
    }
  ]
}