Skip to content

Commit

Permalink
add java doc
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-bli committed Nov 29, 2023
1 parent 4304f72 commit 0f7d24e
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
18 changes: 13 additions & 5 deletions src/main/java/com/snowflake/snowpark_java/TableFunctions.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package com.snowflake.snowpark_java;


/**
* Provides utility functions that generate table function expressions that can be passed to
* DataFrame join method and Session tableFunction method.
Expand Down Expand Up @@ -159,13 +158,22 @@ public static Column flatten(Column input) {
* <p>Example
*
* <pre>{@code
* df.join(TableFunctions.flatten(
* Functions.parse_json(df.col("col"))));
* DataFrame df =
* getSession()
* .createDataFrame(
* new Row[] {Row.create("{\"a\":1, \"b\":2}")},
* StructType.create(new StructField("col", DataTypes.StringType)));
* DataFrame df1 =
* df.select(
* Functions.parse_json(df.col("col"))
* .cast(DataTypes.createMapType(DataTypes.StringType, DataTypes.IntegerType))
* .as("col"));
* df1.select(TableFunctions.explode(df1.col("col"))).show()
* }</pre>
*
* @since 1.10.0
* @param input The expression that will be unseated into rows. The expression must be MapType or
* ArrayType data.
* @param input The expression that will be unseated into rows. The expression must be either
* MapType or ArrayType data.
* @return The result Column reference
*/
public static Column explode(Column input) {
Expand Down
2 changes: 1 addition & 1 deletion src/main/scala/com/snowflake/snowpark/tableFunctions.scala
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ object tableFunctions {
*
* @since 1.10.0
* @param input The expression that will be unseated into rows.
* The expression must be MapType or ArrayType data.
* The expression must be either MapType or ArrayType data.
* @return The result Column reference
*/
def explode(input: Column): Column = TableFunction("explode").apply(input)
Expand Down

0 comments on commit 0f7d24e

Please sign in to comment.