kyuubi/kyuubi-common
Fei Wang 5a64e1242e
[KYUUBI #2075] Using thread-safe FastDateFormat instead of SimpleDateFormat
### _Why are the changes needed?_

We met below issue when fetching result.

```
Caused by: java.lang.RuntimeException: java.lang.ArrayIndexOutOfBoundsException:46
7022	at sun.util.calendar.BaseCalendar.getCalendarDateFromFixedDate(BaseCalendar.java:453)
7023	at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2397)
7024	at java.util.GregorianCalendar.computeFields(GregorianCalendar.java:2312)
7025	at java.util.Calendar.setTimeInMillis(Calendar.java:1804)
7026	at java.util.Calendar.setTime(Calendar.java:1770)
7027	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:943)
7028	at java.text.SimpleDateFormat.format(SimpleDateFormat.java:936)
7029	at java.text.DateFormat.format(DateFormat.java:345)
7030	at org.apache.kyuubi.schema.RowSet$.toHiveString(RowSet.scala:245)
7031	at org.apache.kyuubi.schema.RowSet$.$anonfun$toTColumn$3(RowSet.scala:120)
7032	at scala.collection.immutable.List.map(List.scala:290)
7033	at org.apache.kyuubi.schema.RowSet$.toTColumn(RowSet.scala:115)
7034	at org.apache.kyuubi.schema.RowSet$.$anonfun$toColumnBasedSet$1(RowSet.scala:65)
7035	at org.apache.kyuubi.schema.RowSet$.$anonfun$toColumnBasedSet$1$adapted(RowSet.scala:64)
7036	at scala.collection.immutable.List.foreach(List.scala:392)
7037	at org.apache.kyuubi.schema.RowSet$.toColumnBasedSet(RowSet.scala:64)
7038	at org.apache.kyuubi.schema.RowSet$.toTRowSet(RowSet.scala:47)
7039	at org.apache.kyuubi.engine.spark.operation.SparkOperation.getNextRowSet(SparkOperation.scala:183)
7040	at org.apache.kyuubi.operation.OperationManager.getOperationNextRowSet(OperationManager.scala:116)
7041	at org.apache.kyuubi.session.AbstractSession.fetchResults(AbstractSession.scala:197)
7042	at org.apache.kyuubi.service.AbstractBackendService.fetchResults(AbstractBackendService.scala:169)
7043	at org.apache.kyuubi.service.ThriftBinaryFrontendService.FetchResults(ThriftBinaryFrontendService.scala:505)
```

The root cause is that the date time formatter used to convert the result to rowSet is not thread-safe.
In this pr, we use thread-safe FastDateFormat instead of SimpleDateFormat.

### _How was this patch tested?_
Existing UT.

Closes #2075 from turboFei/thread_safe_fat_stimeformatter.

Closes #2075

44ae8fd1 [Fei Wang] Using thread-safe FastDateFormat instead of SimpleDateFormat

Authored-by: Fei Wang <fwang12@ebay.com>
Signed-off-by: Kent Yao <yao@apache.org>
2022-03-09 17:50:29 +08:00
..
src [KYUUBI #2075] Using thread-safe FastDateFormat instead of SimpleDateFormat 2022-03-09 17:50:29 +08:00
pom.xml [KYUUBI #2045] Preparing v1.6.0-SNAPSHOT 2022-03-06 22:21:45 +08:00