Search in sources :

Example 31 with InputSource

use of org.apache.druid.data.input.InputSource in project druid by druid-io.

the class ExternalTableMacro method apply.

@Override
public TranslatableTable apply(final List<Object> arguments) {
    try {
        final InputSource inputSource = jsonMapper.readValue((String) arguments.get(0), InputSource.class);
        final InputFormat inputFormat = jsonMapper.readValue((String) arguments.get(1), InputFormat.class);
        final RowSignature signature = jsonMapper.readValue((String) arguments.get(2), RowSignature.class);
        return new DruidTable(new ExternalDataSource(inputSource, inputFormat, signature), signature, jsonMapper, false, false);
    } catch (JsonProcessingException e) {
        throw new RuntimeException(e);
    }
}
Also used : InputSource(org.apache.druid.data.input.InputSource) InputFormat(org.apache.druid.data.input.InputFormat) DruidTable(org.apache.druid.sql.calcite.table.DruidTable) RowSignature(org.apache.druid.segment.column.RowSignature) JsonProcessingException(com.fasterxml.jackson.core.JsonProcessingException)

Aggregations

InputSource (org.apache.druid.data.input.InputSource)31 InputFormat (org.apache.druid.data.input.InputFormat)20 Test (org.junit.Test)19 DataSchema (org.apache.druid.segment.indexing.DataSchema)18 SamplerResponse (org.apache.druid.client.indexing.SamplerResponse)14 InlineInputSource (org.apache.druid.data.input.impl.InlineInputSource)14 InitializedNullHandlingTest (org.apache.druid.testing.InitializedNullHandlingTest)14 SamplerResponseRow (org.apache.druid.client.indexing.SamplerResponse.SamplerResponseRow)13 CsvInputFormat (org.apache.druid.data.input.impl.CsvInputFormat)13 DimensionsSpec (org.apache.druid.data.input.impl.DimensionsSpec)13 TimestampSpec (org.apache.druid.data.input.impl.TimestampSpec)13 RecordSupplierInputSource (org.apache.druid.indexing.seekablestream.RecordSupplierInputSource)13 JsonInputFormat (org.apache.druid.data.input.impl.JsonInputFormat)12 GranularitySpec (org.apache.druid.segment.indexing.granularity.GranularitySpec)11 UniformGranularitySpec (org.apache.druid.segment.indexing.granularity.UniformGranularitySpec)8 AggregatorFactory (org.apache.druid.query.aggregation.AggregatorFactory)7 LongSumAggregatorFactory (org.apache.druid.query.aggregation.LongSumAggregatorFactory)7 IOException (java.io.IOException)6 ParseExceptionHandler (org.apache.druid.segment.incremental.ParseExceptionHandler)6 File (java.io.File)5