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

cannot import into bigint column from CSV file #39

Open
mewalig opened this issue Sep 9, 2022 · 0 comments
Open

cannot import into bigint column from CSV file #39

mewalig opened this issue Sep 9, 2022 · 0 comments

Comments

@mewalig
Copy link

mewalig commented Sep 9, 2022

Hi,

Am trying to import a CSV file to Databricks (9.1 LTS (includes Apache Spark 3.1.2, Scala 2.12) and even with a very simple 2-column example and tiny integer input, it fails with Failed to merge incompatible data types LongType and IntegerType

Here are my test commands:

dbsqlcli -e "create or replace table `datatype_test`(`bigint_col` bigint, `int_col` integer)"

dbsqlcli -e "COPY INTO datatype_test FROM '/tmp/datatype_test.csv' FILEFORMAT = CSV FORMAT_OPTIONS ('header'='true', 'inferSchema'='true') COPY_OPTIONS ('mergeSchema'='true')"

where /tmp/datatype_test.csv contains:

bigint_col,int_col
,123
123,
123,123

Any suggestions?

The error response header is:

org.apache.hive.service.cli.HiveSQLException: Error running query: org.apache.spark.sql.AnalysisException: Failed to merge fields 'bigint_col' and 'bigint_col'. Failed to merge incompatible data types LongType and IntegerType
        at org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation.org$apache$spark$sql$hive$thriftserver$SparkExecuteStatementOperation$$execute(SparkExecuteStatementOperation.scala:1019)
        at org.apache.spark.sql.hive.thriftserver.SparkExecuteStatementOperation$$anon$2$$anon$3.$anonfun$run$2(SparkExecuteStatementOperation.scala:759)
...
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