Working With DataFrames in Snowpark Java - Snowflake Documentation
The document discusses how to work with DataFrames in Snowpark Java. It explains that DataFrames represent relational datasets that can be queried and processed. It also outlines the steps to retrieve data into a DataFrame, which includes constructing the DataFrame, specifying transformations, and executing an action to retrieve the data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
63 views1 page
Working With DataFrames in Snowpark Java - Snowflake Documentation
The document discusses how to work with DataFrames in Snowpark Java. It explains that DataFrames represent relational datasets that can be queried and processed. It also outlines the steps to retrieve data into a DataFrame, which includes constructing the DataFrame, specifying transformations, and executing an action to retrieve the data.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1
4/29/24, 3:04 PM Working with DataFrames in Snowpark Java | Snowflake Documentation
Developer Snowpark API Java Using DataFrames
Working with DataFrames in Snowpark Java In Snowpark, the main way in which you query and process data is through a DataFrame. This topic explains how to work with DataFrames. To retrieve and manipulate data, you use the DataFrame class. A DataFrame represents a relational dataset that is evaluated lazily: it only executes when a specific action is triggered. In a sense, a DataFrame is like a query that needs to be evaluated in order to retrieve data. To retrieve data into a DataFrame: 1. Construct a DataFrame, specifying the source of the data for the dataset. For example, you can create a DataFrame to hold data from a table, an external CSV file, or the execution of a SQL statement. 2. Specify how the dataset in the DataFrame should be transformed. For example, you can specify which columns should be selected, how the rows should be filtered, how the results should be sorted and grouped, etc. 3. Execute the statement to retrieve the data into the DataFrame. In order to retrieve the data into the DataFrame, you must invoke a method that performs an action (for example, the collect() method). The next sections explain these steps in more detail. Setting up the Examples for this Section Some of the examples of this section use a DataFrame to query a table named sample_product_data . If you want to run these examples, you can create this table and fill the table with some data by executing the following SQL statements: CREATE OR REPLACE TABLE sample_product_data (id INT, parent_id INT, c INSERT INTO sample_product_data VALUES (1, 0, 5, 'Product 1', 'prod-1', 1, 10, 1.00, 15, TO_DATE('2021.0 (2, 1, 5, 'Product 1A', 'prod-1-A', 1, 20, 2.00, 30, TO_DATE('202 (3, 1, 5, 'Product 1B', 'prod-1-B', 1, 30, 3.00, 45, TO_DATE('202 (4, 0, 10, 'Product 2', 'prod-2', 2, 40, 4.00, 60, TO_DATE('2021. (5, 4, 10, 'Product 2A', 'prod-2-A', 2, 50, 5.00, 75, TO_DATE('20 (6, 4, 10, 'Product 2B', 'prod-2-B', 2, 60, 6.00, 90, TO_DATE('20 https://docs.snowflake.com/en/developer-guide/snowpark/java/working-with-dataframes 1/1