Skip to content

Commit

Permalink
Fallback to CPU when encoding is not supported for JSON reader (#4622)
Browse files Browse the repository at this point in the history
* fallback to CPU when encoding is not supported for JSON reader

Signed-off-by: Bobby Wang <wbo4958@gmail.com>

* change the log
  • Loading branch information
wbo4958 authored Jan 26, 2022
1 parent 8e7a8c9 commit 871a1df
Showing 1 changed file with 7 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@

package org.apache.spark.sql.catalyst.json.rapids

import java.nio.charset.StandardCharsets

import scala.collection.JavaConverters._

import ai.rapids.cudf
Expand Down Expand Up @@ -138,6 +140,11 @@ object GpuJsonScan {
meta.willNotWorkOnGpu("GpuJsonScan only supports \"\\n\" as a line separator")
}

parsedOptions.encoding.foreach(enc =>
if (enc != StandardCharsets.UTF_8.name() && enc != StandardCharsets.US_ASCII.name()) {
meta.willNotWorkOnGpu("GpuJsonScan only supports UTF8 or US-ASCII encoded data")
})

if (readSchema.map(_.dataType).contains(DateType)) {
ShimLoader.getSparkShims.dateFormatInRead(parsedOptions).foreach { dateFormat =>
if (!supportedDateFormats.contains(dateFormat)) {
Expand Down

0 comments on commit 871a1df

Please sign in to comment.