Skip to content

Commit

Permalink
Add getSchema() to GenericRecord
Browse files Browse the repository at this point in the history
  • Loading branch information
abcfy2 committed Dec 7, 2024
1 parent 5e304cb commit 6becc6b
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,7 @@
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TimeZone;
import java.util.UUID;
import java.util.*;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.function.Function;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.clickhouse.client.api.data_formats.internal;

import com.clickhouse.client.api.data_formats.ClickHouseBinaryFormatReader;
import com.clickhouse.client.api.metadata.TableSchema;
import com.clickhouse.client.api.query.GenericRecord;
import com.clickhouse.data.value.ClickHouseBitmap;
import com.clickhouse.data.value.ClickHouseGeoMultiPolygonValue;
Expand Down Expand Up @@ -377,4 +378,9 @@ public ClickHouseBitmap getClickHouseBitmap(String colName) {
public ClickHouseBitmap getClickHouseBitmap(int index) {
return reader.readValue(index);
}

@Override
public TableSchema getSchema() {
return reader.getSchema();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import com.clickhouse.client.api.query.GenericRecord;
import com.clickhouse.client.api.query.NullValueException;
import com.clickhouse.data.ClickHouseColumn;
import com.clickhouse.data.value.ClickHouseArrayValue;
import com.clickhouse.data.value.ClickHouseBitmap;
import com.clickhouse.data.value.ClickHouseGeoMultiPolygonValue;
import com.clickhouse.data.value.ClickHouseGeoPointValue;
Expand All @@ -23,17 +22,14 @@
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.temporal.ChronoUnit;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.UUID;
import java.util.*;
import java.util.function.Function;

public class MapBackedRecord implements GenericRecord {

private final Map<String, Object> record;

private TableSchema schema;
private final TableSchema schema;

private Map[] columnConverters;

Expand Down Expand Up @@ -513,6 +509,11 @@ public ClickHouseBitmap getClickHouseBitmap(int index) {
return readValue(index);
}

@Override
public TableSchema getSchema() {
return this.schema;
}

@Override
public Object getObject(String colName) {
return readValue(colName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package com.clickhouse.client.api.query;

import com.clickhouse.client.api.metadata.TableSchema;
import com.clickhouse.data.value.ClickHouseBitmap;
import com.clickhouse.data.value.ClickHouseGeoMultiPolygonValue;
import com.clickhouse.data.value.ClickHouseGeoPointValue;
Expand Down Expand Up @@ -500,4 +501,6 @@ public interface GenericRecord {
ClickHouseBitmap getClickHouseBitmap(String colName);

ClickHouseBitmap getClickHouseBitmap(int index);

TableSchema getSchema();
}

0 comments on commit 6becc6b

Please sign in to comment.