Allow inserting into tables with CHECK constraint in Delta Lake #14863
Allow inserting into tables with CHECK constraint in Delta Lake #14863
Conversation
5d2c26d to
668de6d
Compare
There was a problem hiding this comment.
These check constrains should be assumed to be expressed in Spark SQL, right?
I think the Delta spec conveniently omits this topic, but we can assume so for now.
There was a problem hiding this comment.
So, do we want to translate SparkSQL expression into Trino expression?
There was a problem hiding this comment.
I don't think we should take a shortcut here.
fortunately the check constraints are typically very limited (eg no subqueries expected), so instead of pulling a big library with a big pile of challenges, I would prefer to roll out a Limited SparkSQL Language Subset™ - parser, abstract tree and conversion to Trino form. I actually have it on my todo list.
There was a problem hiding this comment.
Add javadoc explaining how these String values should be understood, i.e. what can and what cannot be a check constraint value.
I guess the intention here is "String representation of a Trino SQL scalar expression that can refer to table columns by name and produces a result coercible to boolean"
There was a problem hiding this comment.
The SQL spec already has a notion of constraints, so these need to be modeled in a way consistent to what the spec describes. Have you looked at that, yet? By the way, the spec refers to various forms of constraints as "integrity constraints".
There was a problem hiding this comment.
@ebyhr what about splitting this PR into SPI & Engine side and the rest? Or maybe even SPI part, then engine, then the rest?
We need Martin's attention especially for the SPI part.
There was a problem hiding this comment.
Sure, I will separate this PR.
668de6d to
2889fb5
Compare
Additionally, remove redundant testWritesToTableWithCheckConstraintFails method.
2889fb5 to
b76af0f
Compare
Description
Allow inserting into tables with CHECK constraint in Delta Lake
Release notes
( ) This is not user-visible or docs only and no release notes are required.
( ) Release notes are required, please propose a release note for me.
( ) Release notes are required, with the following suggested text: