From 8324c4c0ed13e224ef17bce46363383b15632a84 Mon Sep 17 00:00:00 2001 From: currantw Date: Tue, 19 Nov 2024 09:59:30 -0800 Subject: [PATCH] Address minor review comments. Signed-off-by: currantw --- doctest/test_docs.py | 11 ++++++----- .../data/value/OpenSearchExprValueFactory.java | 4 +--- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/doctest/test_docs.py b/doctest/test_docs.py index 30306dce2e..1d46766c6d 100644 --- a/doctest/test_docs.py +++ b/doctest/test_docs.py @@ -1,20 +1,21 @@ # Copyright OpenSearch Contributors # SPDX-License-Identifier: Apache-2.0 -import click import doctest -import json import os import os.path -import random +import zc.customdoctests +import json import re +import random import subprocess import unittest -import zc.customdoctests +import click + from functools import partial -from opensearch_sql_cli.formatter import Formatter from opensearch_sql_cli.opensearch_connection import OpenSearchConnection from opensearch_sql_cli.utils import OutputSettings +from opensearch_sql_cli.formatter import Formatter from opensearchpy import OpenSearch, helpers ENDPOINT = "http://localhost:9200" diff --git a/opensearch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java b/opensearch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java index 9908439886..ab63663f87 100644 --- a/opensearch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java +++ b/opensearch/src/main/java/org/opensearch/sql/opensearch/data/value/OpenSearchExprValueFactory.java @@ -228,9 +228,7 @@ public void extendTypeMapping(Map typeMapping) { for (var field : typeMapping.keySet()) { // Prevent overwriting, because aggregation engine may be not aware // of all niceties of all types. - if (!this.typeMapping.containsKey(field)) { - this.typeMapping.put(field, typeMapping.get(field)); - } + this.typeMapping.putIfAbsent(field, typeMapping.get(field)); } }