Hi,
I have an issue in avro schema evolution. I have and ‘orders’ avro table in hive with below schema:
{ "type" : "record", "name" : "orders", "doc" : "Sqoop import of orders", "fields" : [ { "name" : "order_id", "type" : [ "null", "int" ], "default" : null, "columnName" : "order_id", "sqlType" : "4" }, { "name" : "order_date", "type" : [ "null", "long" ], "default" : null, "columnName" : "order_date", "sqlType" : "93" }, { "name" : "order_customer_id", "type" : [ "null", "double" ], "default" : null, "columnName" : "order_customer_id", "sqlType" : "12" }, { "name" : "order_status", "type" : [ "null", "string" ], "default" : null, "columnName" : "order_status", "sqlType" : "12" } ], "tableName" : "orders"}
Now a newly added file to existing ‘orders_avro’ hive table. having below schema:
{ "type" : "record", "name" : "orders", "doc" : "Sqoop import of orders", "fields" : [ { "name" : "order_id", "type" : "int", "columnName" : "order_id", "sqlType" : "4" }, { "name" : "order_date", "type" : "string", "columnName" : "order_date", "sqlType" : "12" }, { "name" : "order_customer_id", "type" : "double", "columnName" : "order_customer_id", "sqlType" : "8" }, { "name" : "order_status", "type" : "string", "columnName" : "order_status", "sqlType" : "12" } ], "tableName" : "orders"}
whereas the difference between both schema is: order_date is changed to ‘string’ from ‘long’. Due to this reason, i am facing below issue “Failed with exception java.io.IOException:org.apache.avro.AvroTypeException: Found string, expecting long”
Can anybody help me to resolve this issue. Dear @pramodvspk i hope you can resolve this.
Thanks in advance.