Skip to content
Advertisement

Tag: databricks

How to change data type in csv column

Using databricks with SQL, I have to import my csv dataset into a table and analyse data using it. My problem is after I imported csv dataset, all column are String type, but some of these need to be Numeric. How can I solve? How can I define the column types of a csv file? I tried converting file in

Databricks error when change type column from string to numeric

I have a error like: com.databricks.backend.common.rpc.DatabricksExceptions$SQLExecutionException: org.apache.spark.sql.catalyst.parser.ParseException: no viable alternative at input ‘alter table x9concsheet5 Add netto_resultaat'(line 1, pos 29)* when i run this sql command in databricks: %sql alter table x9concsheet5 Add netto_resultaat numeric(17,2) The requirement is to change the column type from string to numeric from the temporary table x9concsheet5. Any suggestions? Answer you can use following command

Advertisement