Skip to content

🪢 Open source agent evals & observability: Trace, evaluate, and improve LLM applications with one open platform.

feat(shared): add parquet flag to blob export tuning (LFE-10463) (#14506)

Niklas Semmlerd4af03a86a55
diff --git a/packages/shared/src/features/analytics-integrations/blob-export-tuning.test.ts b/packages/shared/src/features/analytics-integrations/blob-export-tuning.test.ts
index 7f16b6b811..6ffa9099c5 100644
--- a/packages/shared/src/features/analytics-integrations/blob-export-tuning.test.ts
+++ b/packages/shared/src/features/analytics-integrations/blob-export-tuning.test.ts
@@ -21,6 +21,7 @@ function resolved(
): ResolvedBlobExportTuning {
return {
rawPassthrough: false,
+ parquet: false,
gzipLevel: undefined,
partSizeBytes: DEFAULTS.partSizeBytes,
maxConcurrentParts: undefined,
@@ -122,6 +123,63 @@ describe("resolveBlobExportTuning", () => {
});
});
+ describe("parquet (LFE-10463)", () => {
+ it("honors parquet=true", () => {
+ const { resolved: res, warnings } = resolveBlobExportTuning(
+ { parquet: true },
+ DEFAULTS,
+ );
+ expect(res).toEqual(resolved({ parquet: true }));
+ expect(warnings).toEqual([]);
+ });
+
+ it("honors parquet=false explicitly", () => {
+ const { resolved: res, warnings } = resolveBlobExportTuning(
+ { parquet: false },
+ DEFAULTS,
+ );
+ expect(res.parquet).toBe(false);
+ expect(warnings).toEqual([]);
+ });
+
+ it("defaults parquet to false when absent", () => {
+ expect(resolveBlobExportTuning({}, DEFAULTS).resolved.parquet).toBe(
+ false,
+ );
+ });
+
+ it("falls back to false and warns on a wrong-typed parquet", () => {
+ const { resolved: res, warnings } = resolveBlobExportTuning(
+ { parquet: "yes" },
+ DEFAULTS,
+ );
+ expect(res.parquet).toBe(false);
+ expect(warnings.some((w) => w.includes("expected a boolean"))).toBe(true);
+ });
+
+ it("takes precedence over rawPassthrough: parquet wins, rawPassthrough forced false, with a warning", () => {
+ const { resolved: res, warnings } = resolveBlobExportTuning(
+ { parquet: true, rawPassthrough: true },
+ DEFAULTS,
+ );
+ expect(res.parquet).toBe(true);
+ expect(res.rawPassthrough).toBe(false);
+ expect(warnings.some((w) => w.includes("parquet takes precedence"))).toBe(
+ true,
+ );
+ });
+
+ it("leaves rawPassthrough untouched when parquet is not set", () => {
+ const { resolved: res, warnings } = resolveBlobExportTuning(
+ { rawPassthrough: true },
+ DEFAULTS,
+ );
+ expect(res.parquet).toBe(false);
+ expect(res.rawPassthrough).toBe(true);
+ expect(warnings).toEqual([]);
+ });
+ });
+
describe("gzipLevel (LFE-10402)", () => {
it("honors a valid gzipLevel independently of rawPassthrough", () => {
expect(
@@ -336,6 +394,12 @@ describe("BlobExportTuningSchema (write schema)", () => {
).toBe(true);
});
+ it("accepts parquet", () => {
+ expect(BlobExportTuningSchema.safeParse({ parquet: true }).success).toBe(
+ true,
+ );
+ });
+
it("rejects out-of-range values (writes reject; reads clamp)", () => {
expect(
BlobExportTuningSchema.safeParse({ maxConcurrentParts: 50 }).success,
diff --git a/packages/shared/src/features/analytics-integrations/blob-export-tuning.ts b/packages/shared/src/features/analytics-integrations/blob-export-tuning.ts
index 1c3c59f17a..14d9728c39 100644
--- a/packages/shared/src/features/analytics-integrations/blob-export-tuning.ts
+++ b/packages/shared/src/features/analytics-integrations/blob-export-tuning.ts
@@ -60,6 +60,14 @@ export const BlobExportTuningSchema = z.object({
// >= RAW_PASSTHROUGH_MIN_CLICKHOUSE_VERSION (see above) for mid-stream failure
// detection. Do not enable on older self-hosted ClickHouse.
rawPassthrough: z.boolean().optional(),
+ // LFE-10463 Parquet export path: stream ClickHouse's native `FORMAT Parquet`
+ // bytes straight to upload, offloading columnar encoding + compression to
+ // ClickHouse query threads (no worker gzip). When set, produces `.parquet`
+ // files for all tables and overrides both `fileType` and `compressed`. Takes
+ // precedence over `rawPassthrough` (resolved below). Like rawPassthrough it
+ // relies on mid-stream exception tagging, so the same ClickHouse
+ // >= RAW_PASSTHROUGH_MIN_CLICKHOUSE_VERSION caveat applies on self-hosted.
+ parquet: z.boolean().optional(),
// LFE-10402 gzip tuning: zlib deflate level for compressed exports. Lower
// levels trade output size for markedly less worker CPU. Only honored when the
// integration has compression enabled. zlib accepts 0 (store) through 9 (max);
@@ -99,6 +107,9 @@ export interface BlobExportTuningDefaults {
export type ResolvedBlobExportTuning = {
rawPassthrough: boolean;
+ // LFE-10463. When true the export uses ClickHouse-native `FORMAT Parquet`;
+ // forces `rawPassthrough` to false (parquet wins) — see resolver below.
+ parquet: boolean;
// undefined => use the zlib default (6); a concrete 0-9 otherwise.
gzipLevel: number | undefined;
partSizeBytes: number;
@@ -240,6 +251,7 @@ export function resolveBlobExportTuning(
const fallback: ResolvedBlobExportTuning = {
rawPassthrough: false,
+ parquet: false,
gzipLevel: undefined,
partSizeBytes: defaults.partSizeBytes,
maxConcurrentParts: undefined,
@@ -260,13 +272,29 @@ export function resolveBlobExportTuning(
const obj = raw as Record<string, unknown>;
+ const parquet = resolveBoolean("parquet", obj.parquet, warnings);
+ let rawPassthrough = resolveBoolean(
+ "rawPassthrough",
+ obj.rawPassthrough,
+ warnings,
+ );
+
+ // LFE-10463: Parquet is a distinct execution path (ClickHouse-native
+ // `FORMAT Parquet`) that supersedes the JSONEachRow raw-passthrough path.
+ // Enabling both is a misconfiguration; honor parquet and disable
+ // rawPassthrough with a warning rather than letting the handler pick one
+ // silently.
+ if (parquet && rawPassthrough) {
+ rawPassthrough = false;
+ warnings.push(
+ "parquet and rawPassthrough are both enabled; parquet takes precedence, ignoring rawPassthrough",
+ );
+ }
+
return {
resolved: {
- rawPassthrough: resolveBoolean(
- "rawPassthrough",
- obj.rawPassthrough,
- warnings,
- ),
+ rawPassthrough,
+ parquet,
gzipLevel: resolveGzipLevel(obj.gzipLevel, warnings),
partSizeBytes: resolveNumber(
"partSizeBytes",