Skip to content

Commit

Permalink
Merge branch 'master' into fix/ing-705-looker-tool-extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
mayurinehate authored Dec 18, 2024
2 parents 811d25c + 01a2c0c commit 3da97f2
Show file tree
Hide file tree
Showing 20 changed files with 570 additions and 190 deletions.
2 changes: 1 addition & 1 deletion datahub-frontend/conf/logback.xml
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
<logger name="com.linkedin" level="DEBUG">
<appender-ref ref="DEBUG_FILE"/>
</logger>
<logger name="controller" level="DEBUG">
<logger name="controllers" level="DEBUG">
<appender-ref ref="DEBUG_FILE"/>
</logger>
<logger name="auth" level="DEBUG">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { identifyAndAddParentRows } from '../useStructuredProperties';

describe('identifyAndAddParentRows', () => {
it('should not return parent rows when there are none', () => {
const propertyRows = [
{ displayName: 'test1', qualifiedName: 'test1' },
{ displayName: 'test2', qualifiedName: 'test2' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([]);
});

it('should not return parent rows when another row starts with the same letters but is a different token', () => {
const propertyRows = [
{ displayName: 'test1', qualifiedName: 'testing.one' },
{ displayName: 'test2', qualifiedName: 'testingAgain.two' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([]);
});

it('should return parent rows properly', () => {
const propertyRows = [
{ displayName: 'test1', qualifiedName: 'testing.one' },
{ displayName: 'test2', qualifiedName: 'testing.two' },
{ displayName: 'test3', qualifiedName: 'testing.three' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([
{ displayName: 'testing', qualifiedName: 'testing', childrenCount: 3 },
]);
});

it('should return parent rows properly with multiple layers of nesting', () => {
const propertyRows = [
{ displayName: 'test1', qualifiedName: 'testing.one.two.a.1' },
{ displayName: 'test1', qualifiedName: 'testing.one.two.a.2' },
{ displayName: 'test1', qualifiedName: 'testing.one.two.b' },
{ displayName: 'test1', qualifiedName: 'testing.one.three' },
{ displayName: 'test2', qualifiedName: 'testing.two.c.d' },
{ displayName: 'test3', qualifiedName: 'testing.three' },
{ displayName: 'test3', qualifiedName: 'testParent' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([
{ displayName: 'testing', qualifiedName: 'testing', isParentRow: true, childrenCount: 6 },
{ displayName: 'testing.one', qualifiedName: 'testing.one', isParentRow: true, childrenCount: 4 },
{ displayName: 'testing.one.two', qualifiedName: 'testing.one.two', isParentRow: true, childrenCount: 3 },
{
displayName: 'testing.one.two.a',
qualifiedName: 'testing.one.two.a',
isParentRow: true,
childrenCount: 2,
},
]);
});

it('should return parent rows properly with multiple layers of nesting regardless of order', () => {
const propertyRows = [
{ displayName: 'test1', qualifiedName: 'testing.one.two.a.1' },
{ displayName: 'test3', qualifiedName: 'testParent' },
{ displayName: 'test1', qualifiedName: 'testing.one.three' },
{ displayName: 'test2', qualifiedName: 'testing.two.c.d' },
{ displayName: 'test1', qualifiedName: 'testing.one.two.b' },
{ displayName: 'test3', qualifiedName: 'testing.three' },
{ displayName: 'test1', qualifiedName: 'testing.one.two.a.2' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([
{ displayName: 'testing', qualifiedName: 'testing', isParentRow: true, childrenCount: 6 },
{ displayName: 'testing.one', qualifiedName: 'testing.one', isParentRow: true, childrenCount: 4 },
{ displayName: 'testing.one.two', qualifiedName: 'testing.one.two', isParentRow: true, childrenCount: 3 },
{
displayName: 'testing.one.two.a',
qualifiedName: 'testing.one.two.a',
isParentRow: true,
childrenCount: 2,
},
]);
});

it('should return parent rows properly with simpler layers of nesting', () => {
const propertyRows = [
{ displayName: 'test2', qualifiedName: 'testing.two.c.d' },
{ displayName: 'test3', qualifiedName: 'testing.three' },
{ displayName: 'test3', qualifiedName: 'testParent' },
];
expect(identifyAndAddParentRows(propertyRows)).toMatchObject([
{ displayName: 'testing', qualifiedName: 'testing', isParentRow: true, childrenCount: 2 },
]);
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -122,10 +122,10 @@ export function identifyAndAddParentRows(rows?: Array<PropertyRow>): Array<Prope
// that would tell us to nest. If the count is not equal, we should nest the child properties.
for (let index = 0; index < substrings.length; index++) {
const token = substrings[index];
const currentCount = qualifiedNames.filter((name) => name.startsWith(token)).length;
const currentCount = qualifiedNames.filter((name) => name.startsWith(`${token}.`)).length;

// If we're at the beginning of the path and there is no nesting, break
if (index === 0 && currentCount === 1) {
// If there's only one child, don't nest it
if (currentCount === 1) {
break;
}

Expand Down
2 changes: 1 addition & 1 deletion metadata-ingestion/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@
# now provide prebuilt wheels for most platforms, including M1 Macs and
# Linux aarch64 (e.g. Docker's linux/arm64). Installing confluent_kafka
# from source remains a pain.
"confluent_kafka>=1.9.0",
"confluent_kafka[schemaregistry]>=1.9.0",
# We currently require both Avro libraries. The codegen uses avro-python3 (above)
# schema parsers at runtime for generating and reading JSON into Python objects.
# At the same time, we use Kafka's AvroSerializer, which internally relies on
Expand Down
Loading

0 comments on commit 3da97f2

Please sign in to comment.