top of page
  • Writer's pictureJatin Madaan

Hive on Spark simple program


## PySpark code to run sql command .


code :


## Importing HiveContext

>>>> from pyspark.sql import Hive Context


## Create a SqlContext using Spark Context (sc)

>>>> sqlContext = HiveContext(sc)


## Writing Query

>>>> query = sqlContext.sql("MSCK REPAIR TABLE [TABLE_NAME]")


inside double quotes (") we can write any hive query. Most queries which work on hive will work here as well .


12 views0 comments

Comentários


bottom of page