Skip to content

Commit

Permalink
Merge pull request #16 from StrongestNumber9/fix_tests
Browse files Browse the repository at this point in the history
Fix for EvalTest, fixes javadocs too
  • Loading branch information
StrongestNumber9 authored Jun 8, 2023
2 parents 1eac746 + 0fe9fb1 commit f8937fe
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ public Node visitT_eventstats_byInstruction(DPLParser.T_eventstats_byInstruction
}

/**
* Doesn't seem to get used, goes through aggregationInstruction->fieldRenameInstruction
* Doesn't seem to get used, goes through aggregationInstruction->fieldRenameInstruction
* @param ctx
* @return
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@
* <pre>spath input=... output=... path=...|...</pre>
* Defaults:
* <pre>spath input=_raw output=path path=...</pre>
* Path omitted -> auto-extract mode: extracts all fields from the first 5000 characters in
* Path omitted -&gt; auto-extract mode: extracts all fields from the first 5000 characters in
* the input field.
*/
public class SpathTransformation extends DPLParserBaseVisitor<Node>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,13 +63,13 @@
* Command examples:<br>
* Original data: "data"
* <hr>
* <code>(1) REPLACE "data" WITH "y" -> result: "y"</code>
* <code>(1) REPLACE "data" WITH "y" -&gt; result: "y"</code>
* <hr>
* <code>(2) REPLACE "dat*" WITH "y" -> result: "y"</code>
* <code>(2) REPLACE "dat*" WITH "y" -&gt; result: "y"</code>
* <hr>
* <code>(3) REPLACE "dat*" WITH "y*" -> result: "ya"</code>
* <code>(3) REPLACE "dat*" WITH "y*" -&gt; result: "ya"</code>
* <hr>
* <code>(4) REPLACE "*at*" WITH "*y*" -> result: "dya"</code>
* <code>(4) REPLACE "*at*" WITH "*y*" -&gt; result: "dya"</code>
*/
public class ReplaceCmd implements UDF3<String, String, String, String> {
private static final Logger LOGGER = LoggerFactory.getLogger(ReplaceCmd.class);
Expand Down
13 changes: 13 additions & 0 deletions src/test/java/com/teragrep/pth10/translationTests/EvalTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@
import org.antlr.v4.runtime.CharStreams;
import org.antlr.v4.runtime.CommonTokenStream;
import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.spark.sql.SparkSession;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.TestInstance;

Expand All @@ -68,6 +69,18 @@

@TestInstance(TestInstance.Lifecycle.PER_CLASS)
public class EvalTest {
SparkSession spark = null;
DPLParserCatalystContext ctx = null;
@org.junit.jupiter.api.BeforeAll
void setEnv() {
spark = SparkSession
.builder()
.appName("Java Spark SQL basic example")
.master("local[2]")
.getOrCreate();
spark.sparkContext().setLogLevel("ERROR");
ctx = new DPLParserCatalystContext(spark);
}
@Test
void testEvalTranslation() throws Exception {
final String query = "| eval a = abs(-3)";
Expand Down

0 comments on commit f8937fe

Please sign in to comment.