Skip to content

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

@amotl

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) ;

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