-
Notifications
You must be signed in to change notification settings - Fork 621
Expand file tree
/
Copy pathDataSet.java
More file actions
54 lines (40 loc) · 1.55 KB
/
DataSet.java
File metadata and controls
54 lines (40 loc) · 1.55 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.clickhouse.benchmark.data;
import com.clickhouse.client.api.metadata.TableSchema;
import com.clickhouse.data.ClickHouseDataProcessor;
import com.clickhouse.data.ClickHouseFormat;
import com.clickhouse.data.ClickHouseRecord;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.util.List;
import java.util.Map;
public interface DataSet {
String getName();
String getTableName();
int getSize();
String getCreateTableString();
String getTrucateTableString();
ClickHouseFormat getFormat();
TableSchema getSchema();
List<ClickHouseFormat> supportedFormats();
default InputStream getInputStream(ClickHouseFormat format) {
try {
ByteArrayOutputStream bos = new ByteArrayOutputStream();
for (byte[] bytes : getBytesList(format)) {
bos.write(bytes);
}
return new ByteArrayInputStream(bos.toByteArray());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
default InputStream getInputStream(int rowId, ClickHouseFormat format) {
return new ByteArrayInputStream(getBytesList(format).get(rowId));
}
List<byte[]> getBytesList(ClickHouseFormat format);
List<Map<String, Object>> getRows();
List<ClickHouseRecord> getClickHouseRecords();
void setClickHouseRecords(List<ClickHouseRecord> records);
void setClickHouseDataProcessor(ClickHouseDataProcessor dataProcessor);
ClickHouseDataProcessor getClickHouseDataProcessor();
}