org.apache.druid.server.lookup.jdbc.QueryKeys Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of druid-lookups-cached-single Show documentation
Show all versions of druid-lookups-cached-single Show documentation
Extension to rename Druid dimension values using lookups
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing,
* software distributed under the License is distributed on an
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
* KIND, either express or implied. See the License for the
* specific language governing permissions and limitations
* under the License.
*/
package org.apache.druid.server.lookup.jdbc;
import com.google.common.collect.ImmutableSet;
import org.skife.jdbi.v2.ContainerBuilder;
import org.skife.jdbi.v2.sqlobject.SqlQuery;
import org.skife.jdbi.v2.sqlobject.customizers.Define;
import org.skife.jdbi.v2.sqlobject.customizers.RegisterContainerMapper;
import org.skife.jdbi.v2.sqlobject.stringtemplate.UseStringTemplate3StatementLocator;
import org.skife.jdbi.v2.tweak.ContainerFactory;
import org.skife.jdbi.v2.unstable.BindIn;
import java.util.List;
import java.util.Map;
@UseStringTemplate3StatementLocator()
@RegisterContainerMapper(QueryKeys.QueryKeysContainerFactory.class)
public interface QueryKeys
{
@SqlQuery("SELECT , FROM WHERE IN ()")
ImmutableSet> findNamesForIds(
@BindIn("keys") List keys,
@Define("table") String table,
@Define("keyColumn") String keyColumn,
@Define("valueColumn") String valueColumn
);
class QueryKeysContainerFactory implements ContainerFactory>
{
@Override
public boolean accepts(Class> type)
{
return ImmutableSet.class.isAssignableFrom(type);
}
@Override
public ContainerBuilder> newContainerBuilderFor(Class> type)
{
return new ContainerBuilder>()
{
final ImmutableSet.Builder