You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@flink.apache.org by "Miguel Serrano (Jira)" <ji...@apache.org> on 2019/10/24 11:01:00 UTC

[jira] [Created] (FLINK-14520) Could not find a suitable table factory, but Factory is available

Miguel Serrano created FLINK-14520:
--------------------------------------

             Summary: 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.1, 1.9.0
         Environment: MacOS 10.14.5 and Ubuntu 16.10
            Reporter: Miguel Serrano
         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)