@@ -53,50 +53,35 @@ case class SetCommand(kv: Option[(String, Option[String])], output: Seq[Attribut
53
53
extends LeafNode with Command with Logging {
54
54
55
55
override protected lazy val sideEffectResult : Seq [Row ] = kv match {
56
- // Set value for the key .
57
- case Some ((key , Some (value))) =>
58
- if (key == SQLConf . Deprecated . MAPRED_REDUCE_TASKS ) {
59
- logWarning( s " Property ${SQLConf .Deprecated .MAPRED_REDUCE_TASKS } is deprecated, " +
56
+ // Configures the deprecated "mapred.reduce.tasks" property .
57
+ case Some ((SQLConf . Deprecated . MAPRED_REDUCE_TASKS , Some (value))) =>
58
+ logWarning(
59
+ s " Property ${SQLConf .Deprecated .MAPRED_REDUCE_TASKS } is deprecated, " +
60
60
s " automatically converted to ${SQLConf .SHUFFLE_PARTITIONS } instead. " )
61
- context.setConf(SQLConf .SHUFFLE_PARTITIONS , value)
62
- Seq (Row (s " ${SQLConf .SHUFFLE_PARTITIONS }= $value" ))
63
- } else {
64
- context.setConf(key, value)
65
- Seq (Row (s " $key= $value" ))
66
- }
67
-
68
- // Query the value bound to the key.
61
+ context.setConf(SQLConf .SHUFFLE_PARTITIONS , value)
62
+ Seq (Row (s " ${SQLConf .SHUFFLE_PARTITIONS }= $value" ))
63
+
64
+ // Configures a single property.
65
+ case Some ((key, Some (value))) =>
66
+ context.setConf(key, value)
67
+ Seq (Row (s " $key= $value" ))
68
+
69
+ // Queries all key-value pairs that are set in the SQLConf of the context. Notice that different
70
+ // from Hive, here "SET -v" is an alias of "SET". (In Hive, "SET" returns all changed properties
71
+ // while "SET -v" returns all properties.)
72
+ case Some ((" -v" , None )) | None =>
73
+ context.getAllConfs.map { case (k, v) => Row (s " $k= $v" ) }.toSeq
74
+
75
+ // Queries the deprecated "mapred.reduce.tasks" property.
76
+ case Some ((SQLConf .Deprecated .MAPRED_REDUCE_TASKS , None )) =>
77
+ logWarning(
78
+ s " Property ${SQLConf .Deprecated .MAPRED_REDUCE_TASKS } is deprecated, " +
79
+ s " showing ${SQLConf .SHUFFLE_PARTITIONS } instead. " )
80
+ Seq (Row (s " ${SQLConf .SHUFFLE_PARTITIONS }= ${context.numShufflePartitions}" ))
81
+
82
+ // Queries a single property.
69
83
case Some ((key, None )) =>
70
- // TODO (lian) This is just a workaround to make the Simba ODBC driver work.
71
- // Should remove this once we get the ODBC driver updated.
72
- if (key == " -v" ) {
73
- val hiveJars = Seq (
74
- " hive-exec-0.12.0.jar" ,
75
- " hive-service-0.12.0.jar" ,
76
- " hive-common-0.12.0.jar" ,
77
- " hive-hwi-0.12.0.jar" ,
78
- " hive-0.12.0.jar" ).mkString(" :" )
79
-
80
- context.getAllConfs.map { case (k, v) =>
81
- Row (s " $k= $v" )
82
- }.toSeq ++ Seq (
83
- Row (" system:java.class.path=" + hiveJars),
84
- Row (" system:sun.java.command=shark.SharkServer2" ))
85
- } else {
86
- if (key == SQLConf .Deprecated .MAPRED_REDUCE_TASKS ) {
87
- logWarning(s " Property ${SQLConf .Deprecated .MAPRED_REDUCE_TASKS } is deprecated, " +
88
- s " showing ${SQLConf .SHUFFLE_PARTITIONS } instead. " )
89
- Seq (Row (s " ${SQLConf .SHUFFLE_PARTITIONS }= ${context.numShufflePartitions}" ))
90
- } else {
91
- Seq (Row (s " $key= ${context.getConf(key, " <undefined>" )}" ))
92
- }
93
- }
94
-
95
- // Query all key-value pairs that are set in the SQLConf of the context.
96
- case _ =>
97
- context.getAllConfs.map { case (k, v) =>
98
- Row (s " $k= $v" )
99
- }.toSeq
84
+ Seq (Row (s " $key= ${context.getConf(key, " <undefined>" )}" ))
100
85
}
101
86
102
87
override def otherCopyArgs = context :: Nil
0 commit comments