Skip to content
Permalink
Browse files
[NO ISSUE][BAD] format source to code convention
Change-Id: Id7a04d3d66d9bec5aa91568e1001a1855c73f4ab
  • Loading branch information
mblow committed Mar 23, 2019
1 parent bad4142 commit 385dd62c9255f205db15d1770df1796e07599bc1
Showing 12 changed files with 53 additions and 44 deletions.
@@ -27,7 +27,6 @@
<properties>
<asterix.version>0.9.5-SNAPSHOT</asterix.version>
<hyracks.version>0.3.5-SNAPSHOT</hyracks.version>
<source-format.skip>true</source-format.skip>
<testLog4jConfigFile>${root.dir}/../../asterix-app/src/test/resources/log4j2-test.xml</testLog4jConfigFile>
</properties>
<build>
@@ -117,6 +116,21 @@
</ignoredUnusedDeclaredDependencies>
</configuration>
</plugin>
<plugin>
<groupId>net.revelc.code.formatter</groupId>
<artifactId>formatter-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>${source-format.goal}</goal>
</goals>
</execution>
</executions>
<configuration>
<configFile>../../../hyracks-fullstack/AsterixCodeFormatProfile.xml</configFile>
<skipFormatting>${source-format.skip}</skipFormatting>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
@@ -210,8 +210,7 @@ public static void redeployJobSpec(EntityId entityId, String queryBodyString, Me
ICcApplicationContext appCtx = metadataProvider.getApplicationContext();
ActiveNotificationHandler activeEventHandler =
(ActiveNotificationHandler) appCtx.getActiveNotificationHandler();
DeployedJobSpecEventListener listener =
(DeployedJobSpecEventListener) activeEventHandler.getListener(entityId);
DeployedJobSpecEventListener listener = (DeployedJobSpecEventListener) activeEventHandler.getListener(entityId);
if (listener == null) {
LOGGER.severe("Tried to redeploy the job for " + entityId + " but no listener exists.");
return;
@@ -67,7 +67,6 @@ public ExtensionKind getExtensionKind() {
return ExtensionKind.LANG;
}


public static Broker getBroker(MetadataTransactionContext mdTxnCtx, String dataverseName, String brokerName)
throws AlgebricksException {
BrokerSearchKey brokerSearchKey = new BrokerSearchKey(dataverseName, brokerName);
@@ -27,8 +27,8 @@

public class BADQueryTranslatorExtension implements IStatementExecutorExtension {

public static final ExtensionId BAD_QUERY_TRANSLATOR_EXTENSION_ID = new ExtensionId(
BADQueryTranslatorExtension.class.getSimpleName(), 0);
public static final ExtensionId BAD_QUERY_TRANSLATOR_EXTENSION_ID =
new ExtensionId(BADQueryTranslatorExtension.class.getSimpleName(), 0);

private static class LazyHolder {
private static final IStatementExecutorFactory INSTANCE = new BADQueryTranslatorFactory();
@@ -96,8 +96,7 @@ private Procedure createProcedureFromARecord(ARecord procedureRecord) {
}

String returnType = ((AString) procedureRecord
.getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_TYPE_FIELD_INDEX))
.getStringValue();
.getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_TYPE_FIELD_INDEX)).getStringValue();

String definition = ((AString) procedureRecord
.getValueByPos(BADMetadataRecordTypes.PROCEDURE_ARECORD_PROCEDURE_DEFINITION_FIELD_INDEX))
@@ -118,19 +118,19 @@ private void deployJobs(ICcApplicationContext appCtx, List<Channel> channels, Li
for (Channel channel : channels) {
EntityId entityId = channel.getChannelId();
metadataProvider = new MetadataProvider(appCtx, MetadataBuiltinEntities.DEFAULT_DATAVERSE);
DeployedJobSpecEventListener listener = new DeployedJobSpecEventListener(appCtx, entityId,
channel.getResultsDatasetName().equals("") ? PrecompiledType.PUSH_CHANNEL
: PrecompiledType.CHANNEL);
DeployedJobSpecEventListener listener =
new DeployedJobSpecEventListener(appCtx, entityId, channel.getResultsDatasetName().equals("")
? PrecompiledType.PUSH_CHANNEL : PrecompiledType.CHANNEL);
listener.suspend();
activeEventHandler.registerListener(listener);
RequestReference requestReference =
RequestReference.of(UUID.randomUUID().toString(), "CC", System.currentTimeMillis());
BADJobService.redeployJobSpec(entityId, channel.getChannelBody(), metadataProvider, badStatementExecutor,
hcc, new RequestParameters(requestReference, null, null, null, null, null, null, null, null, true), true);
hcc, new RequestParameters(requestReference, null, null, null, null, null, null, null, null, true),
true);

ScheduledExecutorService ses = BADJobService.startRepetitiveDeployedJobSpec(listener.getDeployedJobSpecId(),
hcc,
BADJobService.findPeriod(channel.getDuration()), new HashMap<>(), entityId,
hcc, BADJobService.findPeriod(channel.getDuration()), new HashMap<>(), entityId,
metadataProvider.getTxnIdFactory(), listener);
listener.setExecutorService(ses);
metadataProvider.getLocks().unlock();
@@ -151,12 +151,14 @@ private void deployJobs(ICcApplicationContext appCtx, List<Channel> channels, Li
RequestReference requestReference =
RequestReference.of(UUID.randomUUID().toString(), "CC", System.currentTimeMillis());
BADJobService.redeployJobSpec(entityId, procedure.getBody(), metadataProvider, badStatementExecutor, hcc,
new RequestParameters(requestReference, null, new ResultSet(hcc,
appCtx.getServiceContext().getControllerService().getNetworkSecurityManager()
.getSocketChannelFactory(), appCtx.getCompilerProperties().getFrameSize(),
ResultReader.NUM_READERS),
new RequestParameters(requestReference, null,
new ResultSet(hcc,
appCtx.getServiceContext().getControllerService().getNetworkSecurityManager()
.getSocketChannelFactory(),
appCtx.getCompilerProperties().getFrameSize(), ResultReader.NUM_READERS),
new ResultProperties(IStatementExecutor.ResultDelivery.IMMEDIATE),
new IStatementExecutor.Stats(), null, null, null, null, true), true);
new IStatementExecutor.Stats(), null, null, null, null, true),
true);
metadataProvider.getLocks().unlock();
//Log that the procedure stopped by cluster restart. Procedure is available again now.
LOGGER.log(Level.SEVERE, entityId.getExtensionName() + " " + entityId.getDataverse() + "."
@@ -166,7 +166,6 @@ public boolean rewritePost(Mutable<ILogicalOperator> opRef, IOptimizationContext
badProject.getVariables().add(channelExecutionVar);
context.computeAndSetTypeEnvironmentForOperator(badProject);


//Create my brokerNotify plan above the extension Operator
DelegateOperator dOp = push
? createNotifyBrokerPushPlan(brokerEndpointVar, badProject.getVariables().get(0), channelExecutionVar,
@@ -202,8 +201,8 @@ private DelegateOperator createNotifyBrokerPushPlan(LogicalVariable brokerEndpoi
}

//Create the NotifyBrokerOperator
DelegateOperator extensionOp = createBrokerOp(brokerEndpointVar, sendVar, channelExecutionVar, channelDataverse,
channelName, true);
DelegateOperator extensionOp =
createBrokerOp(brokerEndpointVar, sendVar, channelExecutionVar, channelDataverse, channelName, true);

extensionOp.getInputs().add(new MutableObject<>(eOp));
context.computeAndSetTypeEnvironmentForOperator(extensionOp);
@@ -212,18 +211,17 @@ private DelegateOperator createNotifyBrokerPushPlan(LogicalVariable brokerEndpoi

}

private DelegateOperator createNotifyBrokerPullPlan(LogicalVariable brokerEndpointVar,
LogicalVariable sendVar, LogicalVariable channelExecutionVar, IOptimizationContext context,
ILogicalOperator eOp, DistributeResultOperator distributeOp, String channelDataverse, String channelName)
throws AlgebricksException {
private DelegateOperator createNotifyBrokerPullPlan(LogicalVariable brokerEndpointVar, LogicalVariable sendVar,
LogicalVariable channelExecutionVar, IOptimizationContext context, ILogicalOperator eOp,
DistributeResultOperator distributeOp, String channelDataverse, String channelName)
throws AlgebricksException {

//Create the Distinct Op
ArrayList<Mutable<ILogicalExpression>> expressions = new ArrayList<>();
VariableReferenceExpression vExpr = new VariableReferenceExpression(sendVar);
expressions.add(new MutableObject<>(vExpr));
DistinctOperator distinctOp = new DistinctOperator(expressions);


List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByList = new ArrayList<>();
List<Pair<LogicalVariable, Mutable<ILogicalExpression>>> groupByDecorList = new ArrayList<>();
List<ILogicalPlan> nestedPlans = new ArrayList<>();
@@ -252,7 +250,6 @@ private DelegateOperator createNotifyBrokerPullPlan(LogicalVariable brokerEndpoi
//add nested plans
nestedPlans.add(new ALogicalPlanImpl(new MutableObject<>(listifyOp)));


//Create the NotifyBrokerOperator
DelegateOperator extensionOp = createBrokerOp(brokerEndpointVar, sendListVar, channelExecutionVar,
channelDataverse, channelName, false);
@@ -318,8 +315,8 @@ private AbstractLogicalOperator findOp(AbstractLogicalOperator op, String lookin
if (isBrokerScan((AbstractLogicalOperator) subOp.getValue())) {
return op;
} else {
AbstractLogicalOperator nestedOp = findOp((AbstractLogicalOperator) subOp.getValue(),
lookingForString);
AbstractLogicalOperator nestedOp =
findOp((AbstractLogicalOperator) subOp.getValue(), lookingForString);
if (nestedOp != null) {
return nestedOp;
}
@@ -329,8 +326,8 @@ private AbstractLogicalOperator findOp(AbstractLogicalOperator op, String lookin
if (subOp.getValue().getOperatorTag() == LogicalOperatorTag.PROJECT) {
return (AbstractLogicalOperator) subOp.getValue();
} else {
AbstractLogicalOperator nestedOp = findOp((AbstractLogicalOperator) subOp.getValue(),
lookingForString);
AbstractLogicalOperator nestedOp =
findOp((AbstractLogicalOperator) subOp.getValue(), lookingForString);
if (nestedOp != null) {
return nestedOp;
}
@@ -341,8 +338,8 @@ private AbstractLogicalOperator findOp(AbstractLogicalOperator op, String lookin
if (isSubscriptionsScan((AbstractLogicalOperator) subOp.getValue(), lookingForString)) {
return (AbstractLogicalOperator) subOp.getValue();
} else {
AbstractLogicalOperator nestedOp = findOp((AbstractLogicalOperator) subOp.getValue(),
lookingForString);
AbstractLogicalOperator nestedOp =
findOp((AbstractLogicalOperator) subOp.getValue(), lookingForString);
if (nestedOp != null) {
return nestedOp;
}
@@ -74,7 +74,7 @@ public void computeDeliveredProperties(ILogicalOperator op, IOptimizationContext
@Override
public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext context, ILogicalOperator op,
IOperatorSchema propagatedSchema, IOperatorSchema[] inputSchemas, IOperatorSchema outerPlanSchema)
throws AlgebricksException {
throws AlgebricksException {
DelegateOperator notify = (DelegateOperator) op;
LogicalVariable pushListVar = ((NotifyBrokerOperator) notify.getDelegate()).getPushListVar();
LogicalVariable brokerVar = ((NotifyBrokerOperator) notify.getDelegate()).getBrokerEndpointVariable();
@@ -96,8 +96,8 @@ public void contributeRuntimeOperator(IHyracksJobBuilder builder, JobGenContext
NotifyBrokerRuntimeFactory runtime = new NotifyBrokerRuntimeFactory(brokerEvalFactory, pushListEvalFactory,
channelExecutionEvalFactory, entityId, push, recordType);

RecordDescriptor recDesc = JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema,
context);
RecordDescriptor recDesc =
JobGenHelper.mkRecordDescriptor(context.getTypeEnvironment(op), propagatedSchema, context);

builder.contributeMicroOperator(op, runtime, recDesc);

@@ -206,8 +206,7 @@ public void nextFrame(ByteBuffer buffer) throws HyracksDataException {
sendStreams.get(endpoint).append(',');
}
subscriptionIdListPrinterFactory.print(inputArg1.getByteArray(), inputArg1.getStartOffset(),
inputArg1.getLength(),
sendStreams.get(endpoint));
inputArg1.getLength(), sendStreams.get(endpoint));
}
firstResult = false;
}
@@ -47,8 +47,8 @@ public class BADExecutionTest {
protected static final Logger LOGGER = Logger.getLogger(BADExecutionTest.class.getName());

protected static final String PATH_ACTUAL = "target/rttest" + File.separator;
protected static final String PATH_BASE = StringUtils.join(new String[] { "src", "test", "resources", "runtimets" },
File.separator);
protected static final String PATH_BASE =
StringUtils.join(new String[] { "src", "test", "resources", "runtimets" }, File.separator);

protected static final String TEST_CONFIG_FILE_NAME = "src/main/resources/cc.conf";

@@ -64,7 +64,8 @@ public class BADExecutionTest {
public static void setUp() throws Exception {
File outdir = new File(PATH_ACTUAL);
outdir.mkdirs();
ExecutionTestUtil.setUp(cleanupOnStart, TEST_CONFIG_FILE_NAME, new AsterixHyracksIntegrationUtil(), false, null);
ExecutionTestUtil.setUp(cleanupOnStart, TEST_CONFIG_FILE_NAME, new AsterixHyracksIntegrationUtil(), false,
null);
}

@AfterClass
@@ -43,7 +43,7 @@ public static void setUp() throws Exception {
extensionLangCompilationProvider = new BADCompilationProvider();
statementExecutorFactory = new BADQueryTranslatorFactory();

integrationUtil.init(true,TEST_CONFIG_FILE_NAME);
integrationUtil.init(true, TEST_CONFIG_FILE_NAME);
// Set the node resolver to be the identity resolver that expects node names
// to be node controller ids; a valid assumption in test environment.
System.setProperty(ExternalDataConstants.NODE_RESOLVER_FACTORY_PROPERTY,
@@ -128,7 +128,6 @@ public BADRecoveryTest(TestCaseContext tcCtx) {
this.tcCtx = tcCtx;
}


@Test
public void test() throws Exception {
testExecutor.executeTest(PATH_ACTUAL, tcCtx, pb, false);

0 comments on commit 385dd62

Please sign in to comment.