prestodb / presto

The official home of the Presto distributed SQL query engine for big data
http://prestodb.io
Apache License 2.0
16.05k stars 5.38k forks source link

Insert into json table #10394

Closed bdm123 closed 4 years ago

bdm123 commented 6 years ago

Hi,

Trying to test a read/write on a simple JSON table but get the error below when performing an insert. Any ideas why inserting/writing data fails?

hive> CREATE TABLE json_test (
 Test string
 )
 ROW FORMAT SERDE 'org.openx.data.jsonserde.JsonSerDe'
 STORED AS TEXTFILE;
presto:default> insert into temp.json_test select '1';
Query 20180406_204605_00004_q3en7 failed: Output format org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat with SerDe org.openx.data.jsonserde.JsonSerDe is not supported
com.facebook.presto.spi.PrestoException: Output format org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat with SerDe org.openx.data.jsonserde.JsonSerDe is not supported

Also, running the insert through hive worked fine and subsequently reading through presto worked. Writing seems to be the issue. Any ideas?

Thanks

bdm123 commented 6 years ago

Is the simple answer that it is not currently supported in presto? Seems this would be a common and useful task.

dain commented 6 years ago

Presto supports the Hive standard JSON table serde org.apache.hive.hcatalog.data.JsonSerDe. I've never seen org.openx.data.jsonserde.JsonSerDe before. Is that a new thing?

bdm123 commented 6 years ago

Hi @dain - This was resolved by switching to the correct serde as you advised. I came across the openx serde in amazon's documentation for presto-athena. Thank you!

yufengJ commented 6 years ago

@dain Is there a reason Presto only support Hive standard JSON serde org.apache.hive.hcatalog.data.JsonSerDe? In other words, why does Presto bind serde to HiveStorageFormat enum? My guess is because the writer needs to know estimatedWriterSystemMemoryUsage for each Serde so it could do memory related optimizations.

I am thinking if Presto would be able support Create-Table-As-Select with customized serde and Insert into table with customized serde.

dain commented 6 years ago

We test everything we support, otherwise we have lots of problems supporting the community. We can add more formats as needed, but we try to stick to the big systems that people use.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had any activity in the last 2 years. If you feel that this issue is important, just comment and the stale tag will be removed; otherwise it will be closed in 7 days. This is an attempt to ensure that our open issues remain valuable and relevant so that we can keep track of what needs to be done and prioritize the right things.