Skip to content

Hive Lineage RFC #10

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

kartikey-visa
Copy link

@kartikey-visa kartikey-visa commented Feb 19, 2025

Summary by CodeRabbit

  • Documentation
    • Introduced a new guide on Hive Lineage, detailing how data flow within the Hive ecosystem is tracked and analyzed.
    • The guide covers key aspects such as tracking data sources, transformations, destinations, and provides insights for better data governance, compliance, and troubleshooting.
    • Includes a usage example and architectural overview for enhanced clarity and understanding.

Copy link

coderabbitai bot commented Feb 19, 2025

Walkthrough

A new document titled "Hive Lineage" has been added. It details the process of capturing and tracking data lineage within the Hive ecosystem. The document describes how lineage information is intercepted from Hive engine events, processed by a LineageLogger Hook, transmitted via Kafka, and ultimately used to generate Metadata Change Proposals for integration with the Graph Metadata Service.

Changes

File(s) Change Summary
active/000-hive-lineage/000-hive-lineage.md Added a document outlining the Hive Lineage process, detailing event interception, lineage capture, Kafka integration, MCP generation, usage examples, architectural diagrams, terminology, and rollout strategy.

Sequence Diagram(s)

sequenceDiagram
    participant Hive as Hive Engine
    participant Logger as LineageLogger Hook
    participant Kafka as Kafka Broker
    participant Consumer as Kafka Consumer
    participant GMS as Graph Metadata Service

    Hive->>Logger: Emit event / intercept query
    Logger->>Kafka: Send lineage data
    Kafka->>Consumer: Deliver message
    Consumer->>GMS: Generate and send MCP
Loading

Poem

I’m a hopping rabbit, quick and bright,
Tracking Hive lineage with all my might,
From events to Kafka, in a seamless flight,
Metadata proposals shining light,
Celebrating changes with sheer delight!
🐇✨


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>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • 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 testing code 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 gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

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 using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR. (Beta)
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • 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/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

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.

Actionable comments posted: 0

🧹 Nitpick comments (9)
active/000-hive-lineage/000-hive-lineage.md (9)

1-5: Metadata Headers – Ensure Completeness
The header section includes key metadata (Start Date, RFC PR, etc.). Please verify that the "Discussion Issue" and "Implementation PR(s)" fields are populated or that leaving them blank is intentional.


6-10: Summary Clarity and Readability
The summary provides a comprehensive overview of Hive Lineage. Consider breaking the long sentence on line 10 into shorter sentences to improve readability and better emphasize the key steps (listening to events, intercepting queries, and capturing lineage).


12-22: Consistent Terminology
There is an inconsistency in spelling: line 12 uses “organisations” while line 22 uses “organizations.” Please standardize the spelling throughout the document to avoid confusion.

🧰 Tools
🪛 LanguageTool

[style] ~16-~16: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...chieve several key benefits and support a variety of use cases. ### Use Cases Supported: 1...

(A_VARIETY_OF)


[uncategorized] ~22-~22: Do not mix variants of the same word (‘organization’ and ‘organisation’) within a single text.
Context: ...e:** With detailed lineage information, organizations can comply with regulatory requirements...

(EN_WORD_COHERENCY)

🪛 markdownlint-cli2 (0.17.2)

18-18: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


18-18: Markdown Heading Punctuation
Several headings include trailing colons, which does not comply with our Markdown style guidelines. Please remove the trailing punctuation from the following headings:

  • “### Use Cases Supported:” (line 18)
  • “### Expected Outcome:” (line 30)
  • “### Implementation Details:” (line 45)
  • “### Usage Example:” (line 60)
  • “### Architecture:” (line 432)
  • “### Terminology:” (line 440)

Also applies to: 30-30, 45-45, 60-60, 432-432, 440-440

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

18-18: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


47-49: Comma for Clarity in Implementation Details
On line 48, the sentence “This ensures that the hook is invoked to capture lineage information after the query execution is completed ensuring the correct lineage is captured and doesn't get affected if the query execution fails.” would benefit from a comma to clearly separate the clauses. For example:

-... after the query execution is completed ensuring the correct lineage is captured...
+... after the query execution is completed, ensuring the correct lineage is captured...
🧰 Tools
🪛 LanguageTool

[uncategorized] ~48-~48: Possible missing comma found.
Context: ...nformation after the query execution is completed ensuring the correct lineage is capture...

(AI_HYDRA_LEO_MISSING_COMMA)


432-435: Architecture Section – Heading Punctuation and Image Verification
Remove the trailing colon from the “### Architecture:” heading. Also, please verify that the referenced image file (hive-lineage-architecture.png) is available and correctly linked.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

432-432: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


436-442: Terminology Heading – Remove Trailing Colon
Please remove the trailing colon from the “### Terminology:” heading to adhere to Markdown style guidelines.

