org.apache.pinot.common.utils.JsonUtils.fileToObject()方法的使用及代码示例

x33g5p2x  于2022-01-22 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(86)

本文整理了Java中org.apache.pinot.common.utils.JsonUtils.fileToObject()方法的一些代码示例,展示了JsonUtils.fileToObject()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JsonUtils.fileToObject()方法的具体详情如下:
包路径:org.apache.pinot.common.utils.JsonUtils
类名称:JsonUtils
方法名:fileToObject

JsonUtils.fileToObject介绍

暂无

代码示例

代码示例来源:origin: apache/incubator-pinot

/**
 * 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);
}

代码示例来源:origin: apache/incubator-pinot

@Nonnull
public static Schema fromFile(@Nonnull File schemaFile)
  throws IOException {
 return JsonUtils.fileToObject(schemaFile, Schema.class);
}

代码示例来源:origin: apache/incubator-pinot

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);

代码示例来源:origin: apache/incubator-pinot

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());
  }
 }
}

代码示例来源:origin: apache/incubator-pinot

/**
 * @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));
 }
}

代码示例来源:origin: apache/incubator-pinot

segmentGeneratorConfig = JsonUtils.fileToObject(new File(_generatorConfigFile), SegmentGeneratorConfig.class);
} else {
 segmentGeneratorConfig = new SegmentGeneratorConfig();

相关文章