[Developer] #570 show vector VPD effective SQL trace
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
package com.cloudhandson.vpdbackoffice.service;
|
||||
|
||||
import static org.assertj.core.api.Assertions.assertThat;
|
||||
|
||||
import com.cloudhandson.vpdbackoffice.domain.protectedobject.ProtectedObject;
|
||||
import org.junit.jupiter.api.Test;
|
||||
|
||||
class OrdsProbeServiceTest {
|
||||
|
||||
@Test
|
||||
void buildsVectorEffectiveSqlWithVpdPredicateAndDistancePlaceholder() {
|
||||
ProtectedObject object = new ProtectedObject(
|
||||
5L, "ADMIN", "CB_VECTOR_SEARCH_DOCUMENTS", "cb-agent-vector/search", "Y");
|
||||
|
||||
String sql = OrdsProbeService.vectorEffectiveSql(
|
||||
object, "INSTR(',' || UPPER(d.TECH_TAG) || ',', ',ORACLE_VPD,') > 0");
|
||||
|
||||
assertThat(sql)
|
||||
.contains("FROM ADMIN.CB_VECTOR_SEARCH_DOCUMENTS d")
|
||||
.contains("VECTOR_DISTANCE(d.embedding, TO_VECTOR(:embedding), COSINE)")
|
||||
.contains("WHERE d.embedding IS NOT NULL AND (INSTR")
|
||||
.contains("ORDER BY score")
|
||||
.contains("ROWNUM <= LEAST(GREATEST(NVL(:row_limit, 10), 1), 100)")
|
||||
.doesNotContain("Bearer", "0.10", "0.20");
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user