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

add multi file

parent 41b6e5c0
......@@ -11,13 +11,19 @@ import datetime
def test():
spark = SparkSession.builder.enableHiveSupport().getOrCreate()
ti = pti.TiContext(spark)
# ti.tidbMapDatabase("jerry_test")
ti.tidbMapDatabase("jerry_test")
df = spark.sql("select max(stat_date) from esmm_train_data")
df.show()
t = df.rdd.map(lambda x: str(x[0])).collect()
print(t.count())
data = [(0, 18.0), (1, 19.0), (2, 8.0), (3, 5.0), (4, 2.2), (5, 9.2), (6, 14.4)]
df = spark.createDataFrame(data, ["id", "hour"])
df.show(6)
t = df.rdd.map(lambda x:x[0]).collect()
print(df)
# data = [(0, 18.0), (1, 19.0), (2, 8.0), (3, 5.0), (4, 2.2), (5, 9.2), (6, 14.4)]
# df = spark.createDataFrame(data, ["id", "hour"])
# df.show(6)
# t = df.rdd.map(lambda x:x[0]).collect()
# print(t)
# validate_date = spark.sql("select max(stat_date) from esmm_train_data").rdd.map(lambda x: str(x[0]))
# print(validate_date.count())
......
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