flink-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Jark Wu (Jira)" <j...@apache.org>
Subject [jira] [Comment Edited] (FLINK-14520) Could not find a suitable table factory, but Factory is available
Date Fri, 25 Oct 2019 04:38:00 GMT

    [ https://issues.apache.org/jira/browse/FLINK-14520?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16959425#comment-16959425
] 

Jark Wu edited comment on FLINK-14520 at 10/25/19 4:37 AM:
-----------------------------------------------------------

Hi [~mserranom], {{CSV}} doesn't not work on filesystem, {{OldCsv}} should work but you should
decalre schema on OldCsv again because {{deriveSchema}} doesn't work in 1.9. Please try this:


{code:java}
tableEnv
			.connect(new FileSystem().path("file://./data.json"))
			.withSchema(new Schema().field("f0", Types.LONG()))
			.withFormat(new OldCsv().field("f0", Types.LONG()))
			.inAppendMode()
			.registerTableSink("sink");
{code}



was (Author: jark):
Hi [~mserranom], {{CSV}} doesn't not work, {{OldCsv}} should work but you should decalre schema
on OldCsv again because {{deriveSchema}} doesn't work in 1.9. Please try this:


{code:java}
tableEnv
			.connect(new FileSystem().path("file://./data.json"))
			.withSchema(new Schema().field("f0", Types.LONG()))
			.withFormat(new OldCsv().field("f0", Types.LONG()))
			.inAppendMode()
			.registerTableSink("sink");
{code}


> Could not find a suitable table factory, but Factory is available
> -----------------------------------------------------------------
>
>                 Key: FLINK-14520
>                 URL: https://issues.apache.org/jira/browse/FLINK-14520
>             Project: Flink
>          Issue Type: Bug
>          Components: Table SQL / API
>    Affects Versions: 1.9.0, 1.9.1
>         Environment: MacOS 10.14.5 and Ubuntu 16.10
>            Reporter: Miguel Serrano
>            Priority: Major
>         Attachments: example.zip
>
>
> *Description*
> Flink can't find JSON table factory. {color:#24292e}JsonRowFormatFactory{color} is considered
but won't match properties.
>  
> gist with code and error: [https://gist.github.com/mserranom/4b2e0088b6000b892c38bd7f93d4fe73]
> Attached is a zip file for reproduction.
>  
> *Error message excerpt*
> {code:java}
> rg.apache.flink.table.api.TableException: findAndCreateTableSink failed.
>         at org.apache.flink.table.factories.TableFactoryUtil.findAndCreateTableSink(TableFactoryUtil.java:87)
>         at org.apache.flink.table.factories.TableFactoryUtil.findAndCreateTableSink(TableFactoryUtil.java:77)
> ...
> Caused by: org.apache.flink.table.api.NoMatchingTableFactoryException: Could not find
a suitable table factory for 'org.apache.flink.table.factories.TableSinkFactory' in
> the classpath.
> ...
> The following properties are requested:
> connector.path=file://./data.json
> connector.property-version=1
> connector.type=filesystem
> format.derive-schema=true
> format.fail-on-missing-field=false
> format.property-version=1
> format.type=json
> schema.0.name=f0
> schema.0.type=BIGINT
> update-mode=append
> ...
> The following factories have been considered:
> org.apache.flink.formats.json.JsonRowFormatFactory
> org.apache.flink.table.sources.CsvBatchTableSourceFactory
> ...
> {code}
> *Code*
> {code:java}
> StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
> EnvironmentSettings settings =
>         EnvironmentSettings.newInstance().useOldPlanner().inStreamingMode().build();
> StreamTableEnvironment tableEnv = StreamTableEnvironment.create(env, settings);    DataStreamSource<Long>
stream = env.fromElements(1L, 21L, 22L);    
> Table table = tableEnv.fromDataStream(stream);
>     tableEnv.registerTable("data", table);    tableEnv
>         .connect(new FileSystem().path("file://./data.json"))
>         .withSchema(new Schema().field("f0", Types.LONG))
>         .withFormat(new Json().failOnMissingField(false).deriveSchema())
>         .inAppendMode()
>         .registerTableSink("sink");    
> env.execute();
> {code}
>  



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

Mime
View raw message