Skip to content
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

add: edge id in SQL #80

Merged
merged 6 commits into from
Jan 18, 2024
Merged

add: edge id in SQL #80

merged 6 commits into from
Jan 18, 2024

Conversation

kazumatsudo
Copy link
Owner

@kazumatsudo kazumatsudo commented Jan 18, 2024

Summary by CodeRabbit

  • New Features

    • Enhanced edge and vertex ID naming conventions for improved clarity.
    • Integrated new ID handling logic within the graph domain model.
  • Bug Fixes

    • Corrected the order and naming of properties in graph edge specifications.
  • Refactor

    • Updated column handling to accommodate a new identifier type for relationships.
  • Tests

    • Adjusted test cases to align with the updated domain model and database schema changes.

@kazumatsudo kazumatsudo self-assigned this Jan 18, 2024
Copy link

coderabbitai bot commented Jan 18, 2024

Walkthrough

The updates involve a significant reconfiguration of the edge table schema, introducing a unique identifier for edges, refining how edge and vertex IDs are managed, and adjusting related code and tests to align with the new schema. These changes streamline the database's structure and improve query handling, while also ensuring backward compatibility.

Changes

File Path Change Summary
src/main/resources/application.conf Renamed edge and vertex column names; added new ID column configuration.
src/main/scala/domain/graph/GraphEdge.scala Added private ID field; updated toDdl and toDml methods to include the ID column.
src/main/scala/domain/table/ddl/column/ColumnType.scala Imported RelationIdentifier; updated ColumnType to handle RelationIdentifier as a string.
src/test/scala/domain/graph/GraphEdgeSpec.scala
src/test/scala/usecase/ByExhaustiveSearchSpec.scala
src/test/scala/usecase/UsingSpecificKeyListSpec.scala
Renamed columns; adjusted column order and types; updated record values.

Related issues

  • Issue add id in edge table #74 "add id in edge table" from kazumatsudo/GraphDB2RDB could be linked to this PR because the introduction of a unique identifier for the edge table directly addresses the issue's objectives of enhancing the edge table with an ID column and updating the schema and queries.

Poem

Amidst the fields of data rows,
A rabbit hopped, tweaking codes with prose.
New IDs in place, the edges shine,
A graph reborn, by paws design. 🐾🌟

Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

Share

Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>.
    • Generate unit-tests for this file.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit tests for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai generate interesting stats about this repository from git and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit tests.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (invoked as PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger a review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • The JSON schema for the configuration file is available here.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/coderabbit-overrides.v2.json

CodeRabbit Discord Community

Join our Discord Community to get help, request features, and share feedback.

@codecov-commenter
Copy link

codecov-commenter commented Jan 18, 2024

Codecov Report

Attention: 1 lines in your changes are missing coverage. Please review.

Comparison is base (ca0d5ec) 76.14% compared to head (5efa9e1) 76.27%.

Files Patch % Lines
...ain/scala/domain/table/ddl/column/ColumnType.scala 0.00% 1 Missing ⚠️

❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #80      +/-   ##
==========================================
+ Coverage   76.14%   76.27%   +0.12%     
==========================================
  Files          19       19              
  Lines         327      333       +6     
  Branches       36       36              
==========================================
+ Hits          249      254       +5     
- Misses         78       79       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@kazumatsudo kazumatsudo mentioned this pull request Jan 18, 2024
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 1

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between ca0d5ec and 6b97cc9.
Files selected for processing (6)
  • src/main/resources/application.conf (1 hunks)
  • src/main/scala/domain/graph/GraphEdge.scala (3 hunks)
  • src/main/scala/domain/table/ddl/column/ColumnType.scala (3 hunks)
  • src/test/scala/domain/graph/GraphEdgeSpec.scala (3 hunks)
  • src/test/scala/usecase/ByExhaustiveSearchSpec.scala (2 hunks)
  • src/test/scala/usecase/UsingSpecificKeyListSpec.scala (4 hunks)
Additional comments: 11
src/main/resources/application.conf (1)
  • 30-30: The addition of column_name_edge_id is noted and aligns with the summary's mention of a new column for edge IDs.
src/test/scala/domain/graph/GraphEdgeSpec.scala (2)
  • 30-32: Renaming of columns in the edge table from in_v_id and out_v_id to id_in_v and id_out_v is consistent with the summary.
  • 57-58: The reordering of properties in the RecordValue to place property_weight before label_knows is consistent with the summary.
src/main/scala/domain/graph/GraphEdge.scala (3)
  • 22-22: The addition of a private id field in the GraphEdge class is consistent with the summary's mention of a new field to handle edge IDs.
  • 31-34: The toDdl method has been updated to include the id column in the generated table information, aligning with the summary.
  • 83-84: The toDml method now directly uses the id field, which is an improvement over the previous version that called value.id() multiple times.
src/test/scala/usecase/UsingSpecificKeyListSpec.scala (1)
  • 39-43: The renaming of columns in the vertex table and the update of record values are consistent with the summary.
src/test/scala/usecase/ByExhaustiveSearchSpec.scala (2)
  • 101-108: The updates to column names and types within the edge table are consistent with the summary.
  • 118-167: The record values have been updated to reflect the changes in column names and types, aligning with the summary.
src/main/scala/domain/table/ddl/column/ColumnType.scala (2)
  • 3-4: The import statement for org.janusgraph.graphdb.relations.RelationIdentifier is necessary for the new handling of RelationIdentifier types.
  • 88-89: The ColumnType object has been modified to handle RelationIdentifier by converting it to a string, which is a sensible approach for database operations.

Comment on lines 30 to 34
column_name_edge_id="id"
column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
column_name_edge_out_v_id="out_v_id"
column_name_edge_in_v_id="id_in_v"
column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
column_name_edge_out_v_id="id_out_v"
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The environment variable for column_name_edge_in_v_id is being set twice (lines 32 and 33), which is likely an error. The second assignment should probably be for a different variable.

- column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
+ column_name_edge_out_v_id=${?COLUMN_NAME_EDGE_OUT_V_ID}

Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation.

Suggested change
column_name_edge_id="id"
column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
column_name_edge_out_v_id="out_v_id"
column_name_edge_in_v_id="id_in_v"
column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
column_name_edge_out_v_id="id_out_v"
column_name_edge_id="id"
column_name_edge_in_v_id=${?COLUMN_NAME_EDGE_IN_V_ID}
column_name_edge_in_v_id="id_in_v"
column_name_edge_out_v_id=${?COLUMN_NAME_EDGE_OUT_V_ID}
column_name_edge_out_v_id="id_out_v"

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 6b97cc9 and 8494fd2.
Files selected for processing (1)
  • src/test/scala/usecase/ByExhaustiveSearchSpec.scala (2 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/test/scala/usecase/ByExhaustiveSearchSpec.scala

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review Status

Actionable comments generated: 0

Configuration used: CodeRabbit UI

Commits Files that changed from the base of the PR and between 8494fd2 and 5efa9e1.
Files selected for processing (1)
  • src/main/resources/application.conf (1 hunks)
Files skipped from review as they are similar to previous changes (1)
  • src/main/resources/application.conf

@kazumatsudo kazumatsudo merged commit d567894 into main Jan 18, 2024
1 check passed
@kazumatsudo kazumatsudo deleted the feature/edge_id branch January 18, 2024 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants