use of com.google.common.annotations.VisibleForTesting in project hive by apache.
the class HiveEventCounter method addToLogger.
@VisibleForTesting
public void addToLogger(String loggerName, Level level) {
LoggerConfig loggerConfig = configuration.getLoggerConfig(loggerName);
loggerConfig.addAppender(this, level, null);
context.updateLoggers();
}
use of com.google.common.annotations.VisibleForTesting in project hive by apache.
the class OrcInputFormat method determineSplitStrategies.
@VisibleForTesting
static List<SplitStrategy<?>> determineSplitStrategies(CombinedCtx combinedCtx, Context context, FileSystem fs, Path dir, AcidUtils.Directory dirInfo, List<AcidBaseFileInfo> baseFiles, List<ParsedDelta> parsedDeltas, List<OrcProto.Type> readerTypes, UserGroupInformation ugi, boolean allowSyntheticFileIds) {
List<SplitStrategy<?>> splitStrategies = new ArrayList<SplitStrategy<?>>();
SplitStrategy<?> splitStrategy;
// When no baseFiles, we will just generate a single split strategy and return.
List<HdfsFileStatusWithId> acidSchemaFiles = new ArrayList<HdfsFileStatusWithId>();
if (baseFiles.isEmpty()) {
splitStrategy = determineSplitStrategy(combinedCtx, context, fs, dir, dirInfo, acidSchemaFiles, false, parsedDeltas, readerTypes, ugi, allowSyntheticFileIds);
if (splitStrategy != null) {
splitStrategies.add(splitStrategy);
}
// return here
return splitStrategies;
}
List<HdfsFileStatusWithId> originalSchemaFiles = new ArrayList<HdfsFileStatusWithId>();
// Separate the base files into acid schema and non-acid(original) schema files.
for (AcidBaseFileInfo acidBaseFileInfo : baseFiles) {
if (acidBaseFileInfo.isOriginal()) {
originalSchemaFiles.add(acidBaseFileInfo.getHdfsFileStatusWithId());
} else {
acidSchemaFiles.add(acidBaseFileInfo.getHdfsFileStatusWithId());
}
}
// Generate split strategy for non-acid schema original files, if any.
if (!originalSchemaFiles.isEmpty()) {
splitStrategy = determineSplitStrategy(combinedCtx, context, fs, dir, dirInfo, originalSchemaFiles, true, parsedDeltas, readerTypes, ugi, allowSyntheticFileIds);
if (splitStrategy != null) {
splitStrategies.add(splitStrategy);
}
}
// Generate split strategy for acid schema files, if any.
if (!acidSchemaFiles.isEmpty()) {
splitStrategy = determineSplitStrategy(combinedCtx, context, fs, dir, dirInfo, acidSchemaFiles, false, parsedDeltas, readerTypes, ugi, allowSyntheticFileIds);
if (splitStrategy != null) {
splitStrategies.add(splitStrategy);
}
}
return splitStrategies;
}
use of com.google.common.annotations.VisibleForTesting in project buck by facebook.
the class CxxErrorTransformerFactory method transformLine.
@VisibleForTesting
String transformLine(String line) {
for (Pattern pattern : PATH_PATTERNS) {
Matcher m = pattern.matcher(line);
if (m.find()) {
StringBuilder builder = new StringBuilder();
String prefix = m.group("prefix");
if (prefix != null) {
builder.append(prefix);
}
builder.append(transformPath(m.group("path")));
String suffix = m.group("suffix");
if (suffix != null) {
builder.append(suffix);
}
return m.replaceAll(Matcher.quoteReplacement(builder.toString()));
}
}
return line;
}
use of com.google.common.annotations.VisibleForTesting in project buck by facebook.
the class AbstractCxxSourceRuleFactory method requireCompileBuildRule.
@VisibleForTesting
CxxPreprocessAndCompile requireCompileBuildRule(String name, CxxSource source) {
BuildTarget target = createCompileBuildTarget(name);
Optional<CxxPreprocessAndCompile> existingRule = getResolver().getRuleOptionalWithType(target, CxxPreprocessAndCompile.class);
if (existingRule.isPresent()) {
if (!existingRule.get().getInput().equals(source.getPath())) {
throw new RuntimeException(String.format("Hash collision for %s; a build rule would have been ignored.", name));
}
return existingRule.get();
}
return createCompileBuildRule(name, source);
}
use of com.google.common.annotations.VisibleForTesting in project buck by facebook.
the class AbstractCxxSourceRuleFactory method createCompileBuildRule.
/**
* @return a {@link CxxPreprocessAndCompile} rule that preprocesses, compiles, and assembles the
* given {@link CxxSource}.
*/
@VisibleForTesting
public CxxPreprocessAndCompile createCompileBuildRule(String name, CxxSource source) {
Preconditions.checkArgument(CxxSourceTypes.isCompilableType(source.getType()));
BuildTarget target = createCompileBuildTarget(name);
DepsBuilder depsBuilder = new DepsBuilder(getRuleFinder());
Compiler compiler = CxxSourceTypes.getCompiler(getCxxPlatform(), source.getType()).resolve(getResolver());
// Build up the list of compiler flags.
CxxToolFlags flags = CxxToolFlags.explicitBuilder().addAllPlatformFlags(getPicType().getFlags(compiler)).addAllPlatformFlags(getPlatformCompileFlags(source.getType())).addAllRuleFlags(getRuleCompileFlags(source.getType())).addAllRuleFlags(source.getFlags()).build();
CompilerDelegate compilerDelegate = new CompilerDelegate(getPathResolver(), getCxxPlatform().getCompilerDebugPathSanitizer(), compiler, flags);
depsBuilder.add(compilerDelegate);
depsBuilder.add(source);
// Build the CxxCompile rule and add it to our sorted set of build rules.
CxxPreprocessAndCompile result = CxxPreprocessAndCompile.compile(getParams().withBuildTarget(target).copyReplacingDeclaredAndExtraDeps(Suppliers.ofInstance(depsBuilder.build()), Suppliers.ofInstance(ImmutableSortedSet.of())), compilerDelegate, getCompileOutputPath(target, name), source.getPath(), source.getType(), getCxxPlatform().getCompilerDebugPathSanitizer(), getCxxPlatform().getAssemblerDebugPathSanitizer(), getSandboxTree());
getResolver().addToIndex(result);
return result;
}
Aggregations