This is an automated email from the ASF dual-hosted git repository.

wusheng pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/skywalking.git


The following commit(s) were added to refs/heads/master by this push:
     new 1b66915a57 Fix missing AND keyword in 
JDBCEBPFProfilingTaskDAO.getTaskRecord() SQL (#13789)
1b66915a57 is described below

commit 1b66915a579275c086bc37ca9faa1c67bb77b1aa
Author: Hyunjin-Jeong <[email protected]>
AuthorDate: Sat Apr 4 12:03:31 2026 +0900

    Fix missing AND keyword in JDBCEBPFProfilingTaskDAO.getTaskRecord() SQL 
(#13789)
---
 docs/en/changes/changes.md                         |  1 +
 .../jdbc/common/dao/JDBCEBPFProfilingTaskDAO.java  |  2 +-
 .../common/dao/JDBCEBPFProfilingTaskDAOTest.java   | 81 ++++++++++++++++++++++
 3 files changed, 83 insertions(+), 1 deletion(-)

diff --git a/docs/en/changes/changes.md b/docs/en/changes/changes.md
index 5bc21825bf..0918ae388d 100644
--- a/docs/en/changes/changes.md
+++ b/docs/en/changes/changes.md
@@ -9,6 +9,7 @@
 * Remove deprecated `GroupBy.field_name` from BanyanDB `MeasureQuery` request 
building (Phase 1 of staged removal across repos).
 * Push `taskId` filter down to the storage layer in 
`IAsyncProfilerTaskLogQueryDAO`, removing in-memory filtering from 
`AsyncProfilerQueryService`.
 * Fix missing parentheses around OR conditions in 
`JDBCZipkinQueryDAO.getTraces()`, which caused the table filter to be bypassed 
for all but the first trace ID. Replaced with a proper `IN` clause.
+* Fix missing `and` keyword in `JDBCEBPFProfilingTaskDAO.getTaskRecord()` SQL 
query, which caused a syntax error on every invocation.
 
 #### UI
 
diff --git 
a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAO.java
 
b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAO.java
index ab6724480b..1df3aa4131 100644
--- 
a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAO.java
+++ 
b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/main/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAO.java
@@ -126,7 +126,7 @@ public class JDBCEBPFProfilingTaskDAO extends 
JDBCSQLExecutor implements IEBPFPr
         final var tables = 
tableHelper.getTablesWithinTTL(EBPFProfilingTaskRecord.INDEX_NAME);
         for (final var table : tables) {
             String sql = "select * from " + table +
-                " where " + JDBCTableInstaller.TABLE_COLUMN + " = ?" +
+                " where " + JDBCTableInstaller.TABLE_COLUMN + " = ? and " +
                 EBPFProfilingTaskRecord.LOGICAL_ID + " = ?";
 
             results.addAll(jdbcClient.executeQuery(
diff --git 
a/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAOTest.java
 
b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAOTest.java
new file mode 100644
index 0000000000..33483e8be3
--- /dev/null
+++ 
b/oap-server/server-storage-plugin/storage-jdbc-hikaricp-plugin/src/test/java/org/apache/skywalking/oap/server/storage/plugin/jdbc/common/dao/JDBCEBPFProfilingTaskDAOTest.java
@@ -0,0 +1,81 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ *
+ */
+
+package org.apache.skywalking.oap.server.storage.plugin.jdbc.common.dao;
+
+import 
org.apache.skywalking.oap.server.core.profiling.ebpf.storage.EBPFProfilingTaskRecord;
+import 
org.apache.skywalking.oap.server.library.client.jdbc.hikaricp.JDBCClient;
+import org.apache.skywalking.oap.server.storage.plugin.jdbc.common.TableHelper;
+import org.junit.jupiter.api.BeforeEach;
+import org.junit.jupiter.api.Test;
+import org.junit.jupiter.api.extension.ExtendWith;
+import org.mockito.Mock;
+import org.mockito.junit.jupiter.MockitoExtension;
+import org.mockito.junit.jupiter.MockitoSettings;
+import org.mockito.quality.Strictness;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Collections;
+import java.util.concurrent.atomic.AtomicReference;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.mockito.ArgumentMatchers.any;
+import static org.mockito.ArgumentMatchers.anyString;
+import static org.mockito.Mockito.doAnswer;
+import static org.mockito.Mockito.when;
+
+@ExtendWith(MockitoExtension.class)
+@MockitoSettings(strictness = Strictness.LENIENT)
+class JDBCEBPFProfilingTaskDAOTest {
+
+    @Mock
+    private JDBCClient jdbcClient;
+    @Mock
+    private TableHelper tableHelper;
+
+    private JDBCEBPFProfilingTaskDAO dao;
+
+    @BeforeEach
+    void setUp() {
+        dao = new JDBCEBPFProfilingTaskDAO(jdbcClient, tableHelper);
+    }
+
+    @Test
+    void getTaskRecord_shouldProduceValidSqlWithAndKeyword() throws Exception {
+        
when(tableHelper.getTablesWithinTTL(EBPFProfilingTaskRecord.INDEX_NAME))
+            .thenReturn(Collections.singletonList("ebpf_profiling_task"));
+
+        final AtomicReference<String> capturedSql = new AtomicReference<>();
+        final AtomicReference<Object[]> capturedParams = new 
AtomicReference<>();
+        doAnswer(invocation -> {
+            capturedSql.set(invocation.getArgument(0));
+            final Object[] allArgs = invocation.getArguments();
+            capturedParams.set(Arrays.copyOfRange(allArgs, 2, allArgs.length));
+            return new ArrayList<>();
+        }).when(jdbcClient).executeQuery(anyString(), any(), 
any(Object[].class));
+
+        dao.getTaskRecord("task-abc-123");
+
+        assertThat(capturedSql.get())
+            .contains(" where ")
+            .contains(" and ")
+            .contains(EBPFProfilingTaskRecord.LOGICAL_ID + " = ?");
+        assertThat(capturedParams.get()).contains("task-abc-123");
+    }
+}

Reply via email to