mirror of https://github.com/apache/druid.git
This commit is contained in:
parent
70e46eadb9
commit
436ba18815
|
@ -63,9 +63,11 @@ class TestMSQSqlModule extends TestDruidModule {
|
|||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
private MSQTestOverlordServiceClient extracted(ObjectMapper queryJsonMapper, Injector injector)
|
||||
private MSQTestOverlordServiceClient makeOverlordServiceClient(
|
||||
ObjectMapper queryJsonMapper,
|
||||
Injector injector,
|
||||
WorkerMemoryParameters workerMemoryParameters)
|
||||
{
|
||||
final WorkerMemoryParameters workerMemoryParameters = MSQTestBase.makeTestWorkerMemoryParameters();
|
||||
final MSQTestOverlordServiceClient indexingServiceClient = new MSQTestOverlordServiceClient(
|
||||
queryJsonMapper,
|
||||
injector,
|
||||
|
@ -76,6 +78,14 @@ class TestMSQSqlModule extends TestDruidModule {
|
|||
return indexingServiceClient;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
private WorkerMemoryParameters makeWorkerMemoryParameters()
|
||||
{
|
||||
final WorkerMemoryParameters workerMemoryParameters = MSQTestBase.makeTestWorkerMemoryParameters();
|
||||
return workerMemoryParameters;
|
||||
}
|
||||
|
||||
@Provides
|
||||
@LazySingleton
|
||||
public DruidMeta createMeta(
|
||||
|
|
|
@ -22,26 +22,24 @@ package org.apache.druid.query.rowsandcols.concrete;
|
|||
import org.apache.druid.frame.Frame;
|
||||
import org.apache.druid.frame.FrameType;
|
||||
import org.apache.druid.frame.read.FrameReader;
|
||||
import org.apache.druid.frame.read.columnar.FrameColumnReaders;
|
||||
import org.apache.druid.frame.segment.FrameStorageAdapter;
|
||||
import org.apache.druid.java.util.common.ISE;
|
||||
import org.apache.druid.java.util.common.Intervals;
|
||||
import org.apache.druid.query.operator.OffsetLimit;
|
||||
import org.apache.druid.query.rowsandcols.LazilyDecoratedRowsAndColumns;
|
||||
import org.apache.druid.query.rowsandcols.RowsAndColumns;
|
||||
import org.apache.druid.query.rowsandcols.column.Column;
|
||||
import org.apache.druid.segment.CloseableShapeshifter;
|
||||
import org.apache.druid.segment.StorageAdapter;
|
||||
import org.apache.druid.segment.column.ColumnType;
|
||||
import org.apache.druid.segment.column.RowSignature;
|
||||
|
||||
import javax.annotation.Nullable;
|
||||
import java.util.Collection;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
public class RowBasedFrameRowsAndColumns implements RowsAndColumns, AutoCloseable, CloseableShapeshifter
|
||||
{
|
||||
private final Frame frame;
|
||||
private final RowSignature signature;
|
||||
private final LinkedHashMap<String, Column> colCache = new LinkedHashMap<>();
|
||||
private LazilyDecoratedRowsAndColumns rac;
|
||||
|
||||
public RowBasedFrameRowsAndColumns(Frame frame, RowSignature signature)
|
||||
{
|
||||
|
@ -65,19 +63,10 @@ public class RowBasedFrameRowsAndColumns implements RowsAndColumns, AutoCloseabl
|
|||
@Override
|
||||
public Column findColumn(String name)
|
||||
{
|
||||
if (!colCache.containsKey(name)) {
|
||||
final int columnIndex = signature.indexOf(name);
|
||||
if (columnIndex < 0) {
|
||||
colCache.put(name, null);
|
||||
} else {
|
||||
final ColumnType columnType = signature
|
||||
.getColumnType(columnIndex)
|
||||
.orElseThrow(() -> new ISE("just got the id, why is columnType not there?"));
|
||||
|
||||
colCache.put(name, FrameColumnReaders.create(name, columnIndex, columnType).readRACColumn(frame));
|
||||
if( rac == null) {
|
||||
LazilyDecoratedRowsAndColumns rac = new LazilyDecoratedRowsAndColumns(this, null, null, null, OffsetLimit.limit(Integer.MAX_VALUE), null, null);
|
||||
}
|
||||
}
|
||||
return colCache.get(name);
|
||||
return rac.findColumn(name);
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
|
|
|
@ -23,10 +23,13 @@ import com.google.common.collect.Iterables;
|
|||
import org.apache.druid.frame.Frame;
|
||||
import org.apache.druid.frame.FrameType;
|
||||
import org.apache.druid.frame.allocation.HeapMemoryAllocator;
|
||||
import org.apache.druid.frame.read.columnar.FrameColumnReaders;
|
||||
import org.apache.druid.frame.testutil.FrameSequenceBuilder;
|
||||
import org.apache.druid.segment.QueryableIndexStorageAdapter;
|
||||
import org.apache.druid.segment.StorageAdapter;
|
||||
import org.apache.druid.segment.TestIndex;
|
||||
import org.apache.druid.segment.column.ColumnType;
|
||||
import org.apache.druid.segment.column.RowSignature;
|
||||
import org.apache.druid.testing.InitializedNullHandlingTest;
|
||||
import org.junit.Assert;
|
||||
import org.junit.Before;
|
||||
|
@ -94,4 +97,14 @@ public class FrameReaderTest extends InitializedNullHandlingTest
|
|||
);
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testReadRacColumn()
|
||||
{
|
||||
RowSignature rs = inputAdapter.getRowSignature();
|
||||
int colNo = 1;
|
||||
String name = rs.getColumnName(colNo);
|
||||
ColumnType type = rs.getColumnType(colNo).get();
|
||||
FrameColumnReaders.create(name, colNo, type).readRACColumn(frame);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue