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: 

date_format 'LLLL' returns '1'

Kibour
Contributor

Hi all,

In my notebook, when I run my cell with following code

%sql

select date_format(date '1970-01-01', "LLL");

I get '1', while I expect 'Jan' according to the doc
https://spark.apache.org/docs/latest/sql-ref-datetime-pattern.html

 

I would also expect the following to return 'January', but I get '1' instead

%sql
select to_csv(named_struct('date', date '1970-01-01'), map('dateFormat', 'LLLL', 'locale', 'EN'));
 
What am I missing?
 
Thanks in advance for your insights
1 ACCEPTED SOLUTION

Accepted Solutions

Kibour
Contributor

Hi @Retired_mod ,

Turns out it was actually a Java 8 bug:

IllegalArgumentException: Java 8 has a bug to support stand-alone form (3 or more 'L' or 'q' in the pattern string). Please use 'M' or 'Q' instead, or upgrade your Java version. For more details, please read https://bugs.openjdk.java.net/browse/JDK-8114833

Upgarding to Java 11 fixed the issue.

Kind regards

View solution in original post

2 REPLIES 2

Hi @Retired_mod ,

Thanks for your detailed answer. If I read you correctly, this means the spark docuementation is incorrect. I copy-pasted my queries direclty from the documentation examples, but can't reproduce them.

My cluster is runnig with Apache Spark 3.5.0, Scala 2.12.

Thanks and kind regards

Kibour
Contributor

Hi @Retired_mod ,

Turns out it was actually a Java 8 bug:

IllegalArgumentException: Java 8 has a bug to support stand-alone form (3 or more 'L' or 'q' in the pattern string). Please use 'M' or 'Q' instead, or upgrade your Java version. For more details, please read https://bugs.openjdk.java.net/browse/JDK-8114833

Upgarding to Java 11 fixed the issue.

Kind regards

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