mirror of
https://github.com/open-metadata/OpenMetadata.git
synced 2025-08-29 11:26:05 +00:00
fix: supportedDataType PSQL query (#17069)
This commit is contained in:
parent
aa3d54aede
commit
e4b31f9d65
@ -3688,8 +3688,9 @@ public interface CollectionDAO {
|
|||||||
|
|
||||||
if (supportedDataType != null) {
|
if (supportedDataType != null) {
|
||||||
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
||||||
mysqlCondition.append("AND supported_data_types LIKE :supportedDataTypeLike");
|
mysqlCondition.append(
|
||||||
psqlCondition.append("AND supported_data_types @> :supportedDataTypeLike ");
|
"AND json_extract(json, '$.supportedDataTypes') LIKE :supportedDataTypeLike ");
|
||||||
|
psqlCondition.append("AND json->>'supportedDataTypes' LIKE :supportedDataTypeLike ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return listBefore(
|
return listBefore(
|
||||||
@ -3731,8 +3732,9 @@ public interface CollectionDAO {
|
|||||||
|
|
||||||
if (supportedDataType != null) {
|
if (supportedDataType != null) {
|
||||||
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
||||||
mysqlCondition.append("AND supported_data_types LIKE :supportedDataTypeLike");
|
mysqlCondition.append(
|
||||||
psqlCondition.append("AND supported_data_types @> :supportedDataTypeLike ");
|
"AND json_extract(json, '$.supportedDataTypes') LIKE :supportedDataTypeLike ");
|
||||||
|
psqlCondition.append("AND json->>'supportedDataTypes' LIKE :supportedDataTypeLike ");
|
||||||
}
|
}
|
||||||
|
|
||||||
return listAfter(
|
return listAfter(
|
||||||
@ -3774,8 +3776,9 @@ public interface CollectionDAO {
|
|||||||
|
|
||||||
if (supportedDataType != null) {
|
if (supportedDataType != null) {
|
||||||
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
filter.queryParams.put("supportedDataTypeLike", String.format("%%%s%%", supportedDataType));
|
||||||
mysqlCondition.append("AND supported_data_types LIKE :supportedDataTypeLike");
|
mysqlCondition.append(
|
||||||
psqlCondition.append("AND supported_data_types @> :supportedDataTypeLike ");
|
"AND json_extract(json, '$.supportedDataTypes') LIKE :supportedDataTypeLike ");
|
||||||
|
psqlCondition.append("AND json->>'supportedDataTypes' LIKE :supportedDataTypeLike ");
|
||||||
}
|
}
|
||||||
return listCount(
|
return listCount(
|
||||||
getTableName(),
|
getTableName(),
|
||||||
|
@ -21,6 +21,7 @@ import org.openmetadata.schema.api.tests.CreateTestDefinition;
|
|||||||
import org.openmetadata.schema.tests.TestCaseParameter;
|
import org.openmetadata.schema.tests.TestCaseParameter;
|
||||||
import org.openmetadata.schema.tests.TestDefinition;
|
import org.openmetadata.schema.tests.TestDefinition;
|
||||||
import org.openmetadata.schema.tests.TestPlatform;
|
import org.openmetadata.schema.tests.TestPlatform;
|
||||||
|
import org.openmetadata.schema.type.ColumnDataType;
|
||||||
import org.openmetadata.schema.type.TestDefinitionEntityType;
|
import org.openmetadata.schema.type.TestDefinitionEntityType;
|
||||||
import org.openmetadata.service.Entity;
|
import org.openmetadata.service.Entity;
|
||||||
import org.openmetadata.service.resources.EntityResourceTest;
|
import org.openmetadata.service.resources.EntityResourceTest;
|
||||||
@ -51,6 +52,16 @@ public class TestDefinitionResourceTest
|
|||||||
"columnValuesMissingCount", "owner", ADMIN_AUTH_HEADERS);
|
"columnValuesMissingCount", "owner", ADMIN_AUTH_HEADERS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
void list_testDefinitionsForBoolType(TestInfo test) throws HttpResponseException {
|
||||||
|
Map<String, String> params = Map.of("supportedDataType", "BOOLEAN");
|
||||||
|
ResultList<TestDefinition> testDefinitions = listEntities(params, ADMIN_AUTH_HEADERS);
|
||||||
|
boolean b =
|
||||||
|
testDefinitions.getData().stream()
|
||||||
|
.allMatch(t -> t.getSupportedDataTypes().contains(ColumnDataType.BOOLEAN));
|
||||||
|
Assertions.assertTrue(b);
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
void post_testDefinitionWithoutRequiredFields_4xx(TestInfo test) {
|
void post_testDefinitionWithoutRequiredFields_4xx(TestInfo test) {
|
||||||
// Test Platform is required field
|
// Test Platform is required field
|
||||||
|
Loading…
x
Reference in New Issue
Block a user