From fcc39ea2e42fc08c3a53e421ba213e3f736fb0d0 Mon Sep 17 00:00:00 2001 From: Akash Kulkarni <113392464+akashkulk@users.noreply.github.com> Date: Fri, 2 Jun 2023 12:52:05 -0700 Subject: [PATCH] Fix bug with getStateEmissionFrequency() settings (#26974) An order by query should NOT be issued when the connector does not emit intermediate state --- .../integrations/source/jdbc/AbstractJdbcSource.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/airbyte-integrations/connectors/source-jdbc/src/main/java/io/airbyte/integrations/source/jdbc/AbstractJdbcSource.java b/airbyte-integrations/connectors/source-jdbc/src/main/java/io/airbyte/integrations/source/jdbc/AbstractJdbcSource.java index 18f5f47a4db..7db25337528 100644 --- a/airbyte-integrations/connectors/source-jdbc/src/main/java/io/airbyte/integrations/source/jdbc/AbstractJdbcSource.java +++ b/airbyte-integrations/connectors/source-jdbc/src/main/java/io/airbyte/integrations/source/jdbc/AbstractJdbcSource.java @@ -110,9 +110,9 @@ public abstract class AbstractJdbcSource extends AbstractDbSource cursorField) { LOGGER.info("Queueing query for table: {}", tableName); - // This corresponds to the initial sync for in INCREMENTAL_MODE. The ordering of the records matters - // as intermediate state messages are emitted. - if (syncMode.equals(SyncMode.INCREMENTAL)) { + // This corresponds to the initial sync for in INCREMENTAL_MODE, where the ordering of the records matters + // as intermediate state messages are emitted (if the connector emits intermediate state). + if (syncMode.equals(SyncMode.INCREMENTAL) && getStateEmissionFrequency() > 0) { final String quotedCursorField = enquoteIdentifier(cursorField.get(), getQuoteString()); return queryTable(database, String.format("SELECT %s FROM %s ORDER BY %s ASC", enquoteIdentifierList(columnNames, getQuoteString()),