-
Notifications
You must be signed in to change notification settings - Fork 30
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support all insert/update/delete operations for dynamic table sink #81
Changes from 5 commits
2c7b4fa
8cb77c3
cf9db14
faeb8eb
e3541c2
351af36
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -55,6 +55,13 @@ | |
<version>${flink.version}</version> | ||
<scope>provided</scope> | ||
</dependency> | ||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-table-planner_${scala.binary.version}</artifactId> | ||
<version>${flink.version}</version> | ||
<type>test-jar</type> | ||
<scope>test</scope> | ||
</dependency> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Repeated dependency? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I added this There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I see it, got a new approach for testing. |
||
<dependency> | ||
<groupId>org.apache.flink</groupId> | ||
<artifactId>flink-table-common</artifactId> | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,7 +81,7 @@ public VidTypeEnum getVidType(MetaClient metaClient, String space) { | |
spaceItem = metaClient.getSpace(space); | ||
} catch (TException | ExecuteFailedException e) { | ||
LOG.error("get space info error, ", e); | ||
return null; | ||
throw new RuntimeException(e); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. good change, thanks~ |
||
} | ||
PropertyType vidType = spaceItem.getProperties().getVid_type().getType(); | ||
if (vidType == PropertyType.FIXED_STRING) { | ||
|
@@ -105,7 +105,7 @@ public Map<String, Integer> getTagSchema(MetaClient metaClient, String space, St | |
tagSchema = metaClient.getTag(space, tag); | ||
} catch (TException | ExecuteFailedException e) { | ||
LOG.error("get tag schema error, ", e); | ||
return schema; | ||
throw new RuntimeException(e); | ||
} | ||
List<ColumnDef> columnDefs = tagSchema.getColumns(); | ||
for (ColumnDef col : columnDefs) { | ||
|
@@ -128,7 +128,7 @@ public Map<String, Integer> getEdgeSchema(MetaClient metaClient, String space, S | |
edgeSchema = metaClient.getEdge(space, edge); | ||
} catch (TException | ExecuteFailedException e) { | ||
LOG.error("get edge schema error, ", e); | ||
return schema; | ||
throw new RuntimeException(e); | ||
} | ||
List<ColumnDef> columnDefs = edgeSchema.getColumns(); | ||
for (ColumnDef col : columnDefs) { | ||
|
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
package org.apache.flink.connector.nebula.sink; | ||
|
||
import java.util.Map; | ||
import org.apache.flink.connector.nebula.connection.NebulaGraphConnectionProvider; | ||
import org.apache.flink.connector.nebula.connection.NebulaMetaConnectionProvider; | ||
import org.apache.flink.connector.nebula.statement.EdgeExecutionOptions; | ||
import org.apache.flink.connector.nebula.utils.VidTypeEnum; | ||
import org.apache.flink.types.Row; | ||
|
||
public class NebulaEdgeBatchOutputFormat | ||
extends NebulaBatchOutputFormat<Row, EdgeExecutionOptions> { | ||
public NebulaEdgeBatchOutputFormat(NebulaGraphConnectionProvider graphProvider, | ||
NebulaMetaConnectionProvider metaProvider, | ||
EdgeExecutionOptions executionOptions) { | ||
super(graphProvider, metaProvider, executionOptions); | ||
} | ||
|
||
@Override | ||
protected NebulaBatchExecutor<Row> createNebulaBatchExecutor() { | ||
VidTypeEnum vidType = metaProvider.getVidType(metaClient, executionOptions.getGraphSpace()); | ||
Map<String, Integer> schema = metaProvider.getEdgeSchema( | ||
metaClient, | ||
executionOptions.getGraphSpace(), | ||
executionOptions.getLabel()); | ||
return new NebulaEdgeBatchExecutor(executionOptions, vidType, schema); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We suggest not change the user interfaces in current version, may update them in next major version.
vesoft-inc/nebula-java#486 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the suggestion! Yeah I think it's a good idea to ensure compatibility of user-facing interfaces within the same major version.
I've added back the methods such as
.setBatch()
and.builder()
and marked them as@Deprecated
, while inREADME.md
I use the new methods. Hopefully this can encourage users to move to the new methods, without breaking existing code. Does this approach look fine to you? @Nicole00There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great approach, thanks for changing it.