You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by françois lacombe <fr...@dcbrain.com> on 2018/08/27 14:26:03 UTC

withFormat(Csv) is undefined for the type BatchTableEnvironment

Hi all,

I'm currently trying to load a CSV file content with Flink 1.6.0 table API.
This error is raised as a try to execute the code written in docs
https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format

ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);
tEnv.withFormat(new Csv(...));

> Exception in thread "main" java.lang.Error: Unresolved compilation
problem:
   The method withFormat(Csv) is undefined for the type
BatchTableEnvironment

Am I wrong?

Thanks in advance for any hint

François

Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by françois lacombe <fr...@dcbrain.com>.
Hi

It's all good, I've misunderstood some points in the example codes.
All is working fine with BatchTableDescriptor

All the best

François

2018-08-30 11:40 GMT+02:00 Timo Walther <tw...@apache.org>:

> Hi François,
>
> you should read the documentation from top to bottom. The overview part
> [1] explains how everything plays together with examples.
>
> Regards,
> Timo
>
> [1] https://ci.apache.org/projects/flink/flink-docs-
> master/dev/table/connect.html#overview
>
> Am 30.08.18 um 10:41 schrieb Till Rohrmann:
>
> Hi François,
>
> as Vino said, the BatchTableEnvironment does not provide a `withFormat`
> method. Admittedly, the documentation does not state it too explicitly but
> you can only call the `withFormat` method on a table connector as indicated
> here [1]. If you think that you need to get the data from somewhere first
> before defining a format, then it becomes clear that you first need to
> define a connector.
>
> [1] https://ci.apache.org/projects/flink/flink-docs-
> release-1.6/dev/table/connect.html#table-formats
>
> Cheers,
> Till
>
> On Thu, Aug 30, 2018 at 4:46 AM vino yang <ya...@gmail.com> wrote:
>
>> Hi francois,
>>
>> Maybe you can refer to the comments of this source code?[1]
>>
>> https://github.com/apache/flink/blob/master/flink-
>> libraries/flink-table/src/main/scala/org/apache/flink/table/api/
>> BatchTableEnvironment.scala#L143
>>
>> Thanks, vino.
>>
>> françois lacombe <fr...@dcbrain.com> 于2018年8月29日周三 下午10:54写道:
>>
>>> Hi Vino,
>>>
>>> Thanks for this answer.
>>> I can't find in the docs where it's about BatchTableDescriptor
>>> https://ci.apache.org/projects/flink/flink-docs-
>>> release-1.6/dev/table/connect.html#csv-format
>>>
>>> It sounds like the withFormat method is applied on TableEnvironment
>>> object on this page.
>>>
>>> All the best
>>>
>>> François
>>>
>>> 2018-08-28 4:37 GMT+02:00 vino yang <ya...@gmail.com>:
>>>
>>>> Hi Francois,
>>>>
>>>> Yes, the withFormat API comes from an instance of BatchTableDescriptor,
>>>> and the BatchTableDescriptor instance is returned by the connect API, so
>>>> you should call BatchTableEnvironment#connect first.
>>>>
>>>> Thanks, vino.
>>>>
>>>> françois lacombe <fr...@dcbrain.com> 于2018年8月27日周一
>>>> 下午10:26写道:
>>>>
>>>>> Hi all,
>>>>>
>>>>> I'm currently trying to load a CSV file content with Flink 1.6.0 table
>>>>> API.
>>>>> This error is raised as a try to execute the code written in docs
>>>>> https://ci.apache.org/projects/flink/flink-docs-
>>>>> release-1.6/dev/table/connect.html#csv-format
>>>>>
>>>>> ExecutionEnvironment env = ExecutionEnvironment.
>>>>> getExecutionEnvironment();
>>>>> BatchTableEnvironment tEnv = TableEnvironment.
>>>>> getTableEnvironment(env);
>>>>> tEnv.withFormat(new Csv(...));
>>>>>
>>>>> > Exception in thread "main" java.lang.Error: Unresolved compilation
>>>>> problem:
>>>>>    The method withFormat(Csv) is undefined for the type
>>>>> BatchTableEnvironment
>>>>>
>>>>> Am I wrong?
>>>>>
>>>>> Thanks in advance for any hint
>>>>>
>>>>> François
>>>>>
>>>>
>>>
>

Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by Timo Walther <tw...@apache.org>.
Hi François,

you should read the documentation from top to bottom. The overview part 
[1] explains how everything plays together with examples.

Regards,
Timo

[1] 
https://ci.apache.org/projects/flink/flink-docs-master/dev/table/connect.html#overview

