Skip to content

Commit

Permalink
Add IT for Flint client
Browse files Browse the repository at this point in the history
Signed-off-by: Chen Dai <[email protected]>
  • Loading branch information
dai-chen committed Oct 4, 2023
1 parent 97bfa70 commit 3580a2c
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 4 deletions.
8 changes: 4 additions & 4 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,8 +225,8 @@ WITH (

OpenSearch index corresponding to the Flint index follows the naming convention below:

1. Skipping index: flint_[catalog_database_table]_skipping_index
2. Covering index: flint_[catalog_database_table]_[index_name]_index
1. Skipping index: `flint_[catalog_database_table]_skipping_index`
2. Covering index: `flint_[catalog_database_table]_[index_name]_index`

It's important to note that any uppercase letters in the index name and table name (catalog, database and table) in SQL statement will be automatically converted to lowercase due to restriction imposed by OpenSearch.

Expand Down Expand Up @@ -413,11 +413,11 @@ Due to the conversion of uppercase letters to lowercase in OpenSearch index name
For instance, only one of the statement per group can be successfully:

```sql
-- my[G]lue vs my[g]lue
-- myGlue vs myglue
CREATE SKIPPING INDEX ON myGlue.default.alb_logs ...
CREATE SKIPPING INDEX ON myglue.default.alb_logs ...

-- [i]dx_elb vs [I]dx_elb
-- idx_elb vs Idx_elb
CREATE INDEX idx_elb ON alb_logs ...
CREATE INDEX Idx_elb ON alb_logs ...
```
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,30 @@ class FlintOpenSearchClientSuite extends AnyFlatSpec with OpenSearchSuite with M
allMetadata.forEach(metadata => metadata.getIndexSettings should not be empty)
}

it should "convert index name to all lowercase" in {
val indexName = "flint_ELB_logs_index"
flintClient.createIndex(
indexName,
new FlintMetadata("""{"properties": {"test": { "type": "integer" } } }"""))

flintClient.exists(indexName) shouldBe true
flintClient.getIndexMetadata(indexName) should not be null
flintClient.getAllIndexMetadata("flint_ELB_*") should not be empty

// Read write test
val writer = flintClient.createWriter(indexName)
writer.write("""{"create":{}}""")
writer.write("\n")
writer.write("""{"test":1}""")
writer.write("\n")
writer.flush()
writer.close()
flintClient.createReader(indexName, "").hasNext shouldBe true

flintClient.deleteIndex(indexName)
flintClient.exists(indexName) shouldBe false
}

it should "return false if index not exist" in {
flintClient.exists("non-exist-index") shouldBe false
}
Expand Down

0 comments on commit 3580a2c

Please sign in to comment.