[ https://issues.apache.org/jira/browse/HIVE-16605?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16001386#comment-16001386 ]
Sergey Shelukhin commented on HIVE-16605: ----------------------------------------- This, and many other schemes would probably require new table type (e.g. MM tables ;)), or only work for ACID because of the general MR/Hive approach of treating a table as set of directories with unknown files. First, users can (and apparently often do) copy files directly into table directories, bypassing any checks. We could also have a read-time check making all queries (or all queries where not null is relevant) fail on such tables, and advising that the user use external tables if they want to load via copy. Second, there are also import and load commands, which cannot enforce the constraints. > Enforce NOT NULL constraints > ---------------------------- > > Key: HIVE-16605 > URL: https://issues.apache.org/jira/browse/HIVE-16605 > Project: Hive > Issue Type: New Feature > Affects Versions: 3.0.0 > Reporter: Carter Shanklin > > Since NOT NULL is so common it would be great to have tables start to enforce > that. > [~ekoifman] described a possible approach in HIVE-16575: > {quote} > One way to enforce not null constraint is to have the optimizer add > enforce_not_null UDF which throws if it sees a NULL, otherwise it's pass > through. > So if 'b' has not null constraint, > Insert into T select a,b,c... would become > Insert into T select a, enforce_not_null(b), c..... > This would work for any table type. > {quote} -- This message was sent by Atlassian JIRA (v6.3.15#6346)