-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* add sourceTables to MV index metadata properties * parse source tables from mv query * test cases for parse source tables from mv query * use constant for metadata cache version * write source tables to metadata cache * address comment * generate source tables for old mv without new prop * syntax fix --------- (cherry picked from commit 950009b) Signed-off-by: Sean Kao <[email protected]> Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com> Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
- Loading branch information
1 parent
c190f01
commit 4f0542b
Showing
11 changed files
with
369 additions
and
97 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
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
50 changes: 50 additions & 0 deletions
50
...k-integration/src/test/scala/org/opensearch/flint/spark/FlintSparkIndexFactorySuite.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,50 @@ | ||
/* | ||
* Copyright OpenSearch Contributors | ||
* SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
package org.opensearch.flint.spark | ||
|
||
import org.opensearch.flint.core.storage.FlintOpenSearchIndexMetadataService | ||
import org.opensearch.flint.spark.mv.FlintSparkMaterializedView | ||
import org.opensearch.flint.spark.mv.FlintSparkMaterializedView.MV_INDEX_TYPE | ||
import org.scalatest.matchers.should.Matchers._ | ||
|
||
import org.apache.spark.FlintSuite | ||
|
||
class FlintSparkIndexFactorySuite extends FlintSuite { | ||
|
||
test("create mv should generate source tables if missing in metadata") { | ||
val testTable = "spark_catalog.default.mv_build_test" | ||
val testMvName = "spark_catalog.default.mv" | ||
val testQuery = s"SELECT * FROM $testTable" | ||
|
||
val content = | ||
s""" { | ||
| "_meta": { | ||
| "kind": "$MV_INDEX_TYPE", | ||
| "indexedColumns": [ | ||
| { | ||
| "columnType": "int", | ||
| "columnName": "age" | ||
| } | ||
| ], | ||
| "name": "$testMvName", | ||
| "source": "$testQuery" | ||
| }, | ||
| "properties": { | ||
| "age": { | ||
| "type": "integer" | ||
| } | ||
| } | ||
| } | ||
|""".stripMargin | ||
|
||
val metadata = FlintOpenSearchIndexMetadataService.deserialize(content) | ||
val index = FlintSparkIndexFactory.create(spark, metadata) | ||
index shouldBe defined | ||
index.get | ||
.asInstanceOf[FlintSparkMaterializedView] | ||
.sourceTables should contain theSameElementsAs Array(testTable) | ||
} | ||
} |
Oops, something went wrong.