Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stop double closing in json scan + skip test #8413

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions integration_tests/src/main/python/json_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -436,6 +436,7 @@ def test_json_datetime_parsing_fallback_no_datetime(std_input_path, filename, sc
lambda spark : spark.read.schema(schema).option('enableDateTimeParsingFallback', "true").json(data_path),
conf=_enable_all_types_conf)

@pytest.mark.skip(reason=str("https://github.com/NVIDIA/spark-rapids/issues/8403"))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Other usages in our repo do not require str() conversion for a literal reason

@pytest.mark.parametrize('v1_enabled_list', ["", "json"])
@pytest.mark.parametrize('col_name', ['K0', 'k0', 'K3', 'k3', 'V0', 'v0'], ids=idfn)
@ignore_order
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,11 @@ import java.io.IOException
import java.nio.charset.StandardCharsets

import scala.collection.JavaConverters._
import scala.collection.mutable.ListBuffer

import ai.rapids.cudf
import ai.rapids.cudf.{CaptureGroups, ColumnVector, DType, NvtxColor, RegexProgram, Scalar, Schema, Table}
import com.nvidia.spark.rapids._
import com.nvidia.spark.rapids.Arm.{closeOnExcept, withResource}
import com.nvidia.spark.rapids.Arm.withResource
import com.nvidia.spark.rapids.shims.ShimFilePartitionReaderFactory
import org.apache.hadoop.conf.Configuration

Expand Down Expand Up @@ -314,16 +313,14 @@ class JsonPartitionReader(
val jsonTbl = JsonPartitionReader.readToTable(dataBufferer, cudfSchema, decodeTime, jsonOpts,
getFileFormatShortName, partFile)
withResource(jsonTbl) { tbl =>
val columns = new ListBuffer[ColumnVector]()
closeOnExcept(columns) { _ =>
for (name <- readDataSchema.fieldNames) {
val i = cudfSchema.getColumnNames.indexOf(name)
if (i == -1) {
throw new IllegalStateException(
s"read schema contains field named '$name' that is not in the data schema")
}
columns += tbl.getColumn(i)
val cudfColumnNames = cudfSchema.getColumnNames
val columns = readDataSchema.map { field =>
val i = cudfColumnNames.indexOf(field.name)
if (i == -1) {
throw new IllegalStateException(
s"read schema contains field named '${field.name}' that is not in the data schema")
}
tbl.getColumn(i)
}
new Table(columns: _*)
}
Expand Down