Commit 2f6a165b authored by 张彦钊's avatar 张彦钊

修改测试文件

parent 4e3d8588
......@@ -6,6 +6,8 @@ from pyspark.conf import SparkConf
from pyspark.sql import SQLContext
from pyspark.sql import SparkSession
from py4j.java_gateway import java_import
builtin = __import__('__builtin__')
abs = builtin.abs
def test():
......@@ -21,10 +23,13 @@ def esmm_pre():
yesterday = (datetime.date.today() - datetime.timedelta(days=1)).strftime("%Y-%m-%d")
print(yesterday)
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
gw = SparkContext._gateway
java_import(gw.jvm, "org.apache.spark.sql.TiContext")
# java_import(gw.jvm, "org.apache.spark.sql.TiExtensions")
# conf = SparkConf().setAppName("esmm_pre").set("spark.io.compression.codec", "lzf")
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
ti = gw.jvm.TiExtensions.getInstance(spark._jsparkSession).getOrCreateTiContext(spark._jsparkSession)
# Map database as old api does
......
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