Skip to content

MERGE job: UnsupportedFeatureException[Cannot ORDER BY '(SELECT NULL FROM (empty_row))': invalid data type 'undefined'.] #7

Description

@amotl

Problem

Originating at dlt's SqlJobClientBase. _create_merge_followup_jobs and descendants, the usual merge job emits an SQL statement which fails on CrateDB.

UnsupportedFeatureException[Cannot ORDER BY '(SELECT NULL FROM (empty_row))': invalid data type 'undefined'.]

Details

We probed the PostgreSQL dialect. The Redshift dialect isn't different, and emits the same error message.

PostgreSQL dialect

SELECT "date",
       "currency_code",
       "rate",
       "base_currency",
       "__dlt_load_id",
       "__dlt_id"
FROM
  (SELECT ROW_NUMBER() OVER (PARTITION BY "date", "currency_code", "base_currency"
                             ORDER BY
                               (SELECT NULL)) AS _dlt_dedup_rn,
          "date",
          "currency_code",
          "rate",
          "base_currency",
          "__dlt_load_id",
          "__dlt_id"
   FROM "testdrive_staging"."exchange_latest") AS _dlt_dedup_numbered
WHERE _dlt_dedup_rn = 1
  AND (1 = 1) ;

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions