<div dir="ltr"><div><div dir="ltr" class="gmail_signature" data-smartmail="gmail_signature"><div dir="ltr"><div><div dir="ltr"><div><div dir="ltr">One thing I realized is that if you convert an existing [complex] query to use Pipe Operator for readability, the pushdown optimization will not be applied. Pushdown optimization improves performance by filtering out unneeded rows as early as possible during query processing. Pushdown optimization can also reduce memory consumption. However, due to how the Pipe Operator works (i.e. a DAG pattern), Snowflake will not be able to apply these types of Optimizations. So while you can use the Pipe Operator to make the SQL more readable, you may be losing on the Pushdown Optimization benefits in Snowflake. Just something to think about.<div><span style="font-size:12.8000001907349px"><br></span></div></div></div></div></div></div></div></div><br></div><br><div class="gmail_quote gmail_quote_container"><div dir="ltr" class="gmail_attr">On Mon, May 19, 2025 at 10:32 PM Ali, Saqib <<a href="mailto:docbook.xml@gmail.com">docbook.xml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Here is another example of Snowflake Pipe Operator (aka. Arrow Operator) using the Pseudo-SQL SHOW WAREHOUSES:</div><div><br></div><div>show warehouses<br>->> select <br>  "name"<br>  , "state"<br>  , "type"<br>  , "size"<br>from $1<br>where "state" in ('STARTED', 'SUSPENDED');</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 19, 2025 at 10:10 PM Ali, Saqib <<a href="mailto:docbook.xml@gmail.com" target="_blank">docbook.xml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Snowflake's Pipe Operator (aka the Arrow Operator) is much more than the Google Bigquery's Pipe (|>) operator. It is a way to write SQL based DAGs. Here is an example:<br><br>select <br>  c_mktsegment<br>  , count(*) as num_of_customer_per_segment<br>from SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER<br>group by c_mktsegment<br>->> create or replace  table delete_me as select *<br><div>from $1 where num_of_customer_per_segment > 30000 </div><div>-- note the use of $1 to refer to the output from the previous statement</div>->> select * from delete_me;<br>;<br><br>Snowflake's Pipe Operator (aka the Arrow Operator) supports multiple SQL statements. Statements can be SELECTs, DMLs and pseudo-SQL statements (like SHOW, DESCRIBE etc. in Snowflake) and Stored Procedures etc. Statements can refer to results from any of the previous statements using the $1,$2, $3 syntax.<br><br><div>Here is example with using the pseudo-SQL statement "describe":</div><div><br></div>describe table SNOWFLAKE_SAMPLE_DATA.TPCH_SF1.CUSTOMER<br>->> select *<br>from $1<br><div>where "type" ilike '%varchar%' ;</div><div><br></div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Tue, May 13, 2025 at 10:27 PM Ali, Saqib <<a href="mailto:docbook.xml@gmail.com" target="_blank">docbook.xml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"> Maybe Snowflake should have called it an Arrow Operator instead of Pipe Operator:<br><br>Bigquery and Databricks use "|>"<br>Snowflake uses "->>"</div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, May 12, 2025 at 6:01 AM Ali, Saqib <<a href="mailto:docbook.xml@gmail.com" target="_blank">docbook.xml@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">I am curious why Snowflake chose "->>" as the Pipe Operator when<br>
Google Bigquery has already adopted "|>" as the Pipe Operator for SQL.<br>
¯\_(ツ)_/¯<br>
<br>
<br>
On Sat, May 10, 2025 at 10:21 PM Ali, Saqib <<a href="mailto:docbook.xml@gmail.com" target="_blank">docbook.xml@gmail.com</a>> wrote:<br>
><br>
> Following in Google BigQuery's footsteps, Snowflake will be adding support for the SQL Pipe Operator soon. The new pipe operator (->>) will enable chaining of  SQL statements. In the chain of SQL statements, the results of one statement can serve as the input to another statement. The pipe operator can simplify the execution of dependent SQL statements and improve the readability and flexibility of complex SQL operations.<br>
><br>
</blockquote></div>
</blockquote></div>
</blockquote></div>
</blockquote></div>