This is an automated email from the ASF dual-hosted git repository.
eldenmoon pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-2.0 by this push:
new cd71cc034db [Fix](Prepared Statment) use fixed charset to init
StringLiteral (#37085)
cd71cc034db is described below
commit cd71cc034db368f44b1bf1d447ec0240b520b708
Author: lihangyu <[email protected]>
AuthorDate: Wed Jul 3 23:03:00 2024 +0800
[Fix](Prepared Statment) use fixed charset to init StringLiteral (#37085)
picked from #36860
---
.../src/main/java/org/apache/doris/analysis/StringLiteral.java | 5 ++++-
fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java | 4 +++-
2 files changed, 7 insertions(+), 2 deletions(-)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
index 67cf82cc1a0..542c668459a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/analysis/StringLiteral.java
@@ -40,6 +40,7 @@ import java.io.IOException;
import java.io.UnsupportedEncodingException;
import java.math.BigDecimal;
import java.nio.ByteBuffer;
+import java.nio.charset.StandardCharsets;
import java.util.Objects;
public class StringLiteral extends LiteralExpr {
@@ -310,7 +311,9 @@ public class StringLiteral extends LiteralExpr {
}
byte[] bytes = new byte[strLen];
data.get(bytes);
- value = new String(bytes);
+ // ATTN: use fixed StandardCharsets.UTF_8 to avoid unexpected charset
in
+ // different environment
+ value = new String(bytes, StandardCharsets.UTF_8);
if (LOG.isDebugEnabled()) {
LOG.debug("parsed value '{}'", value);
}
diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
index e608b68684b..ba4fbfa1fca 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/qe/ConnectProcessor.java
@@ -214,7 +214,9 @@ public class ConnectProcessor {
// process COM_EXECUTE, parse binary row data
//
https://dev.mysql.com/doc/dev/mysql-server/latest/page_protocol_com_stmt_execute.html
private void handleExecute() {
- // debugPacket();
+ if (LOG.isDebugEnabled()) {
+ debugPacket();
+ }
packetBuf = packetBuf.order(ByteOrder.LITTLE_ENDIAN);
// parse stmt_id, flags, params
int stmtId = packetBuf.getInt();
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]