public static StarTreeIndexSpec fromStarTreeMetadata(StarTreeMetadata starTreeMetadata) { StarTreeIndexSpec starTreeIndexSpec = new StarTreeIndexSpec(); starTreeIndexSpec.setMaxLeafRecords(starTreeMetadata.getMaxLeafRecords()); starTreeIndexSpec.setDimensionsSplitOrder(starTreeMetadata.getDimensionsSplitOrder()); starTreeIndexSpec .setSkipStarNodeCreationForDimensions(Sets.newHashSet(starTreeMetadata.getSkipStarNodeCreationForDimensions())); starTreeIndexSpec .setSkipMaterializationForDimensions(Sets.newHashSet(starTreeMetadata.getSkipMaterializationForDimensions())); starTreeIndexSpec.setSkipMaterializationCardinalityThreshold(starTreeMetadata.getSkipMaterializationCardinality()); return starTreeIndexSpec; }
private void setupStarTreeConfig(SegmentGeneratorConfig segmentGenConfig) { // StarTree related StarTreeIndexSpec starTreeIndexSpec = new StarTreeIndexSpec(); starTreeIndexSpec.setMaxLeafRecords(StarTreeIndexSpec.DEFAULT_MAX_LEAF_RECORDS); segmentGenConfig.enableStarTreeIndex(starTreeIndexSpec); LOGGER.info("segmentGenConfig Schema (w/o derived fields): "); printSchema(segmentGenConfig.getSchema()); }
expectedStarTreeSpec.setMaxLeafRecords(expectedMaxLeafRecords);
private void setupSegment(File segmentDir) throws Exception { final String filePath = TestUtils.getFileFromResourceUrl(getClass().getClassLoader().getResource(AVRO_DATA)); if (segmentDir.exists()) { FileUtils.deleteQuietly(segmentDir); } final SegmentGeneratorConfig config = SegmentTestUtils .getSegmentGenSpecWithSchemAndProjectedColumns(new File(filePath), segmentDir, "time_day", TimeUnit.DAYS, TABLE_NAME); config.setTableName(TABLE_NAME); config.setSegmentName(SEGMENT_NAME); StarTreeIndexSpec starTreeIndexSpec = new StarTreeIndexSpec(); starTreeIndexSpec.setDimensionsSplitOrder(DIMENSIONS_SPLIT_ORDER); starTreeIndexSpec.setMaxLeafRecords(MAX_LEAF_RECORDS); starTreeIndexSpec.setSkipMaterializationCardinalityThreshold(SKIP_CARDINALITY_THRESHOLD); starTreeIndexSpec.setSkipStarNodeCreationForDimensions(SKIP_STAR_NODE_CREATION_DIMENSTIONS); starTreeIndexSpec.setSkipMaterializationForDimensions(SKIP_MATERIALIZATION_DIMENSIONS); config.enableStarTreeIndex(starTreeIndexSpec); final SegmentIndexCreationDriver driver = SegmentCreationDriverFactory.get(null); driver.init(config); driver.build(); }
if (starTreeIndexSpec == null) { starTreeIndexSpec = new StarTreeIndexSpec(); starTreeIndexSpec.setMaxLeafRecords(StarTreeIndexSpec.DEFAULT_MAX_LEAF_RECORDS);
starTreeIndexSpec.setMaxLeafRecords(10); config.enableStarTreeIndex(starTreeIndexSpec); config.setOutDir(segmentDirName);
dims.add("dims"); starTreeIndexSpec.setDimensionsSplitOrder(Collections.singletonList("dim")); starTreeIndexSpec.setMaxLeafRecords(5); starTreeIndexSpec.setSkipMaterializationCardinalityThreshold(1); starTreeIndexSpec.setSkipMaterializationForDimensions(dims);