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

DAT-19308 - feat(databricks): ensure essential table properties Delta.* #233

Merged
merged 25 commits into from
Jan 28, 2025

Conversation

CharlesQueiroz
Copy link
Contributor

Overview

This PR addresses the handling of essential Delta table properties in the Databricks extension, specifically ensuring critical properties are always included in table creation statements regardless of user input.

Problem

Previously, when users specified custom TBLPROPERTIES during table creation, the system would not guarantee the presence of essential Delta properties.

Solution

The implementation introduces a property management system that:

  1. Defines a set of essential Delta properties that must always be present
  2. Provides default values for these properties
  3. Implements property merging logic that:
    • Preserves user-specified values for essential properties when provided
    • Automatically adds missing essential properties with default values
    • Maintains any additional custom properties specified by users

Key Changes

  • Created constants for essential properties and their default values
  • Implemented property processing logic in processTableProperties method
  • Added test coverage for various property combinations
  • Ensured backward compatibility with existing table creation workflows

Testing

The changes are covered by unit tests that verify:

  • Default property inclusion
  • Custom property preservation
  • Mixed property scenarios
  • Various value types (strings, numbers, booleans)
  • Edge cases with empty or null properties

Copy link
Contributor

@SvampX SvampX left a comment

Choose a reason for hiding this comment

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

Looks good to me.
Had a concern about wrapping of properties key/value in quotes, but acccording to tests logic uses existing user specified approach and default values are wrapped.

Copy link
Contributor

@SvampX SvampX left a comment

Choose a reason for hiding this comment

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

@CharlesQueiroz we need to update expected SQL-s, see failed harness tests.

@@ -66,7 +66,7 @@
<liquibase-test-harness.version>1.0.10</liquibase-test-harness.version>
<junit.version>5.11.4</junit.version>
<junit-platform.version>1.11.4</junit-platform.version>
<mockito.version>5.15.2</mockito.version>
<mockito.version>4.11.0</mockito.version>
Copy link
Contributor

Choose a reason for hiding this comment

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

extension should work on java 8, never mockito requires java 11

@filipelautert filipelautert self-requested a review January 24, 2025 13:42

public class CreateTableGeneratorDatabricks extends CreateTableGenerator {

private static final String[] PROPERTY_ORDER = {
Copy link
Contributor

Choose a reason for hiding this comment

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

If there is still some spare time to fix we could get rid of this array and replace it by the keys from DEFAULT_VALUES .

@KushnirykOleh KushnirykOleh merged commit ffd9912 into main Jan 28, 2025
18 checks passed
@KushnirykOleh KushnirykOleh deleted the DAT-19308 branch January 28, 2025 10:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants