cancel
Showing results for 
Search instead for 
Did you mean: 
Data Engineering
cancel
Showing results for 
Search instead for 
Did you mean: 

Data type not shown correctly in SQL editor

alwinsa
New Contributor III

When selecting from a table in the SQL editor it doesn't always preview the actual data type that the column is. e.g. I have a decimal() data type in one of my tables and when I select it it previews to a float with 2 decimals (which is different from what the type actually is when I go to check it out in the Data explorer). When you hit "preview visualisation data" the pop up window also shows the correct data type (i.e. decimal(38,9) and not float()). It also says that "The visualisation data matches what is displayed in the editor and the results" which, as you can see in the pic below, is not the case.

3 REPLIES 3

LandanG
Honored Contributor
Honored Contributor

Hi @Alva Winsa​ ,

Where do you see that the data type is changing? That might be a bug that needs to be reported.

One thing that can happen is the SQL editor output will automatically round to the nearest two decimals as shown in the screenshot, this can be changed by editing the table results and changing the number format to include more decimals.

Screen Shot 2023-01-26 at 7.27.43 AM

alwinsa
New Contributor III

Hey thanks for your response!

That definitely seems like what's happening! I'm new to Databricks -- where can I find that editor?

So my problem was actually two-pronged but I only outlined part of the problem above, which you seem to have solved!

The other part of the problem is that I'm casting this column as a decimal (38,32) in dbt. And seemingly in dbt that works well and gives me the expected results. However, in Databricks the column is altered to decimal(38,9). How can I tackle this?

Thanks!

Alva

LandanG
Honored Contributor
Honored Contributor

Hi @Alva Winsa​,

I've attached a couple of screenshots which hopefully shows where you can edit this parameter.

Screen Shot 2023-01-26 at 7.57.51 AMScreen Shot 2023-01-26 at 8.00.11 AMScreen 

As far as the dbt casting problem, I'll see if I can find anything and get back to you

Welcome to Databricks Community: Lets learn, network and celebrate together

Join our fast-growing data practitioner and expert community of 80K+ members, ready to discover, help and collaborate together while making meaningful connections. 

Click here to register and join today! 

Engage in exciting technical discussions, join a group with your peers and meet our Featured Members.