SELECT column1 FROM test_table limit 2; 0 1After upgrade:
SELECT column1 FROM test_table limit 2; False TrueAfter digging further, I discovered that this change was introduced by SPARK-16625, due to the integration required for Spark to work correctly with Oracle. Since the change was intended, the following is the suggested workarounds:
- Cast the Boolean to a type of your choosing in the Spark code, before writing it to the Hive table
- Make sure that the mapped column in Hive is also of compatible data type, for example, TinyInt, rather than String, so that the value of True or False will be mapped to 1 or 0 respectively, rather than string value of “True” or “False” (the reason that the column got “False” and “True” values were because the column was of String data type)
NUMBER(1,0) has 10 values: 0 to 9. The suggested solution will map the values to 0 and 1 for all non-zero values. Better solution is to cast in the select clause.
SELECT cast(column1 as INTEGER) column1 from test_table;