Skip to content

Commit dc13307

Browse files
fix(schema): add types for ColumnTable and ColumnStore
1 parent dd0e266 commit dc13307

File tree

1 file changed

+163
-9
lines changed

1 file changed

+163
-9
lines changed

src/types/api/schema.ts

Lines changed: 163 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,8 @@ interface TPathDescription {
5252
TabletMetrics?: unknown;
5353
TablePartitions?: unknown[];
5454

55-
ColumnStoreDescription?: unknown;
56-
ColumnTableDescription?: unknown;
55+
ColumnStoreDescription?: TColumnStoreDescription;
56+
ColumnTableDescription?: TColumnTableDescription;
5757

5858
TableIndex?: TIndexDescription;
5959

@@ -85,12 +85,12 @@ export interface TDirEntry {
8585
Version?: TPathVersion;
8686
}
8787

88-
// incomplete
88+
// FIXME: incomplete
8989
export interface TTableDescription {
9090
PartitionConfig?: TPartitionConfig;
9191
}
9292

93-
// incomplete
93+
// FIXME: incomplete
9494
export interface TPartitionConfig {
9595
/** uint64 */
9696
FollowerCount?: string;
@@ -263,7 +263,6 @@ export enum EPathType {
263263
EPathTypeColumnStore = 'EPathTypeColumnStore',
264264
EPathTypeColumnTable = 'EPathTypeColumnTable',
265265
EPathTypeCdcStream = 'EPathTypeCdcStream',
266-
267266
}
268267

269268
export enum EPathSubType {
@@ -414,7 +413,7 @@ interface TPQPartitionConfig {
414413
ExplicitChannelProfiles?: TChannelProfile[];
415414

416415
MirrorFrom?: TMirrorPartitionConfig;
417-
};
416+
}
418417

419418
interface TPQTabletConfig {
420419
/** uint64 */
@@ -437,7 +436,7 @@ interface TPQTabletConfig {
437436
ReadFromTimestampsMs?: number[];
438437
/** uint64[] */
439438
ConsumerFormatVersions?: number[];
440-
439+
441440
ConsumerCodecs?: TCodecs[];
442441
ReadRuleServiceTypes?: string;
443442

@@ -461,7 +460,7 @@ interface TPQTabletConfig {
461460
PartitionKeySchema?: TKeyComponentSchema[];
462461

463462
Partitions?: TPartition[];
464-
463+
465464
MeteringMode?: EMeteringMode;
466465
}
467466

@@ -481,7 +480,7 @@ export interface TPersQueueGroupDescription {
481480
/** uint64 */
482481
PathId?: string;
483482
TotalGroupCount: number;
484-
483+
485484
PartitionsToAdd?: TPartitionToAdd[];
486485
PartitionsToDelete?: number[];
487486
NextPartitionId?: number;
@@ -497,3 +496,158 @@ export interface TPersQueueGroupDescription {
497496

498497
BootstrapConfig?: TBootstrapConfig;
499498
}
499+
500+
export interface TColumnTableDescription {
501+
Name?: string;
502+
503+
Schema?: TColumnTableSchema;
504+
TtlSettings?: TColumnDataLifeCycle;
505+
506+
SchemaPresetId?: number;
507+
SchemaPresetName?: string;
508+
509+
ColumnStorePathId?: TPathID;
510+
511+
ColumnShardCount?: number;
512+
Sharding?: TColumnTableSharding;
513+
514+
/** uint64 */
515+
SchemaPresetVersionAdj?: string;
516+
/** uint64 */
517+
TtlSettingsPresetVersionAdj?: string;
518+
519+
StorageConfig?: TColumnStorageConfig;
520+
}
521+
522+
interface TColumnTableSchema {
523+
Columns: TOlapColumnDescription[];
524+
KeyColumnNames: string[];
525+
Engine?: EColumnTableEngine;
526+
NextColumnId?: number;
527+
528+
/** uint64 */
529+
Version?: string;
530+
531+
DefaultCompression?: TCompressionOptions;
532+
EnableTiering?: boolean;
533+
}
534+
535+
interface TOlapColumnDescription {
536+
Id?: number;
537+
Name?: string;
538+
Type?: string;
539+
TypeId?: number;
540+
TypeInfo?: TTypeInfo;
541+
}
542+
543+
interface TTypeInfo {
544+
PgTypeId?: number;
545+
}
546+
547+
enum EColumnTableEngine {
548+
COLUMN_ENGINE_NONE = 'COLUMN_ENGINE_NONE',
549+
COLUMN_ENGINE_REPLACING_TIMESERIES = 'COLUMN_ENGINE_REPLACING_TIMESERIES',
550+
}
551+
552+
interface TCompressionOptions {
553+
CompressionCodec?: EColumnCodec;
554+
CompressionLevel?: number;
555+
}
556+
557+
enum EColumnCodec {
558+
ColumnCodecPlain = 'ColumnCodecPlain',
559+
ColumnCodecLZ4 = 'ColumnCodecLZ4',
560+
ColumnCodecZSTD = 'ColumnCodecZSTD',
561+
}
562+
563+
interface TColumnDataLifeCycle {
564+
Enabled?: TTtl;
565+
Disabled?: {};
566+
Tiering?: TStorageTiering;
567+
568+
/** uint64 */
569+
Version?: string;
570+
}
571+
572+
interface TTtl {
573+
ColumnName?: string;
574+
575+
ExpireAfterSeconds?: number;
576+
577+
/** uint64 */
578+
ExpireAfterBytes?: string;
579+
580+
ColumnUnit?: EUnit;
581+
}
582+
583+
interface TStorageTier {
584+
Name?: string;
585+
Eviction?: TTtl;
586+
}
587+
interface TStorageTiering {
588+
Tiers: TStorageTier[];
589+
}
590+
591+
enum EUnit {
592+
UNIT_AUTO = 'UNIT_AUTO',
593+
UNIT_SECONDS = 'UNIT_SECONDS',
594+
UNIT_MILLISECONDS = 'UNIT_MILLISECONDS',
595+
UNIT_MICROSECONDS = 'UNIT_MICROSECONDS',
596+
UNIT_NANOSECONDS = 'UNIT_NANOSECONDS',
597+
}
598+
599+
interface TColumnTableSharding {
600+
/** uint64 */
601+
Version?: string;
602+
603+
/** uint64 */
604+
ColumnShards: string[];
605+
606+
/** uint64 */
607+
AdditionalColumnShards: string[];
608+
609+
UniquePrimaryKey?: boolean;
610+
611+
RandomSharding?: {};
612+
HashSharding?: THashSharding;
613+
}
614+
615+
interface THashSharding {
616+
Function?: EHashFunction;
617+
Columns: string[];
618+
UniqueShardKey?: boolean;
619+
ActiveShardsCount?: number;
620+
}
621+
enum EHashFunction {
622+
HASH_FUNCTION_MODULO_N = 'HASH_FUNCTION_MODULO_N',
623+
HASH_FUNCTION_CLOUD_LOGS = 'HASH_FUNCTION_CLOUD_LOGS',
624+
}
625+
interface TColumnStorageConfig {
626+
SysLog?: TStorageSettings;
627+
Log?: TStorageSettings;
628+
Data?: TStorageSettings;
629+
DataChannelCount?: number;
630+
}
631+
interface TStorageSettings {
632+
PreferredPoolKind?: string;
633+
AllowOtherKinds?: boolean;
634+
}
635+
export interface TColumnStoreDescription {
636+
Name?: string;
637+
ColumnShardCount?: number;
638+
639+
/** uint64 */
640+
ColumnShards: string[];
641+
642+
SchemaPresets: TColumnTableSchemaPreset[];
643+
StorageConfig?: TColumnStorageConfig;
644+
645+
NextSchemaPresetId?: number;
646+
NextTtlSettingsPresetId?: number;
647+
}
648+
649+
interface TColumnTableSchemaPreset {
650+
Id?: number;
651+
Name?: string;
652+
Schema?: TColumnTableSchema;
653+
}

0 commit comments

Comments
 (0)