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: 

Using Parquet, passing Partition on Insert Overwrite. Partition parenthesis includes equitation and it gives an error.

saltuk
Contributor

I am new on Spark sql, we are migrating our Cloudera to Databricks. there are a lot of SQLs done, only a few are on going.

We are having some troubles during passing an argument and using it in an equitation on Partition section. LOGDATE is an argument like 20220110.

INSERT OVERWRITE TABLE  database.user_segments
 
PARTITION( month_id  =  CAST( SUBSTRING ( CAST( $LOGDATE AS STRING), 1, 6) AS INT))
 
(
 
SELECT
 
 l.license_key,

once we use this format we are getting error:

Error in SQL statement: ParseException: 
mismatched input '(' expecting STRING(line 2, pos 26)
 
== SQL ==
INSERT OVERWRITE TABLE veloxity.user_segment_by_network_usage
PARTITION( month_id = CAST( SUBSTRING ( CAST(20300101 AS STRING), 1, 6) AS INT))
--------------------------^^^

it would be great to have some help here.

best regards

0 REPLIES 0
Join 100K+ Data Experts: Register Now & Grow with Us!

Excited to expand your horizons with us? Click here to Register and begin your journey to success!

Already a member? Login and join your local regional user group! If there isn’t one near you, fill out this form and we’ll create one for you to join!