Am 30.08.18 um 10:41 schrieb Till Rohrmann:
> Hi François,
>
> as Vino said, the BatchTableEnvironment does not provide a 
> `withFormat` method. Admittedly, the documentation does not state it 
> too explicitly but you can only call the `withFormat` method on a 
> table connector as indicated here [1]. If you think that you need to 
> get the data from somewhere first before defining a format, then it 
> becomes clear that you first need to define a connector.
>
> [1] 
> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#table-formats
>
> Cheers,
> Till
>
> On Thu, Aug 30, 2018 at 4:46 AM vino yang <yanghua1127@gmail.com 
> <ma...@gmail.com>> wrote:
>
>     Hi francois,
>
>     Maybe you can refer to the comments of this source code?[1]
>
>     https://github.com/apache/flink/blob/master/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/BatchTableEnvironment.scala#L143
>
>     Thanks, vino.
>
>     françois lacombe <francois.lacombe@dcbrain.com
>     <ma...@dcbrain.com>> 于2018年8月29日周三
>     下午10:54写道:
>
>         Hi Vino,
>
>         Thanks for this answer.
>         I can't find in the docs where it's about BatchTableDescriptor
>         https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>
>         It sounds like the withFormat method is applied on
>         TableEnvironment object on this page.
>
>         All the best
>
>         François
>
>         2018-08-28 4:37 GMT+02:00 vino yang <yanghua1127@gmail.com
>         <ma...@gmail.com>>:
>
>             Hi Francois,
>
>             Yes, the withFormat API comes from an instance of
>             BatchTableDescriptor, and the BatchTableDescriptor
>             instance is returned by the connect API, so you should
>             call BatchTableEnvironment#connect first.
>
>             Thanks, vino.
>
>             françois lacombe <francois.lacombe@dcbrain.com
>             <ma...@dcbrain.com>> 于2018年8月27日周一
>             下午10:26写道:
>
>                 Hi all,
>
>                 I'm currently trying to load a CSV file content with
>                 Flink 1.6.0 table API.
>                 This error is raised as a try to execute the code
>                 written in docs
>                 https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>
>                 ExecutionEnvironment env =
>                 ExecutionEnvironment.getExecutionEnvironment();
>                 BatchTableEnvironment tEnv =
>                 TableEnvironment.getTableEnvironment(env);
>                 tEnv.withFormat(new Csv(...));
>
>                 > Exception in thread "main" java.lang.Error:
>                 Unresolved compilation problem:
>                    The method withFormat(Csv) is undefined for the
>                 type BatchTableEnvironment
>
>                 Am I wrong?
>
>                 Thanks in advance for any hint
>
>                 François
>
>


Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by Till Rohrmann <tr...@apache.org>.
Hi François,

as Vino said, the BatchTableEnvironment does not provide a `withFormat`
method. Admittedly, the documentation does not state it too explicitly but
you can only call the `withFormat` method on a table connector as indicated
here [1]. If you think that you need to get the data from somewhere first
before defining a format, then it becomes clear that you first need to
define a connector.

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#table-formats

Cheers,
Till

On Thu, Aug 30, 2018 at 4:46 AM vino yang <ya...@gmail.com> wrote:

> Hi francois,
>
> Maybe you can refer to the comments of this source code?[1]
>
>
> https://github.com/apache/flink/blob/master/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/BatchTableEnvironment.scala#L143
>
> Thanks, vino.
>
> françois lacombe <fr...@dcbrain.com> 于2018年8月29日周三 下午10:54写道:
>
>> Hi Vino,
>>
>> Thanks for this answer.
>> I can't find in the docs where it's about BatchTableDescriptor
>>
>> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>>
>> It sounds like the withFormat method is applied on TableEnvironment
>> object on this page.
>>
>> All the best
>>
>> François
>>
>> 2018-08-28 4:37 GMT+02:00 vino yang <ya...@gmail.com>:
>>
>>> Hi Francois,
>>>
>>> Yes, the withFormat API comes from an instance of BatchTableDescriptor,
>>> and the BatchTableDescriptor instance is returned by the connect API, so
>>> you should call BatchTableEnvironment#connect first.
>>>
>>> Thanks, vino.
>>>
>>> françois lacombe <fr...@dcbrain.com> 于2018年8月27日周一 下午10:26写道:
>>>
>>>> Hi all,
>>>>
>>>> I'm currently trying to load a CSV file content with Flink 1.6.0 table
>>>> API.
>>>> This error is raised as a try to execute the code written in docs
>>>>
>>>> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>>>>
>>>> ExecutionEnvironment env =
>>>> ExecutionEnvironment.getExecutionEnvironment();
>>>> BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);
>>>> tEnv.withFormat(new Csv(...));
>>>>
>>>> > Exception in thread "main" java.lang.Error: Unresolved compilation
>>>> problem:
>>>>    The method withFormat(Csv) is undefined for the type
>>>> BatchTableEnvironment
>>>>
>>>> Am I wrong?
>>>>
>>>> Thanks in advance for any hint
>>>>
>>>> François
>>>>
>>>
>>

Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by vino yang <ya...@gmail.com>.
Hi francois,

