Search in sources :

Example 1 with BlockEncoding

use of io.trino.spi.block.BlockEncoding in project trino by trinodb.

the class BlockEncodingManager method getBlockEncoding.

public BlockEncoding getBlockEncoding(String encodingName) {
    BlockEncoding blockEncoding = blockEncodings.get(encodingName);
    checkArgument(blockEncoding != null, "Unknown block encoding: %s", encodingName);
    return blockEncoding;
}
Also used : VariableWidthBlockEncoding(io.trino.spi.block.VariableWidthBlockEncoding) MapBlockEncoding(io.trino.spi.block.MapBlockEncoding) RunLengthBlockEncoding(io.trino.spi.block.RunLengthBlockEncoding) IntArrayBlockEncoding(io.trino.spi.block.IntArrayBlockEncoding) LongArrayBlockEncoding(io.trino.spi.block.LongArrayBlockEncoding) SingleRowBlockEncoding(io.trino.spi.block.SingleRowBlockEncoding) RowBlockEncoding(io.trino.spi.block.RowBlockEncoding) ArrayBlockEncoding(io.trino.spi.block.ArrayBlockEncoding) ByteArrayBlockEncoding(io.trino.spi.block.ByteArrayBlockEncoding) BlockEncoding(io.trino.spi.block.BlockEncoding) SingleMapBlockEncoding(io.trino.spi.block.SingleMapBlockEncoding) Int128ArrayBlockEncoding(io.trino.spi.block.Int128ArrayBlockEncoding) Int96ArrayBlockEncoding(io.trino.spi.block.Int96ArrayBlockEncoding) DictionaryBlockEncoding(io.trino.spi.block.DictionaryBlockEncoding) ShortArrayBlockEncoding(io.trino.spi.block.ShortArrayBlockEncoding) LazyBlockEncoding(io.trino.spi.block.LazyBlockEncoding)

Example 2 with BlockEncoding

use of io.trino.spi.block.BlockEncoding in project trino by trinodb.

the class InternalBlockEncodingSerde method writeBlock.

@Override
public void writeBlock(SliceOutput output, Block block) {
    while (true) {
        // get the encoding name
        String encodingName = block.getEncodingName();
        // look up the BlockEncoding
        BlockEncoding blockEncoding = blockEncodings.apply(encodingName);
        // see if a replacement block should be written instead
        Optional<Block> replacementBlock = blockEncoding.replacementBlockForWrite(block);
        if (replacementBlock.isPresent()) {
            block = replacementBlock.get();
            continue;
        }
        // write the name to the output
        writeLengthPrefixedString(output, encodingName);
        // write the block to the output
        blockEncoding.writeBlock(this, output, block);
        break;
    }
}
Also used : Block(io.trino.spi.block.Block) BlockEncoding(io.trino.spi.block.BlockEncoding)

Example 3 with BlockEncoding

use of io.trino.spi.block.BlockEncoding in project trino by trinodb.

the class PluginManager method installPluginInternal.

