Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/sql/72.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Sql 更改拼花地板文件中的列数据类型_Sql_Amazon Web Services_Amazon S3_Hive_External Tables - Fatal编程技术网

Sql 更改拼花地板文件中的列数据类型

Sql 更改拼花地板文件中的列数据类型,sql,amazon-web-services,amazon-s3,hive,external-tables,Sql,Amazon Web Services,Amazon S3,Hive,External Tables,我有一个指向s3位置(拼花文件)的外部表,该位置的所有数据类型都是字符串。我想更正所有列的数据类型,而不是将所有内容都作为字符串读取。当我删除外部表并使用新数据类型重新创建时,select查询总是抛出错误,如下所示: java.lang.UnsupportedOperationException: org.apache.parquet.column.values.dictionary.PlainValuesDictionary$PlainBinaryDictionary at org.a

我有一个指向s3位置(拼花文件)的外部表,该位置的所有数据类型都是字符串。我想更正所有列的数据类型,而不是将所有内容都作为字符串读取。当我删除外部表并使用新数据类型重新创建时,select查询总是抛出错误,如下所示:

java.lang.UnsupportedOperationException: org.apache.parquet.column.values.dictionary.PlainValuesDictionary$PlainBinaryDictionary
    at org.apache.parquet.column.Dictionary.decodeToInt(Dictionary.java:48)
    at org.apache.spark.sql.execution.vectorized.OnHeapColumnVector.getInt(OnHeapColumnVector.java:233)
    at org.apache.spark.sql.catalyst.expressions.GeneratedClass$GeneratedIterator.processNext(Unknown Source)
    at org.apache.spark.sql.execution.BufferedRowIterator.hasNext(BufferedRowIterator.java:43)
    at org.apache.spark.sql.execution.WholeStageCodegenExec$$anonfun$8$$anon$1.hasNext(WholeStageCodegenExec.scala:395)
    at org.apache.spark.sql.execution.SparkPlan$$anonfun$2.apply(SparkPlan.scala:234)
    at org.apache.spark.sql.execution.SparkPlan$$anonfun$2.apply(SparkPlan.scala:228)
    at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)
    at org.apache.spark.rdd.RDD$$anonfun$mapPartitionsInternal$1$$anonfun$apply$25.apply(RDD.scala:827)

将类型指定为BigInt,它等效于long类型,配置单元没有long数据类型

hive> alter table table change col col bigint;
重复内容,来自Hortonworks论坛


将类型指定为BigInt,它等效于long类型,配置单元没有long数据类型

hive> alter table table change col col bigint;
重复内容,来自Hortonworks论坛


请分享您的“创建表”语法和导致上述问题的查询error@querymind我认为,当您使用外部表时,如果这个数据类型是原始的,则无法将列的数据类型更改为其他数据类型String@SatyaPavan我的原始表是这样的:`创建外部表'
test\u数据库
test\u表
id
string,
place
string,
total
string)注释“这是一个测试表。”按(
date
string)分区存储为拼花地板位置“s3 LOCATION”`我删除了此表并创建了一个新表,如:`CREATE EXTERNAL table
test\u database
test\u table
id
bigint,
place
string,
total
bigint)注释“这是一个测试表”分区依据(
date
date)存储为拼花地板位置“s3 LOCATION”`@querymind尝试保留原始外部表的数据类型,然后尝试将其更改为所需的数据类型:
ALTER table table change col typeorg.apache.spark.sql.AnalysisException:不支持将类型为“StringType”的列“id”更改为类型为“LongType”的列“id”我不确定alter table命令是否适用于分区表请共享您的“create table”语法和导致上述问题的查询error@querymind我认为,当您使用外部表时,如果这个数据类型是原始的,则无法将列的数据类型更改为其他数据类型String@SatyaPavan我原来的桌子是类似这样的内容:`CREATE EXTERNAL TABLE
test\u database
test\u TABLE
id
string,
place
string,
total
string)COMMENT'这是一个测试表。'按(
date
string)分区存储为拼花地板位置“s3 LOCATION”`我删除了此表并创建了一个新表,如:`CREATE EXTERNAL table
test\u database
test\u table
id
bigint,
place
string,
total
bigint)注释“这是一个测试表”分区依据(
date
date)存储为拼花地板位置“s3 LOCATION”`@querymind尝试保留原始外部表的数据类型,然后尝试将其更改为所需的数据类型:
ALTER table table change col typeorg.apache.spark.sql.AnalysisException:不支持将类型为“StringType”的列“id”更改为类型为“LongType”的列“id”我不确定ALTERTABLE命令是否对分区表起不同的作用