/** * Builds and returns StarTreeIndexSpec from specified file. * * @param starTreeIndexSpecFile File containing star tree index spec. * @return StarTreeIndexSpec object de-serialized from the file. * @throws IOException */ public static StarTreeIndexSpec fromFile(File starTreeIndexSpecFile) throws IOException { return JsonUtils.fileToObject(starTreeIndexSpecFile, StarTreeIndexSpec.class); }
@Nonnull public static Schema fromFile(@Nonnull File schemaFile) throws IOException { return JsonUtils.fileToObject(schemaFile, Schema.class); }
throw new RuntimeException("Must specify srcTimeFieldSpec and destTimeFieldSpec."); TimeFieldSpec timeFieldSpec = JsonUtils.fileToObject(new File(_srcTimeFieldSpec), TimeFieldSpec.class); DateTimeFieldSpec dateTimeFieldSpec = JsonUtils.fileToObject(new File(_destDateTimeFieldSpec), DateTimeFieldSpec.class);
private void buildCardinalityRangeMaps(String file, HashMap<String, Integer> cardinality, HashMap<String, IntRange> range) throws IOException { if (file == null) { return; // Nothing to do here. } List<SchemaAnnotation> saList = JsonUtils.fileToObject(new File(file), List.class); for (SchemaAnnotation sa : saList) { String column = sa.getColumn(); if (sa.isRange()) { range.put(column, new IntRange(sa.getRangeStart(), sa.getRangeEnd())); } else { cardinality.put(column, sa.getCardinality()); } } }
/** * @deprecated Load outside the class and use the setter for schema setting. * @throws IOException */ @Deprecated public void loadConfigFiles() throws IOException { Schema schema; if (_schemaFile != null) { schema = Schema.fromFile(new File(_schemaFile)); setSchema(schema); } else if (_format == FileFormat.AVRO) { schema = AvroUtils.getPinotSchemaFromAvroDataFile(new File(_inputFilePath)); setSchema(schema); } else { throw new RuntimeException("Input format " + _format + " requires schema."); } setTimeColumnName(schema.getTimeColumnName()); TimeFieldSpec timeFieldSpec = schema.getTimeFieldSpec(); if (timeFieldSpec != null) { setSegmentTimeUnit(timeFieldSpec.getIncomingGranularitySpec().getTimeType()); } else { setSegmentTimeUnit(TimeUnit.DAYS); } if (_readerConfigFile != null) { setReaderConfig(JsonUtils.fileToObject(new File(_readerConfigFile), CSVRecordReaderConfig.class)); } }
segmentGeneratorConfig = JsonUtils.fileToObject(new File(_generatorConfigFile), SegmentGeneratorConfig.class); } else { segmentGeneratorConfig = new SegmentGeneratorConfig();