MINOR: Fix pinotdb col. datatype error (#18268)

This commit is contained in:
harshsoni2024 2024-10-16 11:35:27 +05:30 committed by harshsoni2024
parent 2ea683a112
commit 7bbc92b960

View File

@ -11,6 +11,9 @@
"""PinotDb source module"""
from typing import Iterable, Optional
from pinotdb import sqlalchemy as pinot_sqlalchemy
from sqlalchemy import types
from metadata.generated.schema.entity.services.connections.database.pinotDBConnection import (
PinotDBConnection,
)
@ -22,6 +25,31 @@ from metadata.ingestion.ometa.ometa_api import OpenMetadata
from metadata.ingestion.source.database.common_db_source import CommonDbSourceService
def get_type_custom(data_type, field_size):
type_map = {
"int": types.BigInteger,
"long": types.BigInteger,
"float": types.Float,
"double": types.Numeric,
# BOOLEAN, is added after release 0.7.1.
# In release 0.7.1 and older releases, BOOLEAN is equivalent to STRING.
"boolean": types.Boolean,
"timestamp": types.TIMESTAMP,
"string": types.String,
"json": types.JSON,
"bytes": types.LargeBinary,
"big_decimal": types.DECIMAL,
# Complex types
"struct": types.BLOB,
"map": types.BLOB,
"array": types.ARRAY,
}
return type_map.get(data_type.lower())
pinot_sqlalchemy.get_type = get_type_custom
class PinotdbSource(CommonDbSourceService):
"""
Implements the necessary methods to extract