# -*- coding: utf-8 -*-
from pyspark.sql import HiveContext
from pyspark.context import SparkContext
from pyspark.conf import SparkConf
import pytispark.pytispark as pti
from pyspark.sql import SQLContext
from pyspark.sql import SparkSession


def test():
    spark = SparkSession.builder.enableHiveSupport().getOrCreate()
    ti = pti.TiContext(spark)
    ti.tidbMapDatabase("jerry_test")
    spark.sql("select device_id from esmm_pre_data limit 6").show(6)


if __name__ == '__main__':
    test()