Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
a428dcb
commit 5836fdb
Showing
35 changed files
with
4,860 additions
and
140 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
27 changes: 27 additions & 0 deletions
27
...s-labyrinth/src/test/scala/org/emmalanguage/examples/ClickCountDiffsIntegrationSpec.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
/* | ||
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de) | ||
* | ||
* Licensed 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.emmalanguage | ||
package examples | ||
|
||
import api._ | ||
|
||
class ClickCountDiffsIntegrationSpec extends BaseClickCountDiffsIntegrationSpec with LabyrinthAware { | ||
|
||
override def clickCountDiffs(baseInName: String, numDays: Int): Unit = | ||
withDefaultFlinkStreamEnv(implicit flink => emma.onLabyrinth { | ||
ClickCountDiffs(baseInName, numDays) | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
93 changes: 93 additions & 0 deletions
93
emma-labyrinth/src/main/java/org/emmalanguage/labyrinth/ElementOrEventTypeInfo.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
/* | ||
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de) | ||
* | ||
* Licensed 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.emmalanguage.labyrinth; | ||
|
||
import org.apache.flink.api.common.ExecutionConfig; | ||
import org.apache.flink.api.common.typeinfo.TypeInformation; | ||
import org.apache.flink.api.common.typeutils.TypeSerializer; | ||
|
||
import java.util.Objects; | ||
|
||
public class ElementOrEventTypeInfo<T> extends TypeInformation<ElementOrEvent<T>> { | ||
|
||
private final TypeInformation<T> elemTypeInfo; | ||
|
||
public ElementOrEventTypeInfo(TypeInformation<T> elemTypeInfo) { | ||
this.elemTypeInfo = elemTypeInfo; | ||
} | ||
|
||
@Override | ||
public boolean isBasicType() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public boolean isTupleType() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public int getArity() { | ||
return 1; | ||
} | ||
|
||
@Override | ||
public int getTotalFields() { | ||
return elemTypeInfo.getTotalFields(); | ||
} | ||
|
||
@Override | ||
public Class<ElementOrEvent<T>> getTypeClass() { | ||
return (Class<ElementOrEvent<T>>)(Class<?>)ElementOrEvent.class; | ||
} | ||
|
||
@Override | ||
public boolean isKeyType() { | ||
return false; | ||
} | ||
|
||
@Override | ||
public TypeSerializer<ElementOrEvent<T>> createSerializer(ExecutionConfig config) { | ||
return new ElementOrEvent.ElementOrEventSerializer<>(elemTypeInfo.createSerializer(config)); | ||
} | ||
|
||
|
||
@Override | ||
public String toString() { | ||
return "ElementOrEventTypeInfo{" + | ||
"elemTypeInfo=" + elemTypeInfo + | ||
'}'; | ||
} | ||
|
||
@Override | ||
public boolean equals(Object o) { | ||
if (this == o) return true; | ||
if (o == null || getClass() != o.getClass()) return false; | ||
ElementOrEventTypeInfo<?> that = (ElementOrEventTypeInfo<?>) o; | ||
return Objects.equals(elemTypeInfo, that.elemTypeInfo); | ||
} | ||
|
||
@Override | ||
public int hashCode() { | ||
return Objects.hash(elemTypeInfo)*2; | ||
} | ||
|
||
@Override | ||
public boolean canEqual(Object obj) { | ||
return obj instanceof ElementOrEventTypeInfo; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
emma-labyrinth/src/main/java/org/emmalanguage/labyrinth/operators/CFAwareTextSource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
/* | ||
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de) | ||
* | ||
* Licensed 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.emmalanguage.labyrinth.operators; | ||
|
||
import org.apache.flink.api.common.io.InputFormat; | ||
import org.apache.flink.api.java.io.TextInputFormat; | ||
import org.apache.flink.core.fs.FileInputSplit; | ||
import org.apache.flink.core.fs.Path; | ||
|
||
public class CFAwareTextSource extends CFAwareFileSourcePara<String, FileInputSplit> { | ||
@Override | ||
protected InputFormat<String, FileInputSplit> getInputFormatFromFilename(String filename) { | ||
return new TextInputFormat(new Path(filename)); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
emma-labyrinth/src/main/java/org/emmalanguage/labyrinth/operators/ConditionNodeScala.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* Copyright © 2014 TU Berlin (emma@dima.tu-berlin.de) | ||
* | ||
* Licensed 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.emmalanguage.labyrinth.operators; | ||
|
||
import org.emmalanguage.labyrinth.util.Unit; | ||
import org.slf4j.Logger; | ||
import org.slf4j.LoggerFactory; | ||
|
||
public class ConditionNodeScala extends SingletonBagOperator<scala.Boolean, Unit> { | ||
|
||
protected static final Logger LOG = LoggerFactory.getLogger(ConditionNodeScala.class); | ||
|
||
private final int[] trueBranchBbIds; | ||
private final int[] falseBranchBbIds; | ||
|
||
public ConditionNodeScala(int trueBranchBbId, int falseBranchBbId) { | ||
this(new int[]{trueBranchBbId}, new int[]{falseBranchBbId}); | ||
} | ||
|
||
public ConditionNodeScala(int[] trueBranchBbIds, int[] falseBranchBbIds) { | ||
this.trueBranchBbIds = trueBranchBbIds; | ||
this.falseBranchBbIds = falseBranchBbIds; | ||
} | ||
|
||
@Override | ||
public void pushInElement(scala.Boolean e, int logicalInputId) { | ||
super.pushInElement(e, logicalInputId); | ||
for (int b: scala.Boolean.unbox(e) ? trueBranchBbIds : falseBranchBbIds) { | ||
out.appendToCfl(b); | ||
} | ||
} | ||
} |
Oops, something went wrong.