hive-json-schema icon indicating copy to clipboard operation
hive-json-schema copied to clipboard

IllegalStateException on json with empty arrays

Open dbacarel opened this issue 8 years ago • 0 comments

Hi @quux00, thank you for the tool, it's very handy!

So, I tried to generate a Hive schema out of a json containing an empty array, but it throws an exception

Exception in thread "main" java.lang.IllegalStateException: Array is empty: [] at net.thornydev.JsonHiveSchema.arrayJoin(JsonHiveSchema.java:136) at net.thornydev.JsonHiveSchema.toHiveSchema(JsonHiveSchema.java:129) at net.thornydev.JsonHiveSchema.valueToHiveSchema(JsonHiveSchema.java:179) at net.thornydev.JsonHiveSchema.createHiveSchema(JsonHiveSchema.java:103) at net.thornydev.JsonHiveSchema.main(JsonHiveSchema.java:66)

I read your recommendation on using a doc with a single entry in each array, does that mean that the tool doesn't support Union types yet? Even though I've come to understand that these fields support is incomplete and can only be used in SELECT clauses.

dbacarel avatar Jan 25 '17 12:01 dbacarel