PyHive icon indicating copy to clipboard operation
PyHive copied to clipboard

Update Presto to accept MultiValues Insert

Open danfrankj opened this issue 7 years ago β€’ 15 comments

Currently without this change inserts are done line by line which can be horrifically slow.

Documentation: https://prestodb.io/docs/current/sql/insert.html FYI @matthewwardrop @lchircus

danfrankj avatar Dec 14 '17 20:12 danfrankj

Codecov Report

Merging #183 into master will increase coverage by <.01%. The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #183      +/-   ##
==========================================
+ Coverage   95.71%   95.71%   +<.01%     
==========================================
  Files          14       14              
  Lines        1422     1423       +1     
  Branches      147      147              
==========================================
+ Hits         1361     1362       +1     
  Misses         40       40              
  Partials       21       21
Impacted Files Coverage Ξ”
pyhive/sqlalchemy_presto.py 91.45% <100%> (+0.07%) :arrow_up:

Continue to review full report at Codecov.

Legend - Click here to learn more Ξ” = absolute <relative> (impact), ΓΈ = not affected, ? = missing data Powered by Codecov. Last update b68e1a8...8beba44. Read the comment docs.

codecov-io avatar Dec 14 '17 20:12 codecov-io

@jingw would you be able to take a look at this change?

danfrankj avatar Jan 02 '18 15:01 danfrankj

@matthewwardrop you don't happen to be a collaborator on for this repo?

danfrankj avatar Jan 08 '18 17:01 danfrankj

@danfrankj Alas, no. While I have contributed, I don't have commit rights.

matthewwardrop avatar Jan 09 '18 04:01 matthewwardrop

@KevinFarrell would you be able to take a look at this change

danfrankj avatar Jan 15 '18 02:01 danfrankj

@gsilk would you mind taking a look at this one?

naoyak avatar Sep 20 '18 17:09 naoyak

Anything (technical) holding up this getting reviewed & merged? The Travis failure looks like a network failure that's unrelated to the PR itself.

eddies avatar Apr 12 '19 01:04 eddies

@gsilk do you mind taking a look?

On Apr 11, 2019, at 6:32 PM, Edwin Shin [email protected] wrote:

Anything (technical) holding up this getting reviewed & merged? The Travis failure looks like a network failure that's unrelated to the PR itself.

β€” You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

naoyak avatar Apr 12 '19 02:04 naoyak

@bkyryliuk @Fokko can you PTAL and rerun the CI on this PR?

naoyak avatar Mar 30 '20 21:03 naoyak

Thanks @danfrankj World is small :) @naoyak or @danfrankj Would you be open to add a test case with the insert to make sure it works?

bkyryliuk avatar Mar 30 '20 23:03 bkyryliuk

@bkyryliuk I tried to set up a test case using Presto to create a table / insert values, but keep running into a permissions issue (noticed that none of the other Presto tests involve writing to tables). Log here: https://travis-ci.org/github/naoyak/PyHive/jobs/669167402

naoyak avatar Mar 31 '20 10:03 naoyak

@naoyak one row is created in hive: https://github.com/dropbox/PyHive/blob/master/scripts/make_one_row.sh that maybe a reason of the failed write. for the test I would suggest to create a table in presto and ran the inserts against that table.

bkyryliuk avatar Mar 31 '20 16:03 bkyryliuk

@bkyryliuk I tried that approach too (creating a table from the Presto SQLAlchemy connector), which ran into the same problem: https://travis-ci.org/github/naoyak/PyHive/jobs/669143204

error
E   pyhive.exc.DatabaseError: {'message': 'Failed to create directory: file:/user/hive/warehouse/pyhive_test_database.db/insert_multivalue_test', 'errorCode': 16777232, 'errorName': 'HIVE_FILESYSTEM_ERROR', 'errorType': 'EXTERNAL', 'failureInfo': {'type': 'com.facebook.presto.spi.PrestoException', 'message': 'Failed to create directory: file:/user/hive/warehouse/pyhive_test_database.db/insert_multivalue_test', 'cause': {'type': 'java.io.IOException', 'message': 'mkdirs returned false', 'suppressed': [], 'stack': ['com.facebook.presto.hive.metastore.MetastoreUtil.createDirectory(MetastoreUtil.java:630)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore$Committer.prepareAddTable(SemiTransactionalHiveMetastore.java:1165)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore$Committer.access$300(SemiTransactionalHiveMetastore.java:1073)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore.commitShared(SemiTransactionalHiveMetastore.java:964)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore.commit(SemiTransactionalHiveMetastore.java:908)', 'com.facebook.presto.hive.HiveMetadata.commit(HiveMetadata.java:2861)', 'com.facebook.presto.hive.HiveConnector.commit(HiveConnector.java:211)', 'com.facebook.presto.transaction.InMemoryTransactionManager$TransactionMetadata$ConnectorTransactionMetadata.commit(InMemoryTransactionManager.java:671)', 'java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)', 'com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)', 'com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)', 'com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)', 'com.facebook.airlift.concurrent.BoundedExecutor.drainQueue(BoundedExecutor.java:78)', 'java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)', 'java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)', 'java.lang.Thread.run(Thread.java:748)']}, 'suppressed': [], 'stack': ['com.facebook.presto.hive.metastore.MetastoreUtil.createDirectory(MetastoreUtil.java:634)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore$Committer.prepareAddTable(SemiTransactionalHiveMetastore.java:1165)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore$Committer.access$300(SemiTransactionalHiveMetastore.java:1073)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore.commitShared(SemiTransactionalHiveMetastore.java:964)', 'com.facebook.presto.hive.metastore.SemiTransactionalHiveMetastore.commit(SemiTransactionalHiveMetastore.java:908)', 'com.facebook.presto.hive.HiveMetadata.commit(HiveMetadata.java:2861)', 'com.facebook.presto.hive.HiveConnector.commit(HiveConnector.java:211)', 'com.facebook.presto.transaction.InMemoryTransactionManager$TransactionMetadata$ConnectorTransactionMetadata.commit(InMemoryTransactionManager.java:671)', 'java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)', 'com.google.common.util.concurrent.TrustedListenableFutureTask$TrustedFutureInterruptibleTask.runInterruptibly(TrustedListenableFutureTask.java:125)', 'com.google.common.util.concurrent.InterruptibleTask.run(InterruptibleTask.java:57)', 'com.google.common.util.concurrent.TrustedListenableFutureTask.run(TrustedListenableFutureTask.java:78)', 'com.facebook.airlift.concurrent.BoundedExecutor.drainQueue(BoundedExecutor.java:78)', 'java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)', 'java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)', 'java.lang.Thread.run(Thread.java:748)']}}

naoyak avatar Mar 31 '20 16:03 naoyak

Hi @bkyryliuk ! good to see a familiar face out here. We don't use this lib very much anymore so I'll let @naoyak look into the tests.

danfrankj avatar Mar 31 '20 17:03 danfrankj

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

CLAassistant avatar Apr 16 '22 21:04 CLAassistant