Skip to content

Commit 7591919

Browse files
authored
test: add prepare alias slt test (#18522)
## Which issue does this PR close? This did not work (#18102 (comment)): ```sql DataFusion CLI v50.3.0 > prepare myplan as select $1 as one, $2 as two; Schema error: No field named one. ``` But now it does (#18102 (comment)): ```sql DataFusion CLI v50.3.0 > PREPARE my_plan(INT, INT) AS SELECT $1 AS one, $2 AS two; 0 row(s) fetched. Elapsed 0.004 seconds. > ``` ## Rationale for this change This PR add a testcase for placeholder aliases. ## What changes are included in this PR? Add test case in `prepare.slt` ## Are these changes tested? Yes ## Are there any user-facing changes? No
1 parent a5eb912 commit 7591919

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

datafusion/sqllogictest/test_files/prepare.slt

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -327,3 +327,35 @@ EXECUTE my_plan('a', 'b');
327327
----
328328
1 a
329329
2 b
330+
331+
statement ok
332+
SET datafusion.explain.logical_plan_only=false;
333+
334+
statement ok
335+
DEALLOCATE my_plan
336+
337+
statement ok
338+
SET datafusion.explain.logical_plan_only=true;
339+
340+
# Prepare with alias
341+
query TT
342+
EXPLAIN PREPARE my_plan(INT, INT) AS SELECT $1 AS one, $2 AS two;
343+
----
344+
logical_plan
345+
01)Prepare: "my_plan" [Int32, Int32]
346+
02)--Projection: $1 AS one, $2 AS two
347+
03)----EmptyRelation: rows=1
348+
349+
statement ok
350+
PREPARE my_plan(INT, INT) AS SELECT $1 AS one, $2 AS two;
351+
352+
query II
353+
EXECUTE my_plan(1, 2)
354+
----
355+
1 2
356+
357+
statement ok
358+
SET datafusion.explain.logical_plan_only=false;
359+
360+
statement ok
361+
DEALLOCATE my_plan

0 commit comments

Comments
 (0)