Skip to content

Commit

Permalink
run scalafmtAll
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Kao <[email protected]>
  • Loading branch information
seankao-az committed Mar 11, 2024
1 parent 67a5818 commit 0d76522
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,14 @@ trait FlintSparkIndexAstBuilder extends FlintSparkSqlExtensionsVisitor[AnyRef] {
case None => "unavailable"
}

Row(index.name, index.kind, databaseName, tableName, indexName, index.options.autoRefresh(), status)
Row(
index.name,
index.kind,
databaseName,
tableName,
indexName,
index.options.autoRefresh(),
status)
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -56,15 +56,18 @@ class FlintTransactionITSuite extends OpenSearchTransactionSuite with Matchers {
dataSource = testDataSourceName,
error = ""))

val latest = flintClient.getIndexMetadataLatestLogEntry(testFlintIndex, testDataSourceName).get
val latest =
flintClient.getIndexMetadataLatestLogEntry(testFlintIndex, testDataSourceName).get
latest.id shouldBe testLatestId
latest.createTime shouldBe testCreateTime
latest.dataSource shouldBe testDataSourceName
latest.error shouldBe ""
}

test("should get empty if no metadata log entry for index") {
flintClient.getIndexMetadataLatestLogEntry(testFlintIndex, testDataSourceName).isEmpty shouldBe true
flintClient
.getIndexMetadataLatestLogEntry(testFlintIndex, testDataSourceName)
.isEmpty shouldBe true
}

test("should preserve original values when transition") {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,10 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite {
private val testMvIndexShortName = "mv1"
private val testMvQuery = s"SELECT name, age FROM $testTableQualifiedName"

private val testSkippingFlintIndex = FlintSparkSkippingIndex.getSkippingIndexName(testTableQualifiedName)
private val testCoveringFlintIndex = FlintSparkCoveringIndex.getFlintIndexName(testCoveringIndex, testTableQualifiedName)
private val testSkippingFlintIndex =
FlintSparkSkippingIndex.getSkippingIndexName(testTableQualifiedName)
private val testCoveringFlintIndex =
FlintSparkCoveringIndex.getFlintIndexName(testCoveringIndex, testTableQualifiedName)
private val testMvIndex = s"spark_catalog.default.$testMvIndexShortName"
private val testMvFlintIndex = FlintSparkMaterializedView.getFlintIndexName(testMvIndex)

Expand Down Expand Up @@ -51,10 +53,19 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite {
.addValueSet("name")
.create()

checkAnswer(sql(s"SHOW FLINT INDEX IN spark_catalog"), Seq(
Row(testMvFlintIndex, "mv", "default", null, testMvIndexShortName, false, "active"),
Row(testCoveringFlintIndex, "covering", "default", testTableName, testCoveringIndex, false, "active"),
Row(testSkippingFlintIndex, "skipping", "default", testTableName, null, false, "active")))
checkAnswer(
sql(s"SHOW FLINT INDEX IN spark_catalog"),
Seq(
Row(testMvFlintIndex, "mv", "default", null, testMvIndexShortName, false, "active"),
Row(
testCoveringFlintIndex,
"covering",
"default",
testTableName,
testCoveringIndex,
false,
"active"),
Row(testSkippingFlintIndex, "skipping", "default", testTableName, null, false, "active")))

// Show in catalog.database
flint
Expand All @@ -63,11 +74,27 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite {
.query(testMvQuery)
.create()

checkAnswer(sql(s"SHOW FLINT INDEX IN spark_catalog"), Seq(
Row(testMvFlintIndex, "mv", "default", null, testMvIndexShortName, false, "active"),
Row(testCoveringFlintIndex, "covering", "default", testTableName, testCoveringIndex, false, "active"),
Row(testSkippingFlintIndex, "skipping", "default", testTableName, null, false, "active"),
Row(FlintSparkMaterializedView.getFlintIndexName("spark_catalog.default.mv2"), "mv", "default", null, "mv2", false, "active")))
checkAnswer(
sql(s"SHOW FLINT INDEX IN spark_catalog"),
Seq(
Row(testMvFlintIndex, "mv", "default", null, testMvIndexShortName, false, "active"),
Row(
testCoveringFlintIndex,
"covering",
"default",
testTableName,
testCoveringIndex,
false,
"active"),
Row(testSkippingFlintIndex, "skipping", "default", testTableName, null, false, "active"),
Row(
FlintSparkMaterializedView.getFlintIndexName("spark_catalog.default.mv2"),
"mv",
"default",
null,
"mv2",
false,
"active")))

deleteTestIndex(
testMvFlintIndex,
Expand All @@ -92,6 +119,14 @@ class FlintSparkIndexSqlITSuite extends FlintSparkSuite {

checkAnswer(
sql(s"SHOW FLINT INDEX IN spark_catalog"),
Seq(Row(testCoveringFlintIndex, "covering", "default", testTableName, testCoveringIndex, true, "refreshing")))
Seq(
Row(
testCoveringFlintIndex,
"covering",
"default",
testTableName,
testCoveringIndex,
true,
"refreshing")))
}
}

0 comments on commit 0d76522

Please sign in to comment.