<commit_before># Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import contextlib
import getpass
import os
from typing import Optional
import sqlalchemy as sa

from sqlalchemy.dialects.oracle.cx_oracle import OracleDialect_cx_oracle
from third_party.ibis.ibis_oracle.compiler import OracleDialect

import ibis.expr.datatypes as dt
import ibis.backends.base_sqlalchemy.alchemy as alch
import cx_Oracle  # NOQA fail early if the driver is missing


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.CLOB)
def sa_oracle_CLOB(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.NCLOB)
def sa_oracle_NCLOB(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.LONG)
def sa_oracle_LONG(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.NUMBER)
def sa_oracle_NUMBER(_, satype, nullable=True):
    return dt.Decimal(satype.precision, satype.scale, nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.BFILE)
def sa_oracle_BFILE(_, satype, nullable=True):
    return dt.Binary(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.RAW)
def sa_oracle_RAW(_, satype, nullable=True):
    return dt.Binary(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.DATE)
def sa_oracle_DATE(_, satype, nullable=True):<commit_msg>fix: support NUMBER with no precision/scale (#572)<commit_after># Copyright 2020 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import contextlib
import getpass
import os
from typing import Optional
import sqlalchemy as sa

from sqlalchemy.dialects.oracle.cx_oracle import OracleDialect_cx_oracle
from third_party.ibis.ibis_oracle.compiler import OracleDialect

import ibis.expr.datatypes as dt
import ibis.backends.base_sqlalchemy.alchemy as alch
import cx_Oracle  # NOQA fail early if the driver is missing


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.CLOB)
def sa_oracle_CLOB(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.NCLOB)
def sa_oracle_NCLOB(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.LONG)
def sa_oracle_LONG(_, satype, nullable=True):
    return dt.String(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.NUMBER)
def sa_oracle_NUMBER(_, satype, nullable=True):
    if not satype.precision and not satype.scale:
        return dt.Decimal(38, 0, nullable=nullable)
    return dt.Decimal(satype.precision, satype.scale, nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.BFILE)
def sa_oracle_BFILE(_, satype, nullable=True):
    return dt.Binary(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.RAW)
def sa_oracle_RAW(_, satype, nullable=True):
    return dt.Binary(nullable=nullable)


@dt.dtype.register(OracleDialect_cx_oracle, sa.dialects.oracle.DATE)
def sa_oracle_DATE(_, satype, nullable=True):
{'fraction_non_alphanumeric': 0.08991381318425344, 'fraction_numerical': 0.005124621476822734, 'mean_word_length': 5.783570300157978, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2542634', 'n_tokens_mistral': 1491, 'n_tokens_neox': 1419, 'n_words': 373}