From 4efb0979b586da04d53735696db33298a6024eb3 Mon Sep 17 00:00:00 2001 From: Sean Kao Date: Thu, 12 Dec 2024 03:38:30 -0800 Subject: [PATCH] syntax and comment Signed-off-by: Sean Kao --- .../FlintOpenSearchMetadataCacheWriter.scala | 4 ++++ ...FlintOpenSearchMetadataCacheWriterITSuite.scala | 14 +++++++------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriter.scala b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriter.scala index f5346ca67..b14f99cc7 100644 --- a/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriter.scala +++ b/flint-spark-integration/src/main/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriter.scala @@ -60,6 +60,10 @@ class FlintOpenSearchMetadataCacheWriter(options: FlintOptions) response.getMappings.get(osIndexName).sourceAsMap() } + /** + * Merge existing mapping with metadata cache properties. Metadata cache is written into + * _meta.properties field of index mapping. + */ private def mergeMapping( existingMapping: JMap[String, AnyRef], metadataCacheProperties: JMap[String, AnyRef]): JMap[String, AnyRef] = { diff --git a/integ-test/src/integration/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriterITSuite.scala b/integ-test/src/integration/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriterITSuite.scala index 1a3d2df7d..692a0c2ff 100644 --- a/integ-test/src/integration/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriterITSuite.scala +++ b/integ-test/src/integration/scala/org/opensearch/flint/spark/metadatacache/FlintOpenSearchMetadataCacheWriterITSuite.scala @@ -284,7 +284,7 @@ class FlintOpenSearchMetadataCacheWriterITSuite extends FlintSparkSuite with Mat flintClient.createIndex(testFlintIndex, metadata) // Simulates index mapping updated by custom implementation of FlintIndexMetadataService - // because our standard FlintOpenSearchIndexMetadataService ignores the "custom" field. + // with the extra "custom" field. val client = OpenSearchClientUtils.createClient(options) flintMetadataCacheWriter.updateIndexMapping(client, testFlintIndex, content) @@ -396,12 +396,12 @@ class FlintOpenSearchMetadataCacheWriterITSuite extends FlintSparkSuite with Mat val propertiesJson = compact(render(getPropertiesJValue(testFlintIndex))) propertiesJson should matchJson(s""" - | { - | "metadataCacheVersion": "${FlintMetadataCache.metadataCacheVersion}", - | "refreshInterval": 600, - | "sourceTables": ["$testTable"] - | } - |""".stripMargin) + | { + | "metadataCacheVersion": "${FlintMetadataCache.metadataCacheVersion}", + | "refreshInterval": 600, + | "sourceTables": ["$testTable"] + | } + |""".stripMargin) flint.refreshIndex(testFlintIndex) compact(render(getPropertiesJValue(testFlintIndex))) should not include "lastRefreshTime"