top of page

Hive on Spark simple program

  • Writer: Jatin Madaan
    Jatin Madaan
  • Apr 28, 2019
  • 1 min read

## 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 .


Recent Posts

See All

Comments


  • linkedin

©2019 by Jatinmadaan

bottom of page