You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Create a service implementing the following interface and helper types
type Table struct {
Name string
Path string
Fields [][2]string // field name and type
OrderBy []string
}
type IMergeTree interface {
Store(table *Table, columns []string, data []any) error
Merge(table *Table) error
}
The method Store(table *Table, columns []string, data []any) error description
table - table to store
columns - column names for the data
data - array of arrays for each column:
UInt64 column type should be []uint64 in the data arg
Int64 column type should be []int64 in the data arg
String column type should be []string or [][]byte in the data arg
Float64 column type should be []string or [][]byte in the data arg
The Store method should
check that columns length, data length and table.Fields length are the same
check that columns enumerate all the table.Fields ehtries
check if the data entries types are legit according to description above
check if all the data entries have the same size
save the data as a .parquet file into the table.Path/data folder.
The Merge method should
enumerate all the files in the directory
select the files to merge so the resulting file size is (approximately) less than 4G
generate a DuckDB request to merge the planned .parquet files into one .parquet file inside table.Path/tmp folder
the request should have OrderBy expression according to the table.OrderBy field
delete the source .parquet files and move the resulting .parquet file into the table.Path/data folder
Testing
The following request should create a parquet file
How
Create a service implementing the following interface and helper types
The method
Store(table *Table, columns []string, data []any) error
descriptiontable
- table to storecolumns
- column names for thedata
data
- array of arrays for each column:UInt64
column type should be[]uint64
in thedata
argInt64
column type should be[]int64
in thedata
argString
column type should be[]string
or[][]byte
in thedata
argFloat64
column type should be[]string
or[][]byte
in thedata
argThe
Store
method shouldcolumns
length,data
length andtable.Fields
length are the samecolumns
enumerate all thetable.Fields
ehtries.parquet
file into thetable.Path
/data folder.The
Merge
method should.parquet
files into one.parquet
file insidetable.Path
/tmp foldertable.OrderBy
field.parquet
files and move the resulting.parquet
file into thetable.Path
/data folderTesting
The following request should create a parquet file
Create a set of unit tests for the positive scenario and several negative scenarios:
table.Fields
sizeThe text was updated successfully, but these errors were encountered: