@@ -400,22 +400,26 @@ class ConstraintPropagationSuite extends SparkFunSuite {
400400 }
401401
402402 test(" enable/disable constraint propagation" ) {
403- val tr = LocalRelation (' a .int, ' b .string, ' c .int)
404- val filterRelation = tr.where(' a .attr > 10 )
403+ try {
404+ val tr = LocalRelation (' a .int, ' b .string, ' c .int)
405+ val filterRelation = tr.where(' a .attr > 10 )
405406
406- SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , true )
407- assert(filterRelation.analyze.constraints.nonEmpty)
407+ SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , true )
408+ assert(filterRelation.analyze.constraints.nonEmpty)
408409
409- SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , false )
410- assert(filterRelation.analyze.constraints.isEmpty)
410+ SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , false )
411+ assert(filterRelation.analyze.constraints.isEmpty)
411412
412- val aliasedRelation = tr.where(' c .attr > 10 && ' a .attr < 5 )
413- .groupBy(' a , ' c , ' b )(' a , ' c .as(" c1" ), count(' a ).as(" a3" )).select(' c1 , ' a , ' a3 )
413+ val aliasedRelation = tr.where(' c .attr > 10 && ' a .attr < 5 )
414+ .groupBy(' a , ' c , ' b )(' a , ' c .as(" c1" ), count(' a ).as(" a3" )).select(' c1 , ' a , ' a3 )
414415
415- SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , true )
416- assert(aliasedRelation.analyze.constraints.nonEmpty)
416+ SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , true )
417+ assert(aliasedRelation.analyze.constraints.nonEmpty)
417418
418- SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , false )
419- assert(aliasedRelation.analyze.constraints.isEmpty)
419+ SQLConf .get.setConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED , false )
420+ assert(aliasedRelation.analyze.constraints.isEmpty)
421+ } finally {
422+ SQLConf .get.unsetConf(SQLConf .CONSTRAINT_PROPAGATION_ENABLED )
423+ }
420424 }
421425}
0 commit comments