Skip to content

Commit 51c8168

Browse files
committed
[SPARK-2227] Support dfs command in SQL.
Note that nothing gets printed to the console because we don't properly maintain session state right now. I will have a followup PR that fixes it. Author: Reynold Xin <[email protected]> Closes #1167 from rxin/commands and squashes the following commits: 56f04f8 [Reynold Xin] [SPARK-2227] Support dfs command in SQL.
1 parent 383bf72 commit 51c8168

File tree

1 file changed

+6
-8
lines changed
  • sql/hive/src/main/scala/org/apache/spark/sql/hive

1 file changed

+6
-8
lines changed

sql/hive/src/main/scala/org/apache/spark/sql/hive/HiveQl.scala

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,6 @@ import scala.collection.JavaConversions._
3838
*/
3939
private[hive] case object NativePlaceholder extends Command
4040

41-
private[hive] case class DfsCommand(cmd: String) extends Command
42-
4341
private[hive] case class ShellCommand(cmd: String) extends Command
4442

4543
private[hive] case class SourceCommand(filePath: String) extends Command
@@ -227,15 +225,15 @@ private[hive] object HiveQl {
227225
SetCommand(Some(key), Some(value))
228226
}
229227
} else if (sql.trim.toLowerCase.startsWith("cache table")) {
230-
CacheCommand(sql.drop(12).trim, true)
228+
CacheCommand(sql.trim.drop(12).trim, true)
231229
} else if (sql.trim.toLowerCase.startsWith("uncache table")) {
232-
CacheCommand(sql.drop(14).trim, false)
230+
CacheCommand(sql.trim.drop(14).trim, false)
233231
} else if (sql.trim.toLowerCase.startsWith("add jar")) {
234-
AddJar(sql.drop(8))
232+
AddJar(sql.trim.drop(8))
235233
} else if (sql.trim.toLowerCase.startsWith("add file")) {
236-
AddFile(sql.drop(9))
237-
} else if (sql.trim.startsWith("dfs")) {
238-
DfsCommand(sql)
234+
AddFile(sql.trim.drop(9))
235+
} else if (sql.trim.toLowerCase.startsWith("dfs")) {
236+
NativeCommand(sql)
239237
} else if (sql.trim.startsWith("source")) {
240238
SourceCommand(sql.split(" ").toSeq match { case Seq("source", filePath) => filePath })
241239
} else if (sql.trim.startsWith("!")) {

0 commit comments

Comments
 (0)