🧰 Tools
🪛 markdownlint-cli2 (0.17.2)

440-440: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


450-454: Drawbacks Section – Rephrase for Clarity
The drawbacks section currently reads:

"No effect on existing functionality/customers. Apart from the need for a separate topic and consumer, it does not need any more changes to existing systems. The current design will be leveraging existing lineage API and MCP structure to process lineage information."

Consider rephrasing for clarity. For example:

-No effect on existing functionality/customers. Apart from the need for a separate topic and consumer, it does not need any more changes to existing systems.
+There is no impact on existing functionality or customers. The only new requirement is the introduction of a separate Kafka topic and consumer—no further modifications to existing systems are needed.
🧰 Tools
🪛 LanguageTool

[style] ~452-~452: Consider an alternative to strengthen your wording.
Context: ...opic and consumer, it does not need any more changes to existing systems. The current design...

(CHANGES_ADJUSTMENTS)


454-457: Rollout / Adoption Strategy – Minor Refinements
The rollout strategy is clearly described. You might consider a slight rephrasing for enhanced clarity and consistency; however, the current version is acceptable if it meets your communication goals.

📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8852b24 and aaec002.

⛔ Files ignored due to path filters (1)
  • active/000-hive-lineage/hive-lineage-architecture.png is excluded by !**/*.png
📒 Files selected for processing (1)
  • active/000-hive-lineage/000-hive-lineage.md (1 hunks)
🧰 Additional context used
🪛 LanguageTool
active/000-hive-lineage/000-hive-lineage.md

[style] ~16-~16: The phrase “a variety of” may be wordy. To make your writing clearer, consider replacing it.
Context: ...chieve several key benefits and support a variety of use cases. ### Use Cases Supported: 1...

(A_VARIETY_OF)


[uncategorized] ~22-~22: Do not mix variants of the same word (‘organization’ and ‘organisation’) within a single text.
Context: ...e:** With detailed lineage information, organizations can comply with regulatory requirements...

(EN_WORD_COHERENCY)


[uncategorized] ~48-~48: Possible missing comma found.
Context: ...nformation after the query execution is completed ensuring the correct lineage is capture...

(AI_HYDRA_LEO_MISSING_COMMA)


[style] ~452-~452: Consider an alternative to strengthen your wording.
Context: ...opic and consumer, it does not need any more changes to existing systems. The current design...

(CHANGES_ADJUSTMENTS)

🪛 markdownlint-cli2 (0.17.2)
active/000-hive-lineage/000-hive-lineage.md

18-18: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


30-30: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


45-45: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


60-60: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


432-432: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)


440-440: Trailing punctuation in heading
Punctuation: ':'

(MD026, no-trailing-punctuation)

🔇 Additional comments (3)
active/000-hive-lineage/000-hive-lineage.md (3)

66-426: JSON Example – Well Structured
The JSON example is comprehensive and well-structured. It clearly illustrates the expected data format for lineage information.


428-431: Processing Lineage Information – Clear Explanation
The description of how the Kafka consumer processes JSON messages to generate Metadata Change Proposals (MCPs) is clear and informative.


458-460: Future Work Section – Clear and Forward Looking
The Future Work section succinctly outlines potential enhancements leveraging the captured Hive Lineage. No changes required.


## Detailed Design

The design for Hive Lineage involves leveraging Hive's LineageLogger Hook to capture lineage information, processing this information, and sending it to a Kafka topic. A Kafka consumer then processes these messages and sends metadata change proposals (MCPs) to the GMS (Graph Metadata Service). This design ensures efficient tracking and documentation of data flow within the Hive ecosystem.

Choose a reason for hiding this comment

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

It will support rest emitter as well, right?

Choose a reason for hiding this comment

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

This architecture makes sense to ensure a robust system and the additional latency should be minimal to the Hive execution with the listener.
On the other hand, I wouldn't drop the option to generate mcp and send it to DataHub using rest emitter right away to ensure Kafka is an optional dependency.
Does LineageLogger block the query execution?

Copy link
Author

Choose a reason for hiding this comment

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

As of now we are thinking to separate the rest emitter from the hook jar, the rest emitter will be a part of the consumer which actually consumes the lineage messages from the kafka.

One of the reasons for bringing in kafka is to address scalability and consistency. Considering hive loads that run in an order of 100k+ queries per day, we feel having a message queue (kafka) will help to address all sorts of typical producer-consumer issues.

Regarding the LineageLogger Hook, it is designed as a post-execution hook. This means it does not block the query execution. The hook is invoked after the query execution is completed and before the result is published to the user. To mitigate any latency in the user receiving the results due to lineage computation, we plan to spawn a worker thread dedicated to computing the lineage separately from the main thread executing the Hive query. This ensures that the user experience remains unaffected and the lineage is processed efficiently in the background.

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.

2 participants