Search in sources :

Example 16 with TimeFieldSpec

use of com.linkedin.pinot.common.data.TimeFieldSpec in project pinot by linkedin.

the class TransformGroupByTest method buildSchema.

/**
   * Helper method to build a schema with one string dimension, and one double metric columns.
   */
private static Schema buildSchema() {
    Schema schema = new Schema();
    DimensionFieldSpec dimensionFieldSpec = new DimensionFieldSpec(DIMENSION_NAME, FieldSpec.DataType.STRING, true);
    schema.addField(dimensionFieldSpec);
    MetricFieldSpec metricFieldSpec = new MetricFieldSpec(METRIC_NAME, FieldSpec.DataType.DOUBLE);
    schema.addField(metricFieldSpec);
    TimeFieldSpec timeFieldSpec = new TimeFieldSpec(TIME_COLUMN_NAME, FieldSpec.DataType.LONG, TimeUnit.MILLISECONDS);
    schema.setTimeFieldSpec(timeFieldSpec);
    return schema;
}
Also used : Schema(com.linkedin.pinot.common.data.Schema) TimeFieldSpec(com.linkedin.pinot.common.data.TimeFieldSpec) MetricFieldSpec(com.linkedin.pinot.common.data.MetricFieldSpec) DimensionFieldSpec(com.linkedin.pinot.common.data.DimensionFieldSpec)

Example 17 with TimeFieldSpec

use of com.linkedin.pinot.common.data.TimeFieldSpec in project pinot by linkedin.

the class PinotSegmentRecordReaderTest method createPinotSchema.

private Schema createPinotSchema() {
    Schema testSchema = new Schema();
    testSchema.setSchemaName("schema");
    FieldSpec spec;
    spec = new DimensionFieldSpec(D_SV_1, DataType.STRING, true);
    testSchema.addField(spec);
    spec = new DimensionFieldSpec(D_MV_1, DataType.STRING, false);
    testSchema.addField(spec);
    spec = new MetricFieldSpec(M1, DataType.INT);
    testSchema.addField(spec);
    spec = new MetricFieldSpec(M2, DataType.FLOAT);
    testSchema.addField(spec);
    spec = new TimeFieldSpec(new TimeGranularitySpec(DataType.LONG, TimeUnit.HOURS, TIME));
    testSchema.addField(spec);
    return testSchema;
}
Also used : TimeGranularitySpec(com.linkedin.pinot.common.data.TimeGranularitySpec) Schema(com.linkedin.pinot.common.data.Schema) TimeFieldSpec(com.linkedin.pinot.common.data.TimeFieldSpec) MetricFieldSpec(com.linkedin.pinot.common.data.MetricFieldSpec) MetricFieldSpec(com.linkedin.pinot.common.data.MetricFieldSpec) DimensionFieldSpec(com.linkedin.pinot.common.data.DimensionFieldSpec) TimeFieldSpec(com.linkedin.pinot.common.data.TimeFieldSpec) FieldSpec(com.linkedin.pinot.common.data.FieldSpec) DimensionFieldSpec(com.linkedin.pinot.common.data.DimensionFieldSpec)

Aggregations

TimeFieldSpec (com.linkedin.pinot.common.data.TimeFieldSpec)17 DimensionFieldSpec (com.linkedin.pinot.common.data.DimensionFieldSpec)12 MetricFieldSpec (com.linkedin.pinot.common.data.MetricFieldSpec)12 Schema (com.linkedin.pinot.common.data.Schema)11 FieldSpec (com.linkedin.pinot.common.data.FieldSpec)10 TimeGranularitySpec (com.linkedin.pinot.common.data.TimeGranularitySpec)7 File (java.io.File)4 FieldType (com.linkedin.pinot.common.data.FieldSpec.FieldType)3 JSONObject (org.json.JSONObject)3 DataType (com.linkedin.pinot.common.data.FieldSpec.DataType)2 GenericRow (com.linkedin.pinot.core.data.GenericRow)2 HashMap (java.util.HashMap)2 TimeUnit (java.util.concurrent.TimeUnit)2 Field (org.apache.avro.Schema.Field)2 Test (org.testng.annotations.Test)2 AbstractTableConfig (com.linkedin.pinot.common.config.AbstractTableConfig)1 IndexingConfig (com.linkedin.pinot.common.config.IndexingConfig)1 StarTreeIndexSpec (com.linkedin.pinot.common.data.StarTreeIndexSpec)1 CSVRecordReaderConfig (com.linkedin.pinot.core.data.readers.CSVRecordReaderConfig)1 ColumnMetadata (com.linkedin.pinot.core.segment.index.ColumnMetadata)1