Skip to content

Commit

Permalink
Code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
“v_kkhuang” committed Oct 29, 2024
1 parent b5bada7 commit 21210f7
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ import org.apache.linkis.storage.domain.{Column, DataType}
import org.apache.linkis.storage.resultset.ResultSetFactory
import org.apache.linkis.storage.resultset.table.{TableMetaData, TableRecord}

import org.apache.commons.collections.MapUtils
import org.apache.commons.lang3.StringUtils
import org.apache.hadoop.hive.common.HiveInterruptUtils
import org.apache.hadoop.hive.conf.HiveConf
Expand Down Expand Up @@ -139,7 +140,8 @@ class HiveEngineConnExecutor(
engineExecutorContext: EngineExecutionContext,
code: String
): ExecuteResponse = {
readResByObject = engineExecutorContext.getProperties.getOrDefault(
readResByObject = MapUtils.getBoolean(
engineExecutorContext.getProperties,
JobRequestConstants.LINKIS_HIVE_EC_READ_RESULT_BY_OBJECT,
false
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ public static void encryptPasswordKey(
Object password = connectParams.get(keyDefinition.getKey());
if (null != password) {
String passwordStr = String.valueOf(password);
if (AESUtils.LINKIS_DATASOURCE_AES_SWITCH.getValue()) {
if (AESUtils.LINKIS_DATASOURCE_AES_SWITCH.getValue()
&& !connectParams.containsKey("isEncrypt")) {
passwordStr =
AESUtils.encrypt(passwordStr, AESUtils.LINKIS_DATASOURCE_AES_KEY.getValue());
connectParams.put("isEncrypt", "1");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
package org.apache.linkis.metadata.query.service;

import org.apache.linkis.common.conf.CommonVars;
import org.apache.linkis.common.utils.AESUtils;
import org.apache.linkis.metadata.query.common.domain.MetaColumnInfo;

import java.io.Closeable;
Expand Down Expand Up @@ -73,7 +74,9 @@ public MongoDbConnection(
String database,
Map<String, Object> extraParams)
throws ClassNotFoundException, Exception {
connectMessage = new ConnectMessage(host, port, username, password, database, extraParams);
connectMessage =
new ConnectMessage(
host, port, username, AESUtils.isDecryptByConf(password), database, extraParams);
conn = getDBConnection(connectMessage, database);
}

Expand Down

0 comments on commit 21210f7

Please sign in to comment.