Maybe you can refer to the comments of this source code?[1]

https://github.com/apache/flink/blob/master/flink-libraries/flink-table/src/main/scala/org/apache/flink/table/api/BatchTableEnvironment.scala#L143

Thanks, vino.

françois lacombe <fr...@dcbrain.com> 于2018年8月29日周三 下午10:54写道:

> Hi Vino,
>
> Thanks for this answer.
> I can't find in the docs where it's about BatchTableDescriptor
>
> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>
> It sounds like the withFormat method is applied on TableEnvironment object
> on this page.
>
> All the best
>
> François
>
> 2018-08-28 4:37 GMT+02:00 vino yang <ya...@gmail.com>:
>
>> Hi Francois,
>>
>> Yes, the withFormat API comes from an instance of BatchTableDescriptor,
>> and the BatchTableDescriptor instance is returned by the connect API, so
>> you should call BatchTableEnvironment#connect first.
>>
>> Thanks, vino.
>>
>> françois lacombe <fr...@dcbrain.com> 于2018年8月27日周一 下午10:26写道:
>>
>>> Hi all,
>>>
>>> I'm currently trying to load a CSV file content with Flink 1.6.0 table
>>> API.
>>> This error is raised as a try to execute the code written in docs
>>>
>>> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>>>
>>> ExecutionEnvironment env =
>>> ExecutionEnvironment.getExecutionEnvironment();
>>> BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);
>>> tEnv.withFormat(new Csv(...));
>>>
>>> > Exception in thread "main" java.lang.Error: Unresolved compilation
>>> problem:
>>>    The method withFormat(Csv) is undefined for the type
>>> BatchTableEnvironment
>>>
>>> Am I wrong?
>>>
>>> Thanks in advance for any hint
>>>
>>> François
>>>
>>
>

Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by françois lacombe <fr...@dcbrain.com>.
Hi Vino,

Thanks for this answer.
I can't find in the docs where it's about BatchTableDescriptor
https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format

It sounds like the withFormat method is applied on TableEnvironment object
on this page.

All the best

François

2018-08-28 4:37 GMT+02:00 vino yang <ya...@gmail.com>:

> Hi Francois,
>
> Yes, the withFormat API comes from an instance of BatchTableDescriptor,
> and the BatchTableDescriptor instance is returned by the connect API, so
> you should call BatchTableEnvironment#connect first.
>
> Thanks, vino.
>
> françois lacombe <fr...@dcbrain.com> 于2018年8月27日周一 下午10:26写道:
>
>> Hi all,
>>
>> I'm currently trying to load a CSV file content with Flink 1.6.0 table
>> API.
>> This error is raised as a try to execute the code written in docs
>> https://ci.apache.org/projects/flink/flink-docs-
>> release-1.6/dev/table/connect.html#csv-format
>>
>> ExecutionEnvironment env = ExecutionEnvironment.
>> getExecutionEnvironment();
>> BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);
>> tEnv.withFormat(new Csv(...));
>>
>> > Exception in thread "main" java.lang.Error: Unresolved compilation
>> problem:
>>    The method withFormat(Csv) is undefined for the type
>> BatchTableEnvironment
>>
>> Am I wrong?
>>
>> Thanks in advance for any hint
>>
>> François
>>
>

Re: withFormat(Csv) is undefined for the type BatchTableEnvironment

Posted by vino yang <ya...@gmail.com>.
Hi Francois,

Yes, the withFormat API comes from an instance of BatchTableDescriptor, and
the BatchTableDescriptor instance is returned by the connect API, so you
should call BatchTableEnvironment#connect first.

Thanks, vino.

françois lacombe <fr...@dcbrain.com> 于2018年8月27日周一 下午10:26写道:

> Hi all,
>
> I'm currently trying to load a CSV file content with Flink 1.6.0 table API.
> This error is raised as a try to execute the code written in docs
>
> https://ci.apache.org/projects/flink/flink-docs-release-1.6/dev/table/connect.html#csv-format
>
> ExecutionEnvironment env = ExecutionEnvironment.getExecutionEnvironment();
> BatchTableEnvironment tEnv = TableEnvironment.getTableEnvironment(env);
> tEnv.withFormat(new Csv(...));
>
> > Exception in thread "main" java.lang.Error: Unresolved compilation
> problem:
>    The method withFormat(Csv) is undefined for the type
> BatchTableEnvironment
>
> Am I wrong?
>
> Thanks in advance for any hint
>
> François
>