Skip to content

Commit

Permalink
add Kafka topic column controls (#14865)
Browse files Browse the repository at this point in the history
  • Loading branch information
vogievetsky authored Aug 21, 2023
1 parent a38b4f0 commit 631dc3b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
11 changes: 10 additions & 1 deletion web-console/src/druid-models/input-format/input-format.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export interface InputFormat {

// type: kafka
readonly timestampColumnName?: string;
readonly topicColumnName?: string;
readonly headerFormat?: { type: 'string'; encoding?: string };
readonly headerColumnPrefix?: string;
readonly keyFormat?: InputFormat;
Expand Down Expand Up @@ -253,7 +254,15 @@ export const KAFKA_METADATA_INPUT_FORMAT_FIELDS: Field<InputFormat>[] = [
type: 'string',
defaultValue: 'kafka.timestamp',
defined: typeIsKnown(KNOWN_TYPES, 'kafka'),
info: `Name of the column for the kafka record's timestamp.`,
info: `Name of the column for the Kafka record's timestamp.`,
},
{
name: 'topicColumnName',
label: 'Kafka topic column name',
type: 'string',
defaultValue: 'kafka.topic',
defined: typeIsKnown(KNOWN_TYPES, 'kafka'),
info: `Name of the column for the topic from which the Kafka record came.`,
},

// -----------------------------------------------------
Expand Down
1 change: 1 addition & 0 deletions web-console/src/views/load-data-view/load-data-view.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ function showKafkaLine(line: SampleEntry): string {
if (!input) return 'Invalid kafka row';
return compact([
`[ Kafka timestamp: ${input['kafka.timestamp']}`,
` Topic: ${input['kafka.topic']}`,
...filterMap(Object.entries(input), ([k, v]) => {
if (!k.startsWith('kafka.header.')) return;
return ` Header: ${k.slice(13)}=${v}`;
Expand Down

0 comments on commit 631dc3b

Please sign in to comment.