forked from opensearch-project/opensearch-spark
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove non relevant tests from this PR
Signed-off-by: YANGDB <[email protected]>
- Loading branch information
Showing
1 changed file
with
1 addition
and
43 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,49 +35,7 @@ class FlintSparkPPLGrokITSuite | |
job.awaitTermination() | ||
} | ||
} | ||
|
||
test("test grok hostname | head ") { | ||
val frame = sql(s""" | ||
| source = $testTable| grok email '.+@%{HOSTNAME:host}'| sort host | head 5 | ||
| """.stripMargin) | ||
|
||
// Retrieve the results | ||
val results: Array[Row] = frame.collect() | ||
// Define the expected results | ||
val expectedResults: Array[Row] = Array( | ||
Row("[email protected]", "anotherdomain.com"), | ||
Row("[email protected]", "demo.net"), | ||
Row("[email protected]", "demonstration.com"), | ||
Row("[email protected]", "domain.net"), | ||
Row("[email protected]", "example.com")) | ||
|
||
// Compare the results | ||
implicit val rowOrdering: Ordering[Row] = Ordering.by[Row, String](_.getAs[String](0)) | ||
assert(results.sorted.sameElements(expectedResults.sorted)) | ||
|
||
// Retrieve the logical plan | ||
val logicalPlan: LogicalPlan = frame.queryExecution.logical | ||
|
||
val emailAttribute = UnresolvedAttribute("email") | ||
val hostExpression = Alias( | ||
RegExpExtract( | ||
emailAttribute, | ||
Literal( | ||
".+@(?<name0>\\b(?:[0-9A-Za-z][0-9A-Za-z-]{0,62})(?:\\.(?:[0-9A-Za-z][0-9A-Za-z-]{0,62}))*(\\.?|\\b))"), | ||
Literal("1")), | ||
"host")() | ||
val expectedPlan = Project( | ||
Seq(UnresolvedStar(None)), | ||
GlobalLimit( | ||
Literal(1000), | ||
LocalLimit( | ||
Literal(1000), | ||
Project( | ||
Seq(emailAttribute, hostExpression, UnresolvedStar(None)), | ||
UnresolvedRelation(Seq("accounts")))))) | ||
assert(compareByString(expectedPlan) === compareByString(logicalPlan)) | ||
} | ||
|
||
|
||
test("test grok email expressions parsing") { | ||
val frame = sql(s""" | ||
| source = $testTable| grok email '.+@%{HOSTNAME:host}' | fields email, host | ||
|