You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@flink.apache.org by "Dawid Wysakowicz (Jira)" <ji...@apache.org> on 2020/04/18 15:31:00 UTC

[jira] [Closed] (FLINK-16379) Introduce fromValues in TableEnvironment

     [ https://issues.apache.org/jira/browse/FLINK-16379?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Dawid Wysakowicz closed FLINK-16379.
------------------------------------
    Resolution: Fixed

Implemented in 6b3e037b7073c06412210cc82843924e8a3c9eee

> Introduce fromValues in TableEnvironment
> ----------------------------------------
>
>                 Key: FLINK-16379
>                 URL: https://issues.apache.org/jira/browse/FLINK-16379
>             Project: Flink
>          Issue Type: Sub-task
>          Components: Table SQL / API
>            Reporter: Dawid Wysakowicz
>            Assignee: Dawid Wysakowicz
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.11.0
>
>          Time Spent: 20m
>  Remaining Estimate: 0h
>
> Introduce a fromValues method to TableEnvironment similar to {{VALUES}} clause in SQL
> The suggested API could look like:
> {code}
> 	/**
> 	 * Creates a Table from a given row constructing expressions.
> 	 *
> 	 * <p>Examples:
> 	 *
> 	 * <p>You can use {@link Expressions#row(Object, Object...)} to create a composite rows:
> 	 * <pre>{@code
> 	 *  tEnv.fromValues(
> 	 *      row(1, "ABC"),
> 	 *      row(2L, "ABCDE")
> 	 *  )
> 	 * }</pre>
> 	 * will produce a Table with a schema as follows:
> 	 * <pre>{@code
> 	 *  root
> 	 *  |-- f0: BIGINT NOT NULL
> 	 *  |-- f1: VARCHAR(5) NOT NULL
> 	 * }</pre>
> 	 *
> 	 * <p>ROWs that are a result of e.g. a function call are not flattened
> 	 * <pre>{@code
> 	 *  public class RowFunction extends ScalarFunction {
> 	 *      @DataTypeHint("ROW<f0 BIGINT, f1 VARCHAR(5)>")
> 	 *      Row eval();
> 	 *  }
> 	 *
> 	 *  tEnv.fromValues(
> 	 *      call(new RowFunction()),
> 	 *      call(new RowFunction())
> 	 *  )
> 	 * }</pre>
> 	 * will produce a Table with a schema as follows:
> 	 * <pre>{@code
> 	 *  root
> 	 *  |-- f0: ROW<`f0` BIGINT, `f1` VARCHAR(5)>
> 	 * }</pre>
> 	 *
> 	 * <p>The row constructor can be dropped to create a table with a single row:
> 	 *
> 	 * <p>ROWs that are a result of e.g. a function call are not flattened
> 	 * <pre>{@code
> 	 *  tEnv.fromValues(
> 	 *      1,
> 	 *      2L,
> 	 *      3
> 	 *  )
> 	 * }</pre>
> 	 * will produce a Table with a schema as follows:
> 	 * <pre>{@code
> 	 *  root
> 	 *  |-- f0: BIGINT NOT NULL
> 	 * }</pre>
> 	 *
> 	 * @param expressions Expressions for constructing rows of the VALUES table.
> 	 */
> 	Table fromValues(Expression... expressions);
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)