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

precision and scale not supported for DECIMAL type #439

Open
leo-schick opened this issue Dec 1, 2022 · 0 comments
Open

precision and scale not supported for DECIMAL type #439

leo-schick opened this issue Dec 1, 2022 · 0 comments

Comments

@leo-schick
Copy link

The current implementation of DECIMAL (/NUMERIC) does not support the precision and scale attribute which is supported since hive 0.13.

possible implementation solution:

class HiveTypeCompiler(compiler.GenericTypeCompiler):
    # [..]

    def visit_NUMERIC(self, type_):
        precision = getattr(type_, "precision", None)
        if precision is None:
            return "DECIMAL"
        else:
            scale = getattr(type_, "scale", None)
            if scale is None:
                return "DECIMAL(%(precision)s)" % {"precision": precision}
            else:
                return "DECIMAL(%(precision)s, %(scale)s)" % {"precision": precision, "scale": scale}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant