You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Rui Wang (Jira)" <ji...@apache.org> on 2022/11/10 22:19:00 UTC

[jira] [Commented] (SPARK-41104) Can insert NULL into hive table table with NOT NULL column

    [ https://issues.apache.org/jira/browse/SPARK-41104?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17631946#comment-17631946 ] 

Rui Wang commented on SPARK-41104:
----------------------------------

Looks like HIVE only enforce `NOT NULL` since Hive 3.0.0 https://issues.apache.org/jira/browse/HIVE-16575

> Can insert NULL into hive table table with NOT NULL column
> ----------------------------------------------------------
>
>                 Key: SPARK-41104
>                 URL: https://issues.apache.org/jira/browse/SPARK-41104
>             Project: Spark
>          Issue Type: Bug
>          Components: Spark Core
>    Affects Versions: 3.4.0
>            Reporter: Serge Rielau
>            Priority: Critical
>
> spark-sql> CREATE TABLE tttd(c1 int not null);
> 22/11/10 14:04:28 WARN ResolveSessionCatalog: A Hive serde table will be created as there is no table provider specified. You can set spark.sql.legacy.createHiveTableByDefault to false so that native data source table will be created instead.
> 22/11/10 14:04:28 WARN HiveMetaStore: Location: file:/Users/serge.rielau/spark/spark-warehouse/tttd specified for non-external table:tttd
> Time taken: 0.078 seconds
> spark-sql> INSERT INTO tttd VALUES(null);
> Time taken: 0.36 seconds
> spark-sql> SELECT * FROM tttd;
> NULL
> Time taken: 0.074 seconds, Fetched 1 row(s)
> spark-sql> 
> Does hive not support NOT NULL? That's fine, but then we should fail on CREATE TABLE



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@spark.apache.org
For additional commands, e-mail: issues-help@spark.apache.org