cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
Join discussions on data engineering best practices, architectures, and optimization strategies within the Databricks Community. Exchange insights and solutions with fellow data engineers.
cancel
Showing results for 
Search instead for 
Did you mean: 

Getting Error when Inserting data into table with the column as bigint

Jits
New Contributor II

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;

2 REPLIES 2

-werners-
Esteemed Contributor III

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

Anonymous
Not applicable

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.

Connect with Databricks Users in Your Area

Join a Regional User Group to connect with local Databricks users. Events will be happening in your city, and you won’t want to miss the chance to attend and share knowledge.

If there isn’t a group near you, start one and help create a community that brings people together.

Request a New Group