Commit 361846fb authored by 王志伟's avatar 王志伟
parents 70dab241 725a21a8
# -*- 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()
\ No newline at end of file
......@@ -2,6 +2,7 @@
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
# from py4j.java_gateway import java_import
......@@ -25,10 +26,10 @@ from pyspark.sql import SparkSession
def test():
conf = SparkConf().setAppName("My App").set("spark.io.compression.codec", "lzf")
sc = SparkContext(conf = conf)
hive_context = HiveContext(sc)
from pyspark.sql import SparkSession
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
ti = pti.TiContext(spark)
ti.tidbMapDatabase("jerry_test")
spark = SparkSession.builder.appName("BinarizerExample").enableHiveSupport().getOrCreate()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment