@@ -179,7 +179,8 @@ def run_apache_rat_checks():
179179 run_cmd ([os .path .join (SPARK_HOME , "dev" , "check-license" )])
180180
181181
182- def run_scala_style_checks (build_profiles ):
182+ def run_scala_style_checks (extra_profiles ):
183+ build_profiles = extra_profiles + modules .root .build_profile_flags
183184 set_title_and_block ("Running Scala style checks" , "BLOCK_SCALA_STYLE" )
184185 profiles = " " .join (build_profiles )
185186 print ("[info] Checking Scala style using SBT with these profiles: " , profiles )
@@ -288,20 +289,35 @@ def get_hadoop_profiles(hadoop_version):
288289 }
289290
290291 if hadoop_version in sbt_maven_hadoop_profiles :
291- if ("ghprbPullTitle" in os .environ and
292- "test-hive1.2" in os .environ ["ghprbPullTitle" ].lower ()):
293- return sbt_maven_hadoop_profiles [hadoop_version ] + ["-Phive-1.2" ]
294- else :
295- return sbt_maven_hadoop_profiles [hadoop_version ]
292+ return sbt_maven_hadoop_profiles [hadoop_version ]
296293 else :
297294 print ("[error] Could not find" , hadoop_version , "in the list. Valid options" ,
298295 " are" , sbt_maven_hadoop_profiles .keys ())
299296 sys .exit (int (os .environ .get ("CURRENT_BLOCK" , 255 )))
300297
301298
302- def build_spark_maven (hadoop_version ):
299+ def get_hive_profiles (hive_version ):
300+ """
301+ For the given Hive version tag, return a list of Maven/SBT profile flags for
302+ building and testing against that Hive version.
303+ """
304+
305+ sbt_maven_hive_profiles = {
306+ "hive1.2" : ["-Phive-1.2" ],
307+ "hive2.3" : ["-Phive-2.3" ],
308+ }
309+
310+ if hive_version in sbt_maven_hive_profiles :
311+ return sbt_maven_hive_profiles [hive_version ]
312+ else :
313+ print ("[error] Could not find" , hive_version , "in the list. Valid options" ,
314+ " are" , sbt_maven_hive_profiles .keys ())
315+ sys .exit (int (os .environ .get ("CURRENT_BLOCK" , 255 )))
316+
317+
318+ def build_spark_maven (extra_profiles ):
303319 # Enable all of the profiles for the build:
304- build_profiles = get_hadoop_profiles ( hadoop_version ) + modules .root .build_profile_flags
320+ build_profiles = extra_profiles + modules .root .build_profile_flags
305321 mvn_goals = ["clean" , "package" , "-DskipTests" ]
306322 profiles_and_goals = build_profiles + mvn_goals
307323
@@ -310,9 +326,9 @@ def build_spark_maven(hadoop_version):
310326 exec_maven (profiles_and_goals )
311327
312328
313- def build_spark_sbt (hadoop_version ):
329+ def build_spark_sbt (extra_profiles ):
314330 # Enable all of the profiles for the build:
315- build_profiles = get_hadoop_profiles ( hadoop_version ) + modules .root .build_profile_flags
331+ build_profiles = extra_profiles + modules .root .build_profile_flags
316332 sbt_goals = ["test:package" , # Build test jars as some tests depend on them
317333 "streaming-kinesis-asl-assembly/assembly" ]
318334 profiles_and_goals = build_profiles + sbt_goals
@@ -322,10 +338,10 @@ def build_spark_sbt(hadoop_version):
322338 exec_sbt (profiles_and_goals )
323339
324340
325- def build_spark_unidoc_sbt (hadoop_version ):
341+ def build_spark_unidoc_sbt (extra_profiles ):
326342 set_title_and_block ("Building Unidoc API Documentation" , "BLOCK_DOCUMENTATION" )
327343 # Enable all of the profiles for the build:
328- build_profiles = get_hadoop_profiles ( hadoop_version ) + modules .root .build_profile_flags
344+ build_profiles = extra_profiles + modules .root .build_profile_flags
329345 sbt_goals = ["unidoc" ]
330346 profiles_and_goals = build_profiles + sbt_goals
331347
@@ -335,9 +351,9 @@ def build_spark_unidoc_sbt(hadoop_version):
335351 exec_sbt (profiles_and_goals )
336352
337353
338- def build_spark_assembly_sbt (hadoop_version , checkstyle = False ):
354+ def build_spark_assembly_sbt (extra_profiles , checkstyle = False ):
339355 # Enable all of the profiles for the build:
340- build_profiles = get_hadoop_profiles ( hadoop_version ) + modules .root .build_profile_flags
356+ build_profiles = extra_profiles + modules .root .build_profile_flags
341357 sbt_goals = ["assembly/package" ]
342358 profiles_and_goals = build_profiles + sbt_goals
343359 print ("[info] Building Spark assembly using SBT with these arguments: " ,
@@ -347,25 +363,25 @@ def build_spark_assembly_sbt(hadoop_version, checkstyle=False):
347363 if checkstyle :
348364 run_java_style_checks (build_profiles )
349365
350- build_spark_unidoc_sbt (hadoop_version )
366+ build_spark_unidoc_sbt (extra_profiles )
351367
352368
353- def build_apache_spark (build_tool , hadoop_version ):
354- """Will build Spark against Hive v1.2.1 given the passed in build tool (either `sbt` or
355- `maven`). Defaults to using `sbt`."""
369+ def build_apache_spark (build_tool , extra_profiles ):
370+ """Will build Spark with the extra profiles and the passed in build tool
371+ (either `sbt` or `maven`). Defaults to using `sbt`."""
356372
357373 set_title_and_block ("Building Spark" , "BLOCK_BUILD" )
358374
359375 rm_r ("lib_managed" )
360376
361377 if build_tool == "maven" :
362- build_spark_maven (hadoop_version )
378+ build_spark_maven (extra_profiles )
363379 else :
364- build_spark_sbt (hadoop_version )
380+ build_spark_sbt (extra_profiles )
365381
366382
367- def detect_binary_inop_with_mima (hadoop_version ):
368- build_profiles = get_hadoop_profiles ( hadoop_version ) + modules .root .build_profile_flags
383+ def detect_binary_inop_with_mima (extra_profiles ):
384+ build_profiles = extra_profiles + modules .root .build_profile_flags
369385 set_title_and_block ("Detecting binary incompatibilities with MiMa" , "BLOCK_MIMA" )
370386 profiles = " " .join (build_profiles )
371387 print ("[info] Detecting binary incompatibilities with MiMa using SBT with these profiles: " ,
@@ -399,14 +415,14 @@ def run_scala_tests_sbt(test_modules, test_profiles):
399415 exec_sbt (profiles_and_goals )
400416
401417
402- def run_scala_tests (build_tool , hadoop_version , test_modules , excluded_tags ):
418+ def run_scala_tests (build_tool , extra_profiles , test_modules , excluded_tags ):
403419 """Function to properly execute all tests passed in as a set from the
404420 `determine_test_suites` function"""
405421 set_title_and_block ("Running Spark unit tests" , "BLOCK_SPARK_UNIT_TESTS" )
406422
407423 test_modules = set (test_modules )
408424
409- test_profiles = get_hadoop_profiles ( hadoop_version ) + \
425+ test_profiles = extra_profiles + \
410426 list (set (itertools .chain .from_iterable (m .build_profile_flags for m in test_modules )))
411427
412428 if excluded_tags :
@@ -559,6 +575,7 @@ def main():
559575 # to reflect the environment settings
560576 build_tool = os .environ .get ("AMPLAB_JENKINS_BUILD_TOOL" , "sbt" )
561577 hadoop_version = os .environ .get ("AMPLAB_JENKINS_BUILD_PROFILE" , "hadoop2.7" )
578+ hive_version = os .environ .get ("AMPLAB_JENKINS_BUILD_HIVE_PROFILE" , "hive2.3" )
562579 test_env = "amplab_jenkins"
563580 # add path for Python3 in Jenkins if we're calling from a Jenkins machine
564581 # TODO(sknapp): after all builds are ported to the ubuntu workers, change this to be:
@@ -568,10 +585,12 @@ def main():
568585 # else we're running locally and can use local settings
569586 build_tool = "sbt"
570587 hadoop_version = os .environ .get ("HADOOP_PROFILE" , "hadoop2.7" )
588+ hive_version = os .environ .get ("HIVE_PROFILE" , "hive2.3" )
571589 test_env = "local"
572590
573591 print ("[info] Using build tool" , build_tool , "with Hadoop profile" , hadoop_version ,
574- "under environment" , test_env )
592+ "and Hive profile" , hive_version , "under environment" , test_env )
593+ extra_profiles = get_hadoop_profiles (hadoop_version ) + get_hive_profiles (hive_version )
575594
576595 changed_modules = None
577596 changed_files = None
@@ -605,8 +624,7 @@ def main():
605624 if not changed_files or any (f .endswith (".scala" )
606625 or f .endswith ("scalastyle-config.xml" )
607626 for f in changed_files ):
608- build_profiles = get_hadoop_profiles (hadoop_version ) + modules .root .build_profile_flags
609- run_scala_style_checks (build_profiles )
627+ run_scala_style_checks (extra_profiles )
610628 should_run_java_style_checks = False
611629 if not changed_files or any (f .endswith (".java" )
612630 or f .endswith ("checkstyle.xml" )
@@ -634,18 +652,18 @@ def main():
634652 run_build_tests ()
635653
636654 # spark build
637- build_apache_spark (build_tool , hadoop_version )
655+ build_apache_spark (build_tool , extra_profiles )
638656
639657 # backwards compatibility checks
640658 if build_tool == "sbt" :
641659 # Note: compatibility tests only supported in sbt for now
642- detect_binary_inop_with_mima (hadoop_version )
660+ detect_binary_inop_with_mima (extra_profiles )
643661 # Since we did not build assembly/package before running dev/mima, we need to
644662 # do it here because the tests still rely on it; see SPARK-13294 for details.
645- build_spark_assembly_sbt (hadoop_version , should_run_java_style_checks )
663+ build_spark_assembly_sbt (extra_profiles , should_run_java_style_checks )
646664
647665 # run the test suites
648- run_scala_tests (build_tool , hadoop_version , test_modules , excluded_tags )
666+ run_scala_tests (build_tool , extra_profiles , test_modules , excluded_tags )
649667
650668 modules_with_python_tests = [m for m in test_modules if m .python_test_goals ]
651669 if modules_with_python_tests :
0 commit comments