Print SQL connector无法正常使用

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Print SQL connector无法正常使用

xiao cai
Hi All:
目前使用flink sql的Print SQL connector,想要将查询的结果打印出来,结果报错:
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.


可以保证:HBase-connector是在lib包下存在的,是否我还需要在lib下添加什么依赖?


下面为执行的sql:


CREATE TABLE dimension (
    rowKey STRING,
    cf ROW<age INT, area BIGINT>,
    tas BIGINT
) WITH (
    'connector.type' = 'hbase',
    'connector.version' = '1.4.3',
    'connector.table-name' = ’test',
    'connector.write.buffer-flush.max-rows' = '10',
    'connector.zookeeper.quorum' = ‘IP:port',
    'connector.zookeeper.znode.parent' = '/hbase',
);


CREATE TABLE print_table (
 f0 STRING,
 f1 INT,
 f2 BIGINT,
 f3 BIGINT
) WITH (
 'connector' = 'print'
);


insert into print_table
select rowKey, cf.age, cf.area, tas
from dimension
Reply | Threaded
Open this post in threaded view
|

Re: Print SQL connector无法正常使用

china_tao
String createHbaseSql = CREATE TABLE dimension (
    rowKey STRING,
    cf ROW<age INT, area BIGINT>,
    tas BIGINT
) WITH (
    'connector.type' = 'hbase',
    'connector.version' = '1.4.3',
    'connector.table-name' = ’test',
    'connector.write.buffer-flush.max-rows' = '10',
    'connector.zookeeper.quorum' = ‘IP:port',
    'connector.zookeeper.znode.parent' = '/hbase',
);
tableEnv.executeSql(createHbaseSql);
Table queryTable = tableEnv.sqlQuery("select * from dimension");
tableEnv.toAppendStream(queryTable, Row.class).print();

你先用这种方式,看看能不能打印出来,证明你hbase没有问题。然后在用print_table。



--
Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Print SQL connector无法正常使用

xiao cai
In reply to this post by xiao cai
Hi china_tao:
你好,HBase肯定没有问题的,请问你可以正常使用print connector吗,能否让我看看正确的使用姿势,感谢


 原始邮件
发件人: china_tao<[hidden email]>
收件人: user-zh<[hidden email]>
发送时间: 2020年8月17日(周一) 23:00
主题: Re: Print SQL connector无法正常使用


String createHbaseSql = CREATE TABLE dimension ( rowKey STRING, cf ROW<age INT, area BIGINT>, tas BIGINT ) WITH ( 'connector.type' = 'hbase', 'connector.version' = '1.4.3', 'connector.table-name' = ’test', 'connector.write.buffer-flush.max-rows' = '10', 'connector.zookeeper.quorum' = ‘IP:port', 'connector.zookeeper.znode.parent' = '/hbase', ); tableEnv.executeSql(createHbaseSql); Table queryTable = tableEnv.sqlQuery("select * from dimension"); tableEnv.toAppendStream(queryTable, Row.class).print(); 你先用这种方式,看看能不能打印出来,证明你hbase没有问题。然后在用print_table。 -- Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Print SQL connector无法正常使用

china_tao
我这个是mysql的,直接run,没问题


EnvironmentSettings settings = EnvironmentSettings.newInstance().useBlinkPlanner().inBatchMode().build();
TableEnvironment tableEnv = TableEnvironment.create(settings);

String createMysqlTableSQL ="CREATE TABLE mysqlTable1 (\n" +
         " id INT,\n" +
         " username STRING,\n" +
         " age INT , \n" +
         " PRIMARY KEY (id) NOT ENFORCED\n" +
         ") WITH (\n" +
         " 'connector' = 'jdbc' ,\n" +
         " 'url' = 'jdbc:mysql://1.2.3.4:3306/bigdata',\n" +
         " 'table-name' = 'test' ,\n" +
         " 'username' = 'root' ,\n" +
         " 'password' = 'root' \n" +
         ")";
String  print_table=" CREATE TABLE print_table (" +
         " id INT," +
         " username STRING," +
         " age INT" +
         " ) WITH (" +
         " 'connector' = 'print'" +
         " )";
tableEnv.executeSql(createMysqlTableSQL);
tableEnv.executeSql(print_table);

String querysql ="insert into print_table select * from mysqlTable1";

tableEnv.executeSql(querysql);

在 2020/8/18 11:57, xiao cai 写道:

> Hi china_tao:
> 你好,HBase肯定没有问题的,请问你可以正常使用print connector吗,能否让我看看正确的使用姿势,感谢
>
>
>   原始邮件
> 发件人: china_tao<[hidden email]>
> 收件人: user-zh<[hidden email]>
> 发送时间: 2020年8月17日(周一) 23:00
> 主题: Re: Print SQL connector无法正常使用
>
>
> String createHbaseSql = CREATE TABLE dimension ( rowKey STRING, cf ROW<age INT, area BIGINT>, tas BIGINT ) WITH ( 'connector.type' = 'hbase', 'connector.version' = '1.4.3', 'connector.table-name' = ’test', 'connector.write.buffer-flush.max-rows' = '10', 'connector.zookeeper.quorum' = ‘IP:port', 'connector.zookeeper.znode.parent' = '/hbase', ); tableEnv.executeSql(createHbaseSql); Table queryTable = tableEnv.sqlQuery("select * from dimension"); tableEnv.toAppendStream(queryTable, Row.class).print(); 你先用这种方式,看看能不能打印出来,证明你hbase没有问题。然后在用print_table。 -- Sent from: http://apache-flink.147419.n8.nabble.com/
Reply | Threaded
Open this post in threaded view
|

Re: Print SQL connector无法正常使用

Benchao Li-2
In reply to this post by xiao cai
Hi,

看起来你用的hbase的配置还是老的配置,1.11中已经更新的新的connector配置选项了,
你可以尝试下用新版的connector配置[1]。

[1]
https://ci.apache.org/projects/flink/flink-docs-release-1.11/dev/table/connectors/hbase.html

xiao cai <[hidden email]> 于2020年8月17日周一 上午11:52写道:

> Hi All:
> 目前使用flink sql的Print SQL connector,想要将查询的结果打印出来,结果报错:
> 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.
>
>
> 可以保证:HBase-connector是在lib包下存在的,是否我还需要在lib下添加什么依赖?
>
>
> 下面为执行的sql:
>
>
> CREATE TABLE dimension (
>     rowKey STRING,
>     cf ROW<age INT, area BIGINT>,
>     tas BIGINT
> ) WITH (
>     'connector.type' = 'hbase',
>     'connector.version' = '1.4.3',
>     'connector.table-name' = ’test',
>     'connector.write.buffer-flush.max-rows' = '10',
>     'connector.zookeeper.quorum' = ‘IP:port',
>     'connector.zookeeper.znode.parent' = '/hbase',
> );
>
>
> CREATE TABLE print_table (
>  f0 STRING,
>  f1 INT,
>  f2 BIGINT,
>  f3 BIGINT
> ) WITH (
>  'connector' = 'print'
> );
>
>
> insert into print_table
> select rowKey, cf.age, cf.area, tas
> from dimension



--

Best,
Benchao Li