private void installPluginInternal(Plugin plugin, Function<CatalogName, ClassLoader> duplicatePluginClassLoaderFactory) {
    for (BlockEncoding blockEncoding : plugin.getBlockEncodings()) {
        log.info("Registering block encoding %s", blockEncoding.getName());
        blockEncodingManager.addBlockEncoding(blockEncoding);
    }
    for (Type type : plugin.getTypes()) {
        log.info("Registering type %s", type.getTypeSignature());
        typeRegistry.addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
        log.info("Registering parametric type %s", parametricType.getName());
        typeRegistry.addParametricType(parametricType);
    }
    for (ConnectorFactory connectorFactory : plugin.getConnectorFactories()) {
        log.info("Registering connector %s", connectorFactory.getName());
        connectorManager.addConnectorFactory(connectorFactory, duplicatePluginClassLoaderFactory);
    }
    Set<Class<?>> functions = plugin.getFunctions();
    if (!functions.isEmpty()) {
        log.info("Registering functions from %s", plugin.getClass().getSimpleName());
        InternalFunctionBundleBuilder builder = InternalFunctionBundle.builder();
        functions.forEach(builder::functions);
        globalFunctionCatalog.addFunctions(builder.build());
    }
    for (SessionPropertyConfigurationManagerFactory sessionConfigFactory : plugin.getSessionPropertyConfigurationManagerFactories()) {
        log.info("Registering session property configuration manager %s", sessionConfigFactory.getName());
        sessionPropertyDefaults.addConfigurationManagerFactory(sessionConfigFactory);
    }
    for (ResourceGroupConfigurationManagerFactory configurationManagerFactory : plugin.getResourceGroupConfigurationManagerFactories()) {
        log.info("Registering resource group configuration manager %s", configurationManagerFactory.getName());
        resourceGroupManager.addConfigurationManagerFactory(configurationManagerFactory);
    }
    for (SystemAccessControlFactory accessControlFactory : plugin.getSystemAccessControlFactories()) {
        log.info("Registering system access control %s", accessControlFactory.getName());
        accessControlManager.addSystemAccessControlFactory(accessControlFactory);
    }
    passwordAuthenticatorManager.ifPresent(authenticationManager -> {
        for (PasswordAuthenticatorFactory authenticatorFactory : plugin.getPasswordAuthenticatorFactories()) {
            log.info("Registering password authenticator %s", authenticatorFactory.getName());
            authenticationManager.addPasswordAuthenticatorFactory(authenticatorFactory);
        }
    });
    for (CertificateAuthenticatorFactory authenticatorFactory : plugin.getCertificateAuthenticatorFactories()) {
        log.info("Registering certificate authenticator %s", authenticatorFactory.getName());
        certificateAuthenticatorManager.addCertificateAuthenticatorFactory(authenticatorFactory);
    }
    headerAuthenticatorManager.ifPresent(authenticationManager -> {
        for (HeaderAuthenticatorFactory authenticatorFactory : plugin.getHeaderAuthenticatorFactories()) {
            log.info("Registering header authenticator %s", authenticatorFactory.getName());
            authenticationManager.addHeaderAuthenticatorFactory(authenticatorFactory);
        }
    });
    for (EventListenerFactory eventListenerFactory : plugin.getEventListenerFactories()) {
        log.info("Registering event listener %s", eventListenerFactory.getName());
        eventListenerManager.addEventListenerFactory(eventListenerFactory);
    }
    for (GroupProviderFactory groupProviderFactory : plugin.getGroupProviderFactories()) {
        log.info("Registering group provider %s", groupProviderFactory.getName());
        groupProviderManager.addGroupProviderFactory(groupProviderFactory);
    }
    for (ExchangeManagerFactory exchangeManagerFactory : plugin.getExchangeManagerFactories()) {
        log.info("Registering exchange manager %s", exchangeManagerFactory.getName());
        exchangeManagerRegistry.addExchangeManagerFactory(exchangeManagerFactory);
    }
}
Also used : ResourceGroupConfigurationManagerFactory(io.trino.spi.resourcegroups.ResourceGroupConfigurationManagerFactory) HeaderAuthenticatorFactory(io.trino.spi.security.HeaderAuthenticatorFactory) EventListenerFactory(io.trino.spi.eventlistener.EventListenerFactory) SystemAccessControlFactory(io.trino.spi.security.SystemAccessControlFactory) Type(io.trino.spi.type.Type) ParametricType(io.trino.spi.type.ParametricType) PasswordAuthenticatorFactory(io.trino.spi.security.PasswordAuthenticatorFactory) ConnectorFactory(io.trino.spi.connector.ConnectorFactory) InternalFunctionBundleBuilder(io.trino.metadata.InternalFunctionBundle.InternalFunctionBundleBuilder) ParametricType(io.trino.spi.type.ParametricType) SessionPropertyConfigurationManagerFactory(io.trino.spi.session.SessionPropertyConfigurationManagerFactory) BlockEncoding(io.trino.spi.block.BlockEncoding) CertificateAuthenticatorFactory(io.trino.spi.security.CertificateAuthenticatorFactory) GroupProviderFactory(io.trino.spi.security.GroupProviderFactory) ExchangeManagerFactory(io.trino.spi.exchange.ExchangeManagerFactory)

Example 4 with BlockEncoding

use of io.trino.spi.block.BlockEncoding in project trino by trinodb.

the class HiveBlockEncodingSerde method writeBlock.

@Override
public void writeBlock(SliceOutput output, Block block) {
    while (true) {
        // get the encoding name
        String encodingName = block.getEncodingName();
        // look up the encoding factory
        BlockEncoding blockEncoding = blockEncodings.get(encodingName);
        // see if a replacement block should be written instead
        Optional<Block> replacementBlock = blockEncoding.replacementBlockForWrite(block);
        if (replacementBlock.isPresent()) {
            block = replacementBlock.get();
            continue;
        }
        // write the name to the output
        writeLengthPrefixedString(output, encodingName);
        // write the block to the output
        blockEncoding.writeBlock(this, output, block);
        break;
    }
}
Also used : Block(io.trino.spi.block.Block) RunLengthBlockEncoding(io.trino.spi.block.RunLengthBlockEncoding) IntArrayBlockEncoding(io.trino.spi.block.IntArrayBlockEncoding) LongArrayBlockEncoding(io.trino.spi.block.LongArrayBlockEncoding) ByteArrayBlockEncoding(io.trino.spi.block.ByteArrayBlockEncoding) BlockEncoding(io.trino.spi.block.BlockEncoding) Int128ArrayBlockEncoding(io.trino.spi.block.Int128ArrayBlockEncoding) DictionaryBlockEncoding(io.trino.spi.block.DictionaryBlockEncoding) VariableWidthBlockEncoding(io.trino.spi.block.VariableWidthBlockEncoding) SingleRowBlockEncoding(io.trino.spi.block.SingleRowBlockEncoding) RowBlockEncoding(io.trino.spi.block.RowBlockEncoding) ArrayBlockEncoding(io.trino.spi.block.ArrayBlockEncoding) ShortArrayBlockEncoding(io.trino.spi.block.ShortArrayBlockEncoding) LazyBlockEncoding(io.trino.spi.block.LazyBlockEncoding)

Example 5 with BlockEncoding

use of io.trino.spi.block.BlockEncoding in project trino by trinodb.

the class HiveBlockEncodingSerde method readBlock.

@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);
}
Also used : RunLengthBlockEncoding(io.trino.spi.block.RunLengthBlockEncoding) IntArrayBlockEncoding(io.trino.spi.block.IntArrayBlockEncoding) LongArrayBlockEncoding(io.trino.spi.block.LongArrayBlockEncoding) ByteArrayBlockEncoding(io.trino.spi.block.ByteArrayBlockEncoding) BlockEncoding(io.trino.spi.block.BlockEncoding) Int128ArrayBlockEncoding(io.trino.spi.block.Int128ArrayBlockEncoding) DictionaryBlockEncoding(io.trino.spi.block.DictionaryBlockEncoding) VariableWidthBlockEncoding(io.trino.spi.block.VariableWidthBlockEncoding) SingleRowBlockEncoding(io.trino.spi.block.SingleRowBlockEncoding) RowBlockEncoding(io.trino.spi.block.RowBlockEncoding) ArrayBlockEncoding(io.trino.spi.block.ArrayBlockEncoding) ShortArrayBlockEncoding(io.trino.spi.block.ShortArrayBlockEncoding) LazyBlockEncoding(io.trino.spi.block.LazyBlockEncoding)

Aggregations

BlockEncoding (io.trino.spi.block.BlockEncoding)7 ArrayBlockEncoding (io.trino.spi.block.ArrayBlockEncoding)4 ByteArrayBlockEncoding (io.trino.spi.block.ByteArrayBlockEncoding)4 DictionaryBlockEncoding (io.trino.spi.block.DictionaryBlockEncoding)4 Int128ArrayBlockEncoding (io.trino.spi.block.Int128ArrayBlockEncoding)4 IntArrayBlockEncoding (io.trino.spi.block.IntArrayBlockEncoding)4 LazyBlockEncoding (io.trino.spi.block.LazyBlockEncoding)4 LongArrayBlockEncoding (io.trino.spi.block.LongArrayBlockEncoding)4 RowBlockEncoding (io.trino.spi.block.RowBlockEncoding)4 RunLengthBlockEncoding (io.trino.spi.block.RunLengthBlockEncoding)4 ShortArrayBlockEncoding (io.trino.spi.block.ShortArrayBlockEncoding)4 SingleRowBlockEncoding (io.trino.spi.block.SingleRowBlockEncoding)4 VariableWidthBlockEncoding (io.trino.spi.block.VariableWidthBlockEncoding)4 Block (io.trino.spi.block.Block)2 Int96ArrayBlockEncoding (io.trino.spi.block.Int96ArrayBlockEncoding)2 MapBlockEncoding (io.trino.spi.block.MapBlockEncoding)2 SingleMapBlockEncoding (io.trino.spi.block.SingleMapBlockEncoding)2 InternalFunctionBundleBuilder (io.trino.metadata.InternalFunctionBundle.InternalFunctionBundleBuilder)1 ConnectorFactory (io.trino.spi.connector.ConnectorFactory)1 EventListenerFactory (io.trino.spi.eventlistener.EventListenerFactory)1