public TestingConnectorContext() { // associate typeManager with a function registry new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); }
@Override public Block readBlock(SliceInput input) { // read the encoding name String encodingName = readLengthPrefixedString(input); // look up the encoding factory BlockEncoding blockEncoding = blockEncodings.get(encodingName); checkArgument(blockEncoding != null, "Unknown block encoding %s", encodingName); // load read the encoding factory from the output stream return blockEncoding.readBlock(this, input); }
@Inject public BlockEncodingManager(TypeManager typeManager, Set<BlockEncoding> blockEncodings) { // This function should be called from Guice and tests only // always add the built-in BlockEncodings addBlockEncoding(new VariableWidthBlockEncoding()); addBlockEncoding(new FixedWidthBlockEncoding()); addBlockEncoding(new ByteArrayBlockEncoding()); addBlockEncoding(new ShortArrayBlockEncoding()); addBlockEncoding(new IntArrayBlockEncoding()); addBlockEncoding(new LongArrayBlockEncoding()); addBlockEncoding(new DictionaryBlockEncoding()); addBlockEncoding(new ArrayBlockEncoding()); addBlockEncoding(new MapBlockEncoding(typeManager)); addBlockEncoding(new SingleMapBlockEncoding(typeManager)); addBlockEncoding(new RowBlockEncoding()); addBlockEncoding(new SingleRowBlockEncoding()); addBlockEncoding(new RunLengthBlockEncoding()); addBlockEncoding(new LazyBlockEncoding()); for (BlockEncoding blockEncoding : requireNonNull(blockEncodings, "blockEncodings is null")) { addBlockEncoding(blockEncoding); } }
@Override public void writeBlockEncoding(SliceOutput output, BlockEncoding encoding) { writeBlockEncodingInternal(output, encoding); }
@Inject public BlockEncodingManager(TypeManager typeManager, Set<BlockEncodingFactory<?>> blockEncodingFactories) { // This function should be called from Guice and tests only this.typeManager = requireNonNull(typeManager, "typeManager is null"); // always add the built-in BlockEncodingFactories addBlockEncodingFactory(VariableWidthBlockEncoding.FACTORY); addBlockEncodingFactory(FixedWidthBlockEncoding.FACTORY); addBlockEncodingFactory(SliceArrayBlockEncoding.FACTORY); addBlockEncodingFactory(LazySliceArrayBlockEncoding.FACTORY); addBlockEncodingFactory(DictionaryBlockEncoding.FACTORY); addBlockEncodingFactory(ArrayBlockEncoding.FACTORY); addBlockEncodingFactory(InterleavedBlockEncoding.FACTORY); addBlockEncodingFactory(RunLengthBlockEncoding.FACTORY); for (BlockEncodingFactory<?> factory : requireNonNull(blockEncodingFactories, "blockEncodingFactories is null")) { addBlockEncodingFactory(factory); } }
public static void writeBlock(SliceOutput output, Block block) { BlockEncoding encoding = block.getEncoding(); BlockEncodingManager.writeBlockEncodingInternal(output, encoding); encoding.writeBlock(output, block); } }
blockEncodingManager.addBlockEncodingFactory(blockEncodingFactory);
public TestOrcReaderMemoryUsage() { // Associate TYPE_MANAGER with a function registry. new FunctionRegistry(TYPE_MANAGER, new BlockEncodingManager(TYPE_MANAGER), new FeaturesConfig()); }
@Override public BlockEncoding readBlockEncoding(SliceInput input) { // read the encoding name String encodingName = readLengthPrefixedString(input); // look up the encoding factory BlockEncodingFactory<?> blockEncoding = blockEncodings.get(encodingName); checkArgument(blockEncoding != null, "Unknown block encoding %s", encodingName); // load read the encoding factory from the output stream return blockEncoding.readEncoding(typeManager, this, input); }
blockEncodingManager.addBlockEncoding(blockEncoding);
TestSignatureBinder() { // associate typeRegistry with a function registry new FunctionRegistry(typeRegistry, new BlockEncodingManager(typeRegistry), new FeaturesConfig()); }
public static MetadataManager createTestMetadataManager(TransactionManager transactionManager, FeaturesConfig featuresConfig) { TypeManager typeManager = new TypeRegistry(ImmutableSet.of(), featuresConfig); return new MetadataManager( featuresConfig, typeManager, new BlockEncodingManager(typeManager), new SessionPropertyManager(), new SchemaPropertyManager(), new TablePropertyManager(), new ColumnPropertyManager(), transactionManager); }
@Test public void testListingHiddenFunctions() { TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); List<SqlFunction> functions = registry.list(); List<String> names = transform(functions, input -> input.getSignature().getName()); assertTrue(names.contains("length"), "Expected function names " + names + " to contain 'length'"); assertTrue(names.contains("stddev"), "Expected function names " + names + " to contain 'stddev'"); assertTrue(names.contains("rank"), "Expected function names " + names + " to contain 'rank'"); assertFalse(names.contains("like"), "Expected function names " + names + " not to contain 'like'"); assertFalse(names.contains("$internal$sum_data_size_for_stats"), "Expected function names " + names + " not to contain '$internal$sum_data_size_for_stats'"); assertFalse(names.contains("$internal$max_data_size_for_stats"), "Expected function names " + names + " not to contain '$internal$max_data_size_for_stats'"); }
@BeforeClass public final void initTestAggregationFunction() { typeRegistry = new TypeRegistry(); functionRegistry = new FunctionRegistry(typeRegistry, new BlockEncodingManager(typeRegistry), new FeaturesConfig()); }
public TestingPagesSerdeFactory() { // compression should be enabled in as many tests as possible super(new BlockEncodingManager(new TestingTypeManager()), true); }
@BeforeClass public void setUp() { typeManager = new TypeRegistry(); optimizer = new ExpressionOptimizer(new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()), typeManager, TEST_SESSION); }
throws Exception BlockEncodingSerde blockEncodingSerde = new BlockEncodingManager(new TypeRegistry()); List<Path> spillPaths = ImmutableList.of(spillPath1.toPath(), spillPath2.toPath()); spillPath1.mkdirs();
public static PagesSerde testingPagesSerde() { return new SynchronizedPagesSerde( new BlockEncodingManager(new TestingTypeManager()), Optional.of(new Lz4Compressor()), Optional.of(new Lz4Decompressor())); }
@Test public void testIdentityCast() { TypeRegistry typeManager = new TypeRegistry(); FunctionRegistry registry = new FunctionRegistry(typeManager, new BlockEncodingManager(typeManager), new FeaturesConfig()); Signature exactOperator = registry.getCoercion(HYPER_LOG_LOG, HYPER_LOG_LOG); assertEquals(exactOperator.getName(), mangleOperatorName(OperatorType.CAST.name())); assertEquals(transform(exactOperator.getArgumentTypes(), Functions.toStringFunction()), ImmutableList.of(StandardTypes.HYPER_LOG_LOG)); assertEquals(exactOperator.getReturnType().getBase(), StandardTypes.HYPER_LOG_LOG); }
@Test(expectedExceptions = RuntimeException.class, expectedExceptionsMessageRegExp = "No spill paths configured") public void throwIfNoSpillPaths() { List<Path> spillPaths = emptyList(); List<Type> types = ImmutableList.of(BIGINT); FileSingleStreamSpillerFactory spillerFactory = new FileSingleStreamSpillerFactory( executor, // executor won't be closed, because we don't call destroy() on the spiller factory new BlockEncodingManager(new TypeRegistry()), new SpillerStats(), spillPaths, 1.0); spillerFactory.create(types, bytes -> {}, newSimpleAggregatedMemoryContext().newLocalMemoryContext("test")); }