Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ingest): enable fuzzy case resolution for oracle sql #12778

Merged
merged 3 commits into from
Mar 5, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,19 @@
# For SQL server, the default collation rules mean that all identifiers (schema, table, column names)
# are case preserving but case insensitive.
"mssql",
# Oracle automatically converts unquoted identifiers to uppercase.
# https://docs.oracle.com/en/database/oracle/oracle-database/19/sqlrf/Database-Object-Names-and-Qualifiers.html#GUID-3C59E44A-5140-4BCA-B9E1-3039C8050C49
# In our Oracle connector, we then normalize column names to lowercase. This behavior
# actually comes from the underlying Oracle sqlalchemy dialect.
# https://github.com/sqlalchemy/sqlalchemy/blob/d9b4d8ff3aae504402d324f3ebf0b8faff78f5dc/lib/sqlalchemy/dialects/oracle/base.py#L2579
"oracle",
}
DIALECTS_WITH_DEFAULT_UPPERCASE_COLS = {
# In some dialects, column identifiers are effectively case insensitive
# because they are automatically converted to uppercase. Most other systems
# automatically lowercase unquoted identifiers.
"snowflake",
"oracle",
}
assert DIALECTS_WITH_DEFAULT_UPPERCASE_COLS.issubset(
DIALECTS_WITH_CASE_INSENSITIVE_COLS
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,58 +3,58 @@
"query_type_props": {
"kind": "VIEW"
},
"query_fingerprint": "00400d6c706790ec92f8f1a9fbe41e05573168b071f32f9dac714180c3ef3b86",
"query_fingerprint": "5f1a47abe1e58158645efc579a96305ebe97a3b7658e4c3b39d0d3b39d87655b",
"in_tables": [
"urn:li:dataset:(urn:li:dataPlatform:oracle,scott.emp,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:mysql,scott.emp,PROD)"
],
"out_tables": [
"urn:li:dataset:(urn:li:dataPlatform:oracle,vsal,PROD)"
"urn:li:dataset:(urn:li:dataPlatform:mysql,vsal,PROD)"
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

changed because we had a few too many oracle-oriented tests

],
"column_lineage": [
{
"downstream": {
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,vsal,PROD)",
"table": "urn:li:dataset:(urn:li:dataPlatform:mysql,vsal,PROD)",
"column": "Department",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,scott.emp,PROD)",
"column": "DEPTNO"
"table": "urn:li:dataset:(urn:li:dataPlatform:mysql,scott.emp,PROD)",
"column": "deptno"
}
]
},
{
"downstream": {
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,vsal,PROD)",
"table": "urn:li:dataset:(urn:li:dataPlatform:mysql,vsal,PROD)",
"column": "Employees",
"column_type": {
"type": {
"com.linkedin.pegasus2avro.schema.NumberType": {}
}
},
"native_column_type": "DOUBLE PRECISION"
"native_column_type": "DOUBLE"
},
"upstreams": []
},
{
"downstream": {
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,vsal,PROD)",
"table": "urn:li:dataset:(urn:li:dataPlatform:mysql,vsal,PROD)",
"column": "Salary",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,scott.emp,PROD)",
"column": "SAL"
"table": "urn:li:dataset:(urn:li:dataPlatform:mysql,scott.emp,PROD)",
"column": "sal"
}
]
}
],
"debug_info": {
"confidence": 0.2,
"generalized_statement": "CREATE VIEW vsal AS SELECT a.deptno AS \"Department\", a.num_emp / b.total_count AS \"Employees\", a.sal_sum / b.total_sal AS \"Salary\" FROM (SELECT deptno, COUNT() AS num_emp, SUM(sal) AS sal_sum FROM scott.emp WHERE city = ? GROUP BY deptno) a, (SELECT COUNT() AS total_count, SUM(sal) AS total_sal FROM scott.emp WHERE city = ?) b"
"generalized_statement": "CREATE VIEW vsal AS SELECT a.deptno AS `Department`, a.num_emp / b.total_count AS `Employees`, a.sal_sum / b.total_sal AS `Salary` FROM (SELECT deptno, COUNT() AS num_emp, SUM(sal) AS sal_sum FROM scott.emp WHERE city = ? GROUP BY deptno) AS a, (SELECT COUNT() AS total_count, SUM(sal) AS total_sal FROM scott.emp WHERE city = ?) AS b"
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"query_type": "SELECT",
"query_type_props": {},
"query_fingerprint": "c7f48ff25eae801c8bbbe7f86ec725efd4da6ccbdb243e42f6c06209ad2a4cb2",
"in_tables": [
"urn:li:dataset:(urn:li:dataPlatform:oracle,abc.employees,PROD)"
],
"out_tables": [],
"column_lineage": [
{
"downstream": {
"table": null,
"column": "employee_type_number",
"column_type": {
"type": {
"com.linkedin.pegasus2avro.schema.StringType": {}
}
},
"native_column_type": "VARCHAR2"
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,abc.employees,PROD)",
"column": "employee_type"
},
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,abc.employees,PROD)",
"column": "job_title"
}
]
}
],
"debug_info": {
"confidence": 0.9,
"generalized_statement": "SELECT CASE WHEN (employee_TYPE = ?) THEN (CASE WHEN job_title IN (?) THEN ? ELSE ? END) ELSE (CASE WHEN job_title IN (?) THEN ? ELSE ? END) END AS employee_type_number FROM ABC.employees"
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
{
"downstream": {
"table": null,
"column": "COL1",
"column": "col1",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,table1,PROD)",
"column": "COL1"
"column": "col1"
}
]
},
{
"downstream": {
"table": null,
"column": "COL3",
"column": "col3",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,table2,PROD)",
"column": "COL3"
"column": "col3"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,28 +11,28 @@
{
"downstream": {
"table": null,
"column": "COL1",
"column": "col1",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,table1,PROD)",
"column": "COL1"
"column": "col1"
}
]
},
{
"downstream": {
"table": null,
"column": "COL3",
"column": "col3",
"column_type": null,
"native_column_type": null
},
"upstreams": [
{
"table": "urn:li:dataset:(urn:li:dataPlatform:oracle,table2,PROD)",
"column": "COL3"
"column": "col3"
}
]
}
Expand Down
Loading
Loading