This is an automated email from the ASF dual-hosted git repository.

FrankChen021 pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/druid.git


The following commit(s) were added to refs/heads/master by this push:
     new 23d0bf6dd93 fix(web-console): avoid schema discovery for Druid 
reingestion (#20553)
23d0bf6dd93 is described below

commit 23d0bf6dd93f2fe0b143726edeb0f46cdb8c52df
Author: sakshichitnis27 <[email protected]>
AuthorDate: Fri Oct 23 03:21:13 2026 +0100

    fix(web-console): avoid schema discovery for Druid reingestion (#20553)
---
 web-console/src/utils/sampler.spec.ts | 68 ++++++++++++++++++++++++++++++++++-
 web-console/src/utils/sampler.ts      | 10 +++---
 2 files changed, 73 insertions(+), 5 deletions(-)

diff --git a/web-console/src/utils/sampler.spec.ts 
b/web-console/src/utils/sampler.spec.ts
index b0aa6304f89..8f73d0a7c91 100644
--- a/web-console/src/utils/sampler.spec.ts
+++ b/web-console/src/utils/sampler.spec.ts
@@ -16,10 +16,76 @@
  * limitations under the License.
  */
 
+import { Api } from '../singletons';
+
 import type { SampleResponse } from './sampler';
-import { changeLookupInExpressionsSampling, guessDimensionsFromSampleResponse 
} from './sampler';
+import {
+  changeLookupInExpressionsSampling,
+  guessDimensionsFromSampleResponse,
+  sampleForConnect,
+} from './sampler';
+
+jest.mock('../singletons', () => ({
+  Api: {
+    instance: {
+      post: jest.fn(),
+    },
+  },
+}));
 
 describe('sampler', () => {
+  describe('sampleForConnect', () => {
+    beforeEach(() => {
+      jest.clearAllMocks();
+      (Api.instance.post as jest.Mock).mockResolvedValue({ data: { data: [] } 
});
+    });
+
+    it('does not use schema discovery for Druid input sources', async () => {
+      await sampleForConnect(
+        {
+          type: 'index_parallel',
+          spec: {
+            ioConfig: {
+              type: 'index_parallel',
+              inputSource: {
+                type: 'druid',
+                dataSource: 'source',
+                interval: '2026-01-01/2026-01-02',
+              },
+            },
+          },
+        } as any,
+        'start',
+      );
+
+      const sampleSpec = (Api.instance.post as jest.Mock).mock.calls[0][1];
+      expect(sampleSpec.spec.dataSchema.dimensionsSpec).toEqual({});
+    });
+
+    it('uses schema discovery for Delta input sources', async () => {
+      await sampleForConnect(
+        {
+          type: 'index_parallel',
+          spec: {
+            ioConfig: {
+              type: 'index_parallel',
+              inputSource: {
+                type: 'delta',
+                tablePath: 's3://bucket/table',
+              },
+            },
+          },
+        } as any,
+        'start',
+      );
+
+      const sampleSpec = (Api.instance.post as jest.Mock).mock.calls[0][1];
+      expect(sampleSpec.spec.dataSchema.dimensionsSpec).toEqual({
+        useSchemaDiscovery: true,
+      });
+    });
+  });
+
   describe('getInferredDimensionsFromSampleResponse', () => {
     const sampleResponse: SampleResponse = {
       numRowsRead: 20,
diff --git a/web-console/src/utils/sampler.ts b/web-console/src/utils/sampler.ts
index c68c5a01e74..9b1cdd86184 100644
--- a/web-console/src/utils/sampler.ts
+++ b/web-console/src/utils/sampler.ts
@@ -304,10 +304,12 @@ export async function sampleForConnect(
       dataSchema: {
         dataSource: 'sample',
         timestampSpec: reingestMode ? REINDEX_TIMESTAMP_SPEC : 
PLACEHOLDER_TIMESTAMP_SPEC,
-        dimensionsSpec: {
-          useSchemaDiscovery: true,
-          dimensions: addFileUri ? ['__file_uri'] : undefined,
-        },
+        dimensionsSpec: reingestMode
+          ? {}
+          : {
+              useSchemaDiscovery: true,
+              dimensions: addFileUri ? ['__file_uri'] : undefined,
+            },
         granularitySpec: {
           rollup: false,
         },


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to