vesoft-inc / nebula-flink-connector

Flink Connector for Nebula Graph
48 stars 30 forks source link

feat: flink sql add create space #66

Closed liuxiaocs7 closed 2 years ago

liuxiaocs7 commented 2 years ago

Try to close #62.

codecov-commenter commented 2 years ago

Codecov Report

Merging #66 (8e4435f) into master (93df7a1) will increase coverage by 11.82%. The diff coverage is 63.20%.

@@              Coverage Diff              @@
##             master      #66       +/-   ##
=============================================
+ Coverage     49.72%   61.54%   +11.82%     
- Complexity      190      291      +101     
=============================================
  Files            50       52        +2     
  Lines          1613     1784      +171     
  Branches        153      166       +13     
=============================================
+ Hits            802     1098      +296     
+ Misses          743      596      -147     
- Partials         68       90       +22     
Impacted Files Coverage Δ
...onnector/nebula/catalog/AbstractNebulaCatalog.java 26.56% <33.33%> (+26.56%) :arrow_up:
...ache.flink/connector/nebula/utils/NebulaSpace.java 47.05% <47.05%> (ø)
....flink/connector/nebula/catalog/NebulaCatalog.java 29.29% <57.81%> (+29.29%) :arrow_up:
...che.flink/connector/nebula/utils/NebulaSpaces.java 91.30% <91.30%> (ø)
...ink/connector/nebula/utils/NebulaCatalogUtils.java 50.00% <100.00%> (+50.00%) :arrow_up:
...e.flink/connector/nebula/utils/NebulaConstant.java 95.00% <100.00%> (+0.55%) :arrow_up:
...ache.flink/connector/nebula/utils/NebulaUtils.java 74.60% <100.00%> (+2.67%) :arrow_up:
...ebula/connection/NebulaMetaConnectionProvider.java 55.55% <0.00%> (ø)
...connector/nebula/table/NebulaRowDataConverter.java 59.52% <0.00%> (ø)
...nnector/nebula/connection/NebulaClientOptions.java 91.25% <0.00%> (+1.25%) :arrow_up:
... and 12 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

liuxiaocs7 commented 2 years ago

Refer to Flink SQL doc and Nebula doc.

CREATE DATABASE [IF NOT EXISTS] [catalog_name.]db_name
  [COMMENT database_comment]
  WITH (key1=val1, key2=val2, ...)
CREATE SPACE [IF NOT EXISTS] <graph_space_name> (
    [partition_num = <partition_number>,]
    [replica_factor = <replica_number>,]
    vid_type = {FIXED_STRING(<N>) | INT[64]}
    )
    [COMMENT = '<comment>'];

I register the NebulaCatalog to flink table environment and use the catalog. Then execute create database statement will go to createDatabase method. In this method, we use graph client to execute create space ngql statement.

Test Environment:

Windows Virtual Machine(Centos7), Nebula is deployed by Docker.

And result is just as follow:

Snipaste_2022-07-14_00-21-38