Skip to content

Commit

Permalink
IGNITE-14823 Argument abbrevation (#11085)
Browse files Browse the repository at this point in the history
  • Loading branch information
nizhikov authored Dec 11, 2023
1 parent fd5b244 commit 6cffdef
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 20 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -436,19 +436,19 @@ private static boolean representAsInternalType(Type type) {
* Integer directly).
*
* @param targetTypes Formal operand types declared for the function arguments
* @param arguments Input expressions to the function
* @param args Input expressions to the function
* @return Input expressions with probable type conversion
*/
static List<Expression> convertAssignableTypes(Class<?>[] targetTypes,
List<Expression> arguments) {
List<Expression> args) {
final List<Expression> list = new ArrayList<>();
if (targetTypes.length == arguments.size()) {
for (int i = 0; i < arguments.size(); i++)
list.add(convertAssignableType(arguments.get(i), targetTypes[i]));
if (targetTypes.length == args.size()) {
for (int i = 0; i < args.size(); i++)
list.add(convertAssignableType(args.get(i), targetTypes[i]));
}
else {
int j = 0;
for (Expression argument: arguments) {
for (Expression arg: args) {
Class<?> type;
if (!targetTypes[j].isArray()) {
type = targetTypes[j];
Expand All @@ -457,7 +457,7 @@ static List<Expression> convertAssignableTypes(Class<?>[] targetTypes,
else
type = targetTypes[j].getComponentType();

list.add(convertAssignableType(argument, type));
list.add(convertAssignableType(arg, type));
}
}
return list;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2481,9 +2481,9 @@ public static CallImplementor createImplementor(
return (translator, call, nullAs) -> {
final RexImpTable.RexCallImplementor rexCallImplementor
= createRexCallImplementor(implementor, nullPolicy, harmonize);
final List<RexToLixTranslator.Result> arguments = translator.getCallOperandResult(call);
assert arguments != null;
final RexToLixTranslator.Result result = rexCallImplementor.implement(translator, call, arguments);
final List<RexToLixTranslator.Result> args = translator.getCallOperandResult(call);
assert args != null;
final RexToLixTranslator.Result result = rexCallImplementor.implement(translator, call, args);
return nullAs.handle(result.valueVariable);
};
}
Expand Down
3 changes: 2 additions & 1 deletion modules/checkstyle/src/main/resources/abbrevations.csv
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@
address,addr
addresses,addrs
affinity,aff
#argument,arg
argument,arg
arguments,args
array,arr
#attribute,attr
#attributes,attrs
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,8 @@ public CLIArgumentParser(
) {
this.positionalArgCfg = positionalArgConfig;

for (CLIArgument<?> cliArgument : argConfiguration)
this.argConfiguration.put(cliArgument.name(), cliArgument);
for (CLIArgument<?> cliArg : argConfiguration)
this.argConfiguration.put(cliArg.name(), cliArg);
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,12 +714,12 @@ else if (task != null) {
assert taskWorker0 == null : "Session ID is not unique: " + sesId;

if (ctx.event().isRecordable(EVT_MANAGEMENT_TASK_STARTED) && dep.visorManagementTask(task, taskCls)) {
VisorTaskArgument visorTaskArgument = (VisorTaskArgument)arg;
VisorTaskArgument visorTaskArg = (VisorTaskArgument)arg;

Event evt = new TaskEvent(
ctx.discovery().localNode(),
visorTaskArgument != null && visorTaskArgument.getArgument() != null
? visorTaskArgument.getArgument().toString() : "[]",
visorTaskArg != null && visorTaskArg.getArgument() != null
? visorTaskArg.getArgument().toString() : "[]",
EVT_MANAGEMENT_TASK_STARTED,
ses.getId(),
taskCls == null ? null : taskCls.getSimpleName(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,13 @@ public void testInfoAfterClean() throws Exception {
* @return Execution's result.
*/
private PersistenceTaskResult executeInfo(IgniteEx node) {
VisorTaskArgument<PersistenceCommand.PersistenceTaskArg> infoArgument = new VisorTaskArgument<>(
VisorTaskArgument<PersistenceCommand.PersistenceTaskArg> infoArg = new VisorTaskArgument<>(
node.localNode().id(),
new PersistenceCommand.PersistenceInfoTaskArg(),
false
);

return node.compute().execute(new PersistenceTask(), infoArgument);
return node.compute().execute(new PersistenceTask(), infoArg);
}

/**
Expand All @@ -167,12 +167,12 @@ private PersistenceTaskResult executeClean(IgniteEx node) {

arg.caches(new String[]{CACHE_NAME});

VisorTaskArgument<PersistenceCommand.PersistenceTaskArg> cleanArgument = new VisorTaskArgument<>(
VisorTaskArgument<PersistenceCommand.PersistenceTaskArg> cleanArg = new VisorTaskArgument<>(
node.localNode().id(),
arg,
false
);

return node.compute().execute(new PersistenceTask(), cleanArgument);
return node.compute().execute(new PersistenceTask(), cleanArg);
}
}

0 comments on commit 6cffdef

Please sign in to comment.