Is it possible to define array of integers in schemas?

Hi,

is it possible to define an array of integers with the schemas. We have only used arrays of strings so far but we would like to send arrays of other datatypes as well. We define a field in a schema like this:

 },
        "selectedCpoiIndexes": {
            "type": ["array","null"],
            "description": "Indexes of selected pois",
            "items" : {
                "type": "integer",
                "description": "Sequential number of pois",
                "minimum": 0,
                "maximum": 4
            }
        }

We sent the data out like this:

{"schema":"iglu:com.myapp/planevent/jsonschema/1-0-0","data":{"selectedCpoiIndexes":[1,2]}}}

However, ton redshift we only see one integer. The first one. On Redshift the schema of the table shows that the column has a varchar type.( "selected_cpoi_indexes" VARCHAR(5000) ENCODE ZSTD,) This is in line with the sql file that iglu-generate creates based on the schema above?

Are arrays of strings the only option?

Arrays of integers are perfectly fine. All array (and object) columns are loaded to Redshift as strings, because Redshift’s support for arrays has historically been poor - the loader defaults to loading them as strings.

1 Like