Skip to content

Commit

Permalink
Add better automated tests for Arrow columnar copy in HostColumnarToG…
Browse files Browse the repository at this point in the history
…pu (NVIDIA#1665)

* Add Data source v2 test classes

Signed-off-by: Thomas Graves <tgraves@nvidia.com>

* update v2 source testing

* fix batch num rows and logging

* update the numberin batch

* Fix issue with reading booleans from ArrowColumnVectors and add more
tests

* move test file so pytest regex pick it up

* add comments

* fix line length

Signed-off-by: Thomas Graves <tgraves@nvidia.com>
  • Loading branch information
tgravescs authored Feb 4, 2021
1 parent 12a5650 commit aec85ee
Show file tree
Hide file tree
Showing 4 changed files with 391 additions and 104 deletions.
104 changes: 0 additions & 104 deletions integration_tests/src/main/python/datasourcev2_read.py

This file was deleted.

42 changes: 42 additions & 0 deletions integration_tests/src/main/python/datasourcev2_read_test.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
# Copyright (c) 2021, NVIDIA CORPORATION.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import pytest

from asserts import assert_gpu_and_cpu_are_equal_collect

columnarClass = 'com.nvidia.spark.rapids.tests.datasourcev2.parquet.ArrowColumnarDataSourceV2'

def readTable(types, classToUse):
return lambda spark: spark.read\
.option("arrowTypes", types)\
.format(classToUse).load()\
.orderBy("col1")

def test_read_int():
assert_gpu_and_cpu_are_equal_collect(readTable("int", columnarClass))

def test_read_strings():
assert_gpu_and_cpu_are_equal_collect(readTable("string", columnarClass))

def test_read_all_types():
assert_gpu_and_cpu_are_equal_collect(
readTable("int,bool,byte,short,long,string,float,double,date,timestamp", columnarClass),
conf={'spark.rapids.sql.castFloatToString.enabled': 'true'})

def test_read_arrow_off():
assert_gpu_and_cpu_are_equal_collect(
readTable("int,bool,byte,short,long,string,float,double,date,timestamp", columnarClass),
conf={'spark.rapids.arrowCopyOptmizationEnabled': 'false',
'spark.rapids.sql.castFloatToString.enabled': 'true'})
Loading

0 comments on commit aec85ee

Please sign in to comment.