Skip to content

Commit

Permalink
update tests
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-vbudati committed Oct 31, 2024
1 parent 31ce5b1 commit 12679bc
Show file tree
Hide file tree
Showing 109 changed files with 16,061 additions and 67 deletions.
2 changes: 1 addition & 1 deletion src/snowflake/snowpark/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -1357,7 +1357,7 @@ def select(
for e in exprs:
if isinstance(e, Column):
names.append(e._named())
if _emit_ast and ast:
if _emit_ast and ast and e._ast:
ast.cols.append(e._ast)

elif isinstance(e, str):
Expand Down
29 changes: 25 additions & 4 deletions src/snowflake/snowpark/functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -9822,16 +9822,33 @@ def make_interval(
You can also find some examples to use interval constants with :meth:`~snowflake.snowpark.Window.range_between`
method.
"""

ast = None
if _emit_ast:
raise NotImplementedError("TODO SNOW-1690923: Add interval support to IR.")
ast = proto.Expr()
build_builtin_fn_apply(
ast,
"make_interval",
years,
quarters,
months,
weeks,
days,
hours,
minutes,
seconds,
milliseconds,
microseconds,
nanoseconds,
mins,
secs,
)

# for migration purpose
minutes = minutes or mins
seconds = seconds or secs

# create column
return Column(
res = Column(
Interval(
years,
quarters,
Expand All @@ -9844,5 +9861,9 @@ def make_interval(
milliseconds,
microseconds,
nanoseconds,
)
),
_emit_ast=False,
)

res._ast = ast
return res
90 changes: 90 additions & 0 deletions tests/ast/data/DataFrame.agg.test
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,19 @@ body {
vs {
list_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 1
Expand All @@ -46,7 +52,10 @@ body {
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 2
Expand All @@ -57,13 +66,19 @@ body {
vs {
list_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 3
Expand All @@ -72,7 +87,10 @@ body {
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 4
Expand All @@ -83,13 +101,19 @@ body {
vs {
list_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 1
Expand All @@ -98,7 +122,10 @@ body {
vs {
int64_val {
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
v: 4
Expand All @@ -115,7 +142,10 @@ body {
}
}
src {
end_column: 82
end_line: 27
file: "SRC_POSITION_TEST_MODE"
start_column: 13
start_line: 27
}
}
Expand Down Expand Up @@ -166,20 +196,29 @@ body {
pos_args {
string_val {
src {
end_column: 36
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 28
start_line: 29
}
v: "a"
}
}
src {
end_column: 36
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 28
start_line: 29
}
}
}
src {
end_column: 37
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 21
start_line: 29
}
}
Expand Down Expand Up @@ -209,28 +248,40 @@ body {
pos_args {
string_val {
src {
end_column: 58
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 50
start_line: 29
}
v: "a"
}
}
src {
end_column: 58
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 50
start_line: 29
}
}
}
src {
end_column: 59
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 39
start_line: 29
}
}
}
variadic: true
}
src {
end_column: 60
end_line: 29
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 29
}
}
Expand Down Expand Up @@ -259,13 +310,19 @@ body {
args {
tuple_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
vs {
string_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
v: "a"
Expand All @@ -274,7 +331,10 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
v: "min"
Expand All @@ -285,13 +345,19 @@ body {
args {
tuple_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
vs {
string_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
v: "b"
Expand All @@ -300,7 +366,10 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
v: "max"
Expand All @@ -311,7 +380,10 @@ body {
variadic: true
}
src {
end_column: 48
end_line: 31
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 31
}
}
Expand Down Expand Up @@ -343,7 +415,10 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
v: "a"
Expand All @@ -352,7 +427,10 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
v: "count"
Expand All @@ -363,7 +441,10 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
v: "b"
Expand All @@ -372,23 +453,32 @@ body {
vs {
string_val {
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
v: "sum"
}
}
}
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
}
}
variadic: true
}
src {
end_column: 48
end_line: 33
file: "SRC_POSITION_TEST_MODE"
start_column: 14
start_line: 33
}
}
Expand Down
Loading

0 comments on commit 12679bc

Please sign in to comment.