morningman commented on code in PR #10565:
URL: https://github.com/apache/doris/pull/10565#discussion_r912821243


##########
fe/fe-core/src/main/java/org/apache/doris/datasource/EsExternalDataSource.java:
##########
@@ -18,42 +18,131 @@
 package org.apache.doris.datasource;
 
 
+import org.apache.doris.common.DdlException;
+import org.apache.doris.external.elasticsearch.EsRestClient;
+import org.apache.doris.external.elasticsearch.EsUtil;
+
 import com.google.common.collect.Lists;
+import org.apache.commons.lang3.StringUtils;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
 
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Map;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.atomic.AtomicLong;
 
 /**
  * External data source for elasticsearch
  */
 public class EsExternalDataSource extends ExternalDataSource {
+
+    private static final Logger LOG = 
LogManager.getLogger(HMSExternalDataSource.class);
+
+    private static final AtomicLong nextId = new AtomicLong(0);
+
+    private static final String PROP_HOSTS = "elasticsearch.hosts";
+    private static final String PROP_USERNAME = "elasticsearch.username";
+    private static final String PROP_PASSWORD = "elasticsearch.password";
+    private static final String PROP_DOC_VALUE_SCAN = 
"elasticsearch.doc_value_scan";
+    private static final String PROP_KEYWORD_SNIFF = 
"elasticsearch.keyword_sniff";
+    private static final String PROP_NODES_DISCOVERY = 
"elasticsearch.nodes_discovery";
+    private static final String PROP_SSL = "elasticsearch.ssl";
+
+    //Cache of db name to db id.
+    private ConcurrentHashMap<String, Long> dbNameToId = new 
ConcurrentHashMap();
+
+    private EsRestClient esRestClient;
+
+    private String[] nodes;
+
+    private String username;
+
+    private String password;
+
+    private boolean enableDocValueScan;
+
+    private boolean enableKeywordSniff;
+
+    private boolean enableSsl;
+
+    private boolean enableNodesDiscovery;
+
     /**
      * Default constructor for EsExternalDataSource.
      */
-    public EsExternalDataSource(String name, Map<String, String> props) {
+    public EsExternalDataSource(String name, Map<String, String> props) throws 
DdlException {
         setName(name);
         getDsProperty().setProperties(props);
         setType("es");
+        validate(props);
+        dbNameToId.put("user", nextId.incrementAndGet());
+        dbNameToId.put("system", nextId.incrementAndGet());

Review Comment:
   the dbId should be global unique id. So we need to use Catalog.getNextId();
   And add comment to explain this 2 databases.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to