forked from alexott/databricks-nutter-repos-demo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Code1.py
31 lines (21 loc) · 750 Bytes
/
Code1.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# Databricks notebook source
import pyspark.sql.functions as F
import pyspark.sql.types as T
from pyspark.sql import DataFrame
# COMMAND ----------
def generate_data1(n=1000, name='my_cool_data'):
df = spark.range(0, n)
df.createOrReplaceTempView(name)
# COMMAND ----------
def upper_columns(df: DataFrame, cols: list) -> DataFrame:
new_cols = []
for field in df.schema.fields:
if field.dataType == T.StringType() and field.name in cols:
new_cols.append(F.upper(F.col(field.name)).alias(field.name))
else:
new_cols.append(F.col(field.name))
return df.select(*new_cols)
# COMMAND ----------
# just a change of the code to trigger release
print("test")
# COMMAND ----------