Uploaded image for project: 'Spark'
  1. Spark
  2. SPARK-41104

Can insert NULL into hive table table with NOT NULL column

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Critical
    • Resolution: Unresolved
    • 3.4.0
    • None
    • Spark Core
    • None

    Description

      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

      Attachments

        Activity

          People

            Unassigned Unassigned
            srielau Serge Rielau
            Wenchen Fan Wenchen Fan
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

            Dates

              Created:
              Updated: