szymon_dybczak
Esteemed Contributor III

Hi @Box_clown ,

I recreated your example on my cluster and now I think that 'Set Not Null' statement only changes custom metadata in that column. It doesn't remove check constraint on length. Try to insert value with length > 3 and you will get: DELTA_EXCEED_CHAR_VARCHAR_LIMIT
So you can think of it in following way, when you define table with column VARCHAR it will apply custom "label" to STRING datatype with name VARCHAR, and it will create check constraint on that column. 
Now, when you setting not null this label is somehow removed, but check constraint remains intact, so behaviour of a column will be correct.
You can read about how varchar type is represented in below articles. 

VARCHAR and CHAR in Databricks and Delta Lake | by Kyle Hale | Medium

Writing Custom Metadata to Parquet Files and Columns with PyArrow - MungingData

And I think you can create an issue below:
[SPARK-48652] Casting Issue in Spark SQL: String Column Compared to Integer Value Yields Empty Resul...