-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into use-entity-name
- Loading branch information
Showing
2,438 changed files
with
40,955 additions
and
14,533 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
44 changes: 44 additions & 0 deletions
44
bootstrap/sql/migrations/native/1.6.2/mysql/schemaChanges.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
-- add timestamp index for test case result reindex performance | ||
ALTER TABLE data_quality_data_time_series ADD INDEX `idx_timestamp_desc` (timestamp DESC); | ||
|
||
CREATE TABLE background_jobs ( | ||
id BIGINT UNSIGNED AUTO_INCREMENT PRIMARY KEY, | ||
jobType VARCHAR(256) NOT NULL, | ||
methodName VARCHAR(256) NOT NULL, | ||
jobArgs JSON NOT NULL, | ||
status VARCHAR(50) NOT NULL DEFAULT 'PENDING', | ||
createdBy VARCHAR(256) NOT NULL, | ||
createdAt BIGINT UNSIGNED NOT NULL DEFAULT (UNIX_TIMESTAMP(NOW(3)) * 1000), | ||
updatedAt BIGINT UNSIGNED NOT NULL DEFAULT (UNIX_TIMESTAMP(NOW(3)) * 1000) | ||
); | ||
|
||
CREATE INDEX idx_status_createdAt ON background_jobs (status, createdAt); | ||
CREATE INDEX idx_createdBy ON background_jobs (createdBy); | ||
CREATE INDEX idx_status ON background_jobs (status); | ||
CREATE INDEX idx_jobType ON background_jobs (jobType); | ||
CREATE INDEX idx_updatedAt ON background_jobs (updatedAt); | ||
|
||
-- rename executable -> basic for test suites | ||
UPDATE test_suite | ||
SET json = JSON_INSERT( | ||
JSON_REMOVE(json, '$.executable'), | ||
'$.basic', | ||
JSON_EXTRACT(json, '$.executable') | ||
) | ||
WHERE JSON_EXTRACT(json, '$.executable') IS NOT NULL; | ||
|
||
-- rename executableEntityReference -> basicEntityReference for test suites | ||
UPDATE test_suite | ||
SET json = JSON_INSERT( | ||
JSON_REMOVE(json, '$.executableEntityReference'), | ||
'$.basicEntityReference', | ||
JSON_EXTRACT(json, '$.executableEntityReference') | ||
) | ||
WHERE JSON_EXTRACT(json, '$.executableEntityReference') IS NOT NULL; | ||
|
||
-- clean up the testSuites | ||
UPDATE test_case SET json = json_remove(json, '$.testSuites'); | ||
|
||
-- clean up the testSuites in the version history too | ||
UPDATE entity_extension SET json = json_remove(json, '$.testSuites') WHERE jsonSchema = 'testCase'; | ||
|
Empty file.
46 changes: 46 additions & 0 deletions
46
bootstrap/sql/migrations/native/1.6.2/postgres/schemaChanges.sql
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
-- add timestamp index for test case result reindex performance | ||
CREATE INDEX idx_timestamp_desc ON data_quality_data_time_series (timestamp DESC); | ||
|
||
CREATE TABLE background_jobs ( | ||
id BIGSERIAL PRIMARY KEY, | ||
jobType VARCHAR(256) NOT NULL, | ||
methodName VARCHAR(256) NOT NULL, | ||
jobArgs JSONB NOT NULL, | ||
status VARCHAR(50) NOT NULL DEFAULT 'PENDING', | ||
createdBy VARCHAR(256) NOT NULL, | ||
createdAt BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM NOW()) * 1000)::BIGINT, | ||
updatedAt BIGINT NOT NULL DEFAULT (EXTRACT(EPOCH FROM NOW()) * 1000)::BIGINT | ||
); | ||
|
||
CREATE INDEX idx_status_createdAt ON background_jobs (status, createdAt); | ||
CREATE INDEX idx_createdBy ON background_jobs (createdBy); | ||
CREATE INDEX idx_status ON background_jobs (status); | ||
CREATE INDEX idx_jobType ON background_jobs (jobType); | ||
CREATE INDEX idx_updatedAt ON background_jobs (updatedAt); | ||
|
||
-- rename executable -> basic for test suites | ||
UPDATE test_suite | ||
SET json = jsonb_set( | ||
json::jsonb #- '{executable}', | ||
'{basic}', | ||
(json #> '{executable}')::jsonb, | ||
true | ||
) | ||
WHERE json #>> '{executable}' IS NOT NULL; | ||
|
||
-- rename executableEntityReference -> basicEntityReference for test suites | ||
UPDATE test_suite | ||
SET json = jsonb_set( | ||
json::jsonb #- '{executableEntityReference}', | ||
'{basicEntityReference}', | ||
(json #> '{executableEntityReference}')::jsonb, | ||
true | ||
) | ||
WHERE json #>> '{executableEntityReference}' IS NOT NULL; | ||
|
||
-- clean up the testSuites | ||
UPDATE test_case SET json = json::jsonb #- '{testSuites}'; | ||
|
||
-- clean up the testSuites in the version history too | ||
UPDATE entity_extension SET json = json::jsonb #- '{testSuites}' WHERE jsonSchema = 'testCase'; | ||
|
76 changes: 76 additions & 0 deletions
76
common/src/main/java/org/openmetadata/annotations/DeprecatedAnnotator.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
package org.openmetadata.annotations; | ||
|
||
import com.fasterxml.jackson.databind.JsonNode; | ||
import com.sun.codemodel.JAnnotationUse; | ||
import com.sun.codemodel.JClass; | ||
import com.sun.codemodel.JDefinedClass; | ||
import com.sun.codemodel.JFieldVar; | ||
import com.sun.codemodel.JMethod; | ||
import java.lang.reflect.Field; | ||
import java.util.TreeMap; | ||
import org.jsonschema2pojo.AbstractAnnotator; | ||
|
||
/** Add {@link Deprecated} annotation to generated Java classes */ | ||
public class DeprecatedAnnotator extends AbstractAnnotator { | ||
|
||
/** Add {@link Deprecated} annotation to property fields */ | ||
@Override | ||
public void propertyField( | ||
JFieldVar field, JDefinedClass clazz, String propertyName, JsonNode propertyNode) { | ||
super.propertyField(field, clazz, propertyName, propertyNode); | ||
if (propertyNode.get("deprecated") != null && propertyNode.get("deprecated").asBoolean()) { | ||
field.annotate(Deprecated.class); | ||
} | ||
} | ||
|
||
/** Add {@link Deprecated} annotation to getter methods */ | ||
@Override | ||
public void propertyGetter(JMethod getter, JDefinedClass clazz, String propertyName) { | ||
super.propertyGetter(getter, clazz, propertyName); | ||
addDeprecatedAnnotationIfApplies(getter, propertyName); | ||
} | ||
|
||
/** Add {@link Deprecated} annotation to setter methods */ | ||
@Override | ||
public void propertySetter(JMethod setter, JDefinedClass clazz, String propertyName) { | ||
super.propertySetter(setter, clazz, propertyName); | ||
addDeprecatedAnnotationIfApplies(setter, propertyName); | ||
} | ||
|
||
/** | ||
* Use reflection methods to access the {@link JDefinedClass} of the {@link JMethod} object. If | ||
* the {@link JMethod} is pointing to a field annotated with {@link Deprecated} then annotates | ||
* the {@link JMethod} object with {@link Deprecated} | ||
*/ | ||
private void addDeprecatedAnnotationIfApplies(JMethod jMethod, String propertyName) { | ||
try { | ||
Field outerClassField = JMethod.class.getDeclaredField("outer"); | ||
outerClassField.setAccessible(true); | ||
JDefinedClass outerClass = (JDefinedClass) outerClassField.get(jMethod); | ||
|
||
TreeMap<String, JFieldVar> insensitiveFieldsMap = | ||
new TreeMap<>(String.CASE_INSENSITIVE_ORDER); | ||
insensitiveFieldsMap.putAll(outerClass.fields()); | ||
|
||
if (insensitiveFieldsMap.containsKey(propertyName) | ||
&& insensitiveFieldsMap.get(propertyName).annotations().stream() | ||
.anyMatch( | ||
annotation -> | ||
Deprecated.class.getName().equals(getAnnotationClassName(annotation)))) { | ||
jMethod.annotate(Deprecated.class); | ||
} | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
private String getAnnotationClassName(JAnnotationUse annotation) { | ||
try { | ||
Field clazzField = JAnnotationUse.class.getDeclaredField("clazz"); | ||
clazzField.setAccessible(true); | ||
return ((JClass) clazzField.get(annotation)).fullName(); | ||
} catch (NoSuchFieldException | IllegalAccessException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.