Getting Error when Inserting data into table with the column as bigint
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-02-2023 08:17 AM
Hi All,
I am creating table using Databricks SQL editor. The table definition is
DROP TABLE IF EXISTS [database].***_test;
CREATE TABLE [database].***_jitu_test
(
id bigint
)
USING delta
LOCATION 'test/raw/***_jitu_test'
TBLPROPERTIES ('delta.minReaderVersion'='1','delta.minWriterVersion'='2','delta.feature.allowColumnDefaults' = 'supported');
Table gets create successfully. When I do insert
insert into [database].***_test (id ) values (1);
It give error.
Java.lang.Integer cannot be cast to java.lang.Long
I don't want to so cast because then in every column with bigint I have to write cast. I tried using below with now luck. is there configuration I have to set or its the issue with product
--SET ansi_mode = true;
--SET spark.sql.ansi.enabled=true;
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-03-2023 02:00 AM
can you try with values(1L)?
The L part specifies the number is a longType.
https://spark.apache.org/docs/latest/sql-ref-literals.html#numeric-literal

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-18-2023 11:39 PM
Hi @jitendra goswami
We haven't heard from you since the last response from @Werner Stinckens r, and I was checking back to see if her suggestions helped you.
Or else, If you have any solution, please share it with the community, as it can be helpful to others.
Also, Please don't forget to click on the "Select As Best" button whenever the information provided helps resolve your question.

