OpenMetadata icon indicating copy to clipboard operation
OpenMetadata copied to clipboard

Redshift connector: External table column types "string"/"double" ingested as UNKNOWN, breaking column-level test type selection

Open joyfulwang opened this issue 5 months ago • 1 comments

Connector

Redshift

Feature area

Metadata ingestion

Describe the bug

Redshift external (Spectrum) tables whose columns have Hive-style types like string and double are ingested with dataType: "UNKNOWN" in OpenMetadata, even though the raw type is correctly detected (stored in dataTypeDisplay). This causes the "Select test type" dropdown to show "No data" when adding column-level data quality tests, because the supportedDataType=UNKNOWN filter matches zero test definitions.

The root cause is in REDSHIFT_GET_SCHEMA_COLUMN_INFO (in ingestion/src/metadata/ingestion/source/database/redshift/queries.py). The external tables UNION normalizes some types but misses others:

CASE
  WHEN external_type = 'int' THEN 'integer'
  ELSE replace(replace(external_type, 'decimal', 'numeric'), 'varchar', 'character varying')
END AS "type"

Types like string and double are not normalized to PostgreSQL equivalents (character varying, double precision), so they aren't found in SQLAlchemy's ischema_names and fall through to create_sqlalchemy_type("UNKNOWN") in ingestion/src/metadata/ingestion/source/database/redshift/utils.py.

Observed behavior:

external_type Stored dataType Stored dataTypeDisplay Expected dataType
string UNKNOWN string VARCHAR or STRING
double UNKNOWN double DOUBLE
boolean BOOLEAN boolean BOOLEAN (works)
int INT int INT (works — normalized to integer)

A secondary issue compounds the problem: the frontend (TestCaseFormV1.tsx) passes supportedDataType: column.dataType to the test definitions API. When the value is UNKNOWN, zero test definitions match and the dropdown is empty with no user-facing explanation.

To Reproduce

  1. Set up a Redshift ingestion pipeline for a service that contains external (Spectrum) tables with Hive-style column types (string, double, etc.)
  2. Run the ingestion
  3. Navigate to an ingested external table → Schema tab → observe columns show types like "string", "double" in the UI
  4. Go to Data Quality → Add Test Case → select "Column" level → select any column
  5. "Select test type" dropdown shows "No data"

Expected behavior

  • Column types from Redshift external tables should be mapped to proper ColumnDataType enum values (e.g., string → VARCHAR/STRING, double → DOUBLE)
  • Column-level test type options should be available for all columns regardless of source table type
  • If dataType is UNKNOWN, the UI should either skip the supportedDataType filter or fall back to dataTypeDisplay for matching

Connection / ingestion config

source:
    type: Redshift
    serviceName: <redacted>
    serviceConnection:
      config:
        type: Redshift
        hostPort: <redacted>
        database: dev
        # External tables are in schemas backed by Glue Data Catalog

Logs


OS

No response

Python version

No response

OpenMetadata version

1.12.6 and 1.12.12 (confirmed on both)

OpenMetadata Ingestion package version

No response

Additional context

  • This is distinct from #29542 (which reports a case-sensitivity bug in entityType query param affecting non-admin users). This issue affects all users including admins.
  • The boolean type works correctly because "boolean" exists in PostgreSQL's ischema_names. Types like string and double are Hive/Glue Catalog types that don't have PostgreSQL equivalents registered.
  • Suggested fix locations:
    • Primary (ingestion): ingestion/src/metadata/ingestion/source/database/redshift/queries.py — extend the CASE statement to normalize Spectrum-specific types (string → character varying, double → double precision). Alternatively, add these to ischema_names in redshift/utils.py.
    • Secondary (UI resilience): openmetadata-ui/.../components/DataQuality/AddDataQualityTest/components/TestCaseFormV1.tsx — when dataType === "UNKNOWN", skip the supportedDataType filter or fall back to dataTypeDisplay.

Pre-submission checklist

  • [x] I searched for duplicate issues.
  • [x] I removed credentials, hostnames, emails, and other sensitive data from logs and config.

joyfulwang avatar Jun 29 '26 18:06 joyfulwang

Would it also be possible to get some help with tagging this previously created issue as another Redshift connector bug? https://github.com/open-metadata/OpenMetadata/issues/28127 I had missed selecting the issue type during creation and now cannot add the tags but wondering if they'd be helpful to get the issue prioritized

joyfulwang avatar Jun 29 '26 18:06 joyfulwang