Skip to content
Closed
Changes from 1 commit
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
28 changes: 28 additions & 0 deletions python/pyspark/sql/tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
individual modules.
"""
import os
import glob
import sys
import subprocess
import pydoc
Expand Down Expand Up @@ -84,6 +85,31 @@
from pyspark.sql.utils import AnalysisException, ParseException, IllegalArgumentException


def found_file(pattern):
SPARK_HOME = os.environ["SPARK_HOME"]
files = glob.glob(os.path.join(SPARK_HOME, pattern))
return len(files) > 0


def search_hive_assembly_jars():
Copy link
Member

Choose a reason for hiding this comment

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

Quick note: I think check_hive_assembly_jars would make more sense.

pattern = "assembly/target/scala-*/jars/spark-hive_*-*.jar"
if not found_file(pattern):
raise Exception(
("Failed to find Hive assembly jar. ") +
"You need to build Spark with "
"'build/sbt -Phive package' or "
"'build/mvn -DskipTests -Phive package' before running this test.")


def search_test_udf_classes():
pattern = "sql/core/target/scala-*/test-classes/" + \
"test/org/apache/spark/sql/JavaStringLength.class"
if not found_file(pattern):
raise Exception(
("Failed to find test udf classes. ") +
"You need to build Spark with 'build/sbt sql/test:compile'")


class UTCOffsetTimezone(datetime.tzinfo):
"""
Specifies timezone in UTC offset
Expand Down Expand Up @@ -5205,6 +5231,8 @@ def test_invalid_args(self):

if __name__ == "__main__":
from pyspark.sql.tests import *
search_hive_assembly_jars()
search_test_udf_classes()
if xmlrunner:
unittest.main(testRunner=xmlrunner.XMLTestRunner(output='target/test-reports'))
else:
Expand Down