Commit a1fcf4f3 authored by 张彦钊's avatar 张彦钊

change test file

parent c091f12a
......@@ -6,6 +6,7 @@ from pyspark.conf import SparkConf
from pyspark.sql import SQLContext
from pyspark.sql import SparkSession
from py4j.java_gateway import java_import
import pytispark.pytispark as pti
......@@ -23,13 +24,14 @@ def esmm_pre():
print(yesterday)
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
gw = SparkContext._gateway
# Import TiExtensions
java_import(gw.jvm, "org.apache.spark.sql.TiContext")
# gw = SparkContext._gateway
#
# # Import TiExtensions
# java_import(gw.jvm, "org.apache.spark.sql.TiContext")
# Inject TiExtensions, and get a TiContext
ti = gw.jvm.TiExtensions.getInstance(spark._jsparkSession).getOrCreateTiContext(spark._jsparkSession)
# ti = gw.jvm.TiExtensions.getInstance(spark._jsparkSession).getOrCreateTiContext(spark._jsparkSession)
ti = pti.TiContext(spark)
ti.tidbMapDatabase("jerry_test")
......
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