You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/06/09 14:55:40 UTC
[GitHub] [shardingsphere] ThanoshanMV opened a new pull request, #18272: Add PostgreSQL Copy Statement
ThanoshanMV opened a new pull request, #18272:
URL: https://github.com/apache/shardingsphere/pull/18272
For #17844
Changes proposed in this pull request:
- Added PostgreSQL [Copy Statement](https://www.postgresql.org/docs/current/sql-copy.html).
- Added test cases.
- Added `E?` in `STRING_` to represent the [escape string constants](https://www.postgresql.org/docs/current/sql-syntax-lexical.html#SQL-BACKSLASH-TABLE) specified by writing the letter E just before the opening quote. For example, `E'foo'`. This is added to support queries like `COPY t_order FROM STDIN WITH NULL AS E'\\0';`.
- Omitted `copy_by_postgresql_source_test_case3` as it is not aligned.
![null-as-encoding-ast](https://user-images.githubusercontent.com/48581379/172873293-a3ecb74f-5460-466b-98f2-7b7ee554ca89.png)
In the above query, `[ NULL [ AS ] 'null_string' ]` cannot be followed with `ENCODING 'encoding_name'` as there is no definition of `ENCODING` there.
![null-as-structure-1](https://user-images.githubusercontent.com/48581379/172876407-a427c262-cb58-4351-afdd-10f30a148f5c.png)
- Modified `copy_by_postgresql_source_test_case5` as `copy_table_to_stdout_with_csv_force_quote`, `ESCAPE E'\'` must come before `FORCE QUOTE col2;`
![force-quote](https://user-images.githubusercontent.com/48581379/172875663-ba8b61f3-5b40-447e-ab31-b4ddddd3379a.png)
Please let me know if there is anything to change.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu merged pull request #18272: Add PostgreSQL Copy Statement
Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #18272:
URL: https://github.com/apache/shardingsphere/pull/18272
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] codecov-commenter commented on pull request #18272: Add PostgreSQL Copy Statement
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #18272:
URL: https://github.com/apache/shardingsphere/pull/18272#issuecomment-1151292521
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
> Merging [#18272](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (0cf4161) into [master](https://codecov.io/gh/apache/shardingsphere/commit/eb649c6d4e97b47db4bb6757af47fdc8b53273a8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (eb649c6) will **decrease** coverage by `0.10%`.
> The diff coverage is `21.73%`.
```diff
@@ Coverage Diff @@
## master #18272 +/- ##
============================================
- Coverage 59.24% 59.14% -0.11%
- Complexity 2182 2187 +5
============================================
Files 3715 3728 +13
Lines 54558 54736 +178
Branches 9267 9293 +26
============================================
+ Hits 32323 32372 +49
- Misses 19487 19616 +129
Partials 2748 2748
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...ment/dml/prepare/PrepareStatementQuerySegment.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3NlZ21lbnQvZG1sL3ByZXBhcmUvUHJlcGFyZVN0YXRlbWVudFF1ZXJ5U2VnbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [.../sql/dialect/handler/dml/CopyStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9Db3B5U3RhdGVtZW50SGFuZGxlci5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...tement/postgresql/dml/PostgreSQLCopyStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9zdGF0ZW1lbnQvcG9zdGdyZXNxbC9kbWwvUG9zdGdyZVNRTENvcHlTdGF0ZW1lbnQuamF2YQ==) | `0.00% <0.00%> (ø)` | |
| [...s/segment/prepare/PrepareStatementQueryAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zZWdtZW50L3ByZXBhcmUvUHJlcGFyZVN0YXRlbWVudFF1ZXJ5QXNzZXJ0LmphdmE=) | `0.00% <0.00%> (ø)` | |
| [...sserts/statement/dml/impl/CopyStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZG1sL2ltcGwvQ29weVN0YXRlbWVudEFzc2VydC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...es/domain/statement/dml/CopyStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2RtbC9Db3B5U3RhdGVtZW50VGVzdENhc2UuamF2YQ==) | `100.00% <ø> (ø)` | |
| [...atement/impl/PostgreSQLDMLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMRE1MU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `63.46% <53.12%> (-22.91%)` | :arrow_down: |
| [...es/domain/segment/impl/column/ExpectedColumns.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc2VnbWVudC9pbXBsL2NvbHVtbi9FeHBlY3RlZENvbHVtbnMuamF2YQ==) | `100.00% <100.00%> (ø)` | |
| [...ment/impl/query/ExpectedPrepareStatementQuery.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc2VnbWVudC9pbXBsL3F1ZXJ5L0V4cGVjdGVkUHJlcGFyZVN0YXRlbWVudFF1ZXJ5LmphdmE=) | `100.00% <100.00%> (ø)` | |
| [...ardingsphere/transaction/rule/TransactionRule.java](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUta2VybmVsL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uL3NoYXJkaW5nc3BoZXJlLXRyYW5zYWN0aW9uLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3RyYW5zYWN0aW9uL3J1bGUvVHJhbnNhY3Rpb25SdWxlLmphdmE=) | `32.43% <0.00%> (-50.91%)` | :arrow_down: |
| ... and [121 more](https://codecov.io/gh/apache/shardingsphere/pull/18272/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
> **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
> `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
> Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [eb649c6...0cf4161](https://codecov.io/gh/apache/shardingsphere/pull/18272?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] strongduanmu commented on a diff in pull request #18272: Add PostgreSQL Copy Statement
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #18272:
URL: https://github.com/apache/shardingsphere/pull/18272#discussion_r894059342
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DMLStatement.g4:
##########
@@ -463,60 +463,38 @@ checkpoint
;
copy
- : COPY (BINARY)? qualifiedName (LP_ columnList RP_)? (FROM | TO) PROGRAM?
- (STRING_ | STDIN | STDOUT) copyDelimiter? (WITH)? copyOptions whereClause?
- | COPY LP_ preparableStmt RP_ TO PROGRAM? (STRING_ | STDIN | STDOUT) WITH? copyOptions
+ : copyWithTableOrQuery | copyWithTableOrQueryBinaryCsv | copyWithTableBinary
;
-copyOptions
- : copyOptList | LP_ copyGenericOptList RP_
+copyWithTableOrQuery
+ : COPY (tableName columnNames? | LP_ preparableStmt RP_) (FROM | TO) (fileName | PROGRAM STRING_ | STDIN | STDOUT) (WITH? LP_ copyOptionList RP_)? whereClause?
Review Comment:
Do you think it is better to use qualifiedName? Because the table name in the copy statement can be prefixed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
[GitHub] [shardingsphere] ThanoshanMV commented on a diff in pull request #18272: Add PostgreSQL Copy Statement
Posted by GitBox <gi...@apache.org>.
ThanoshanMV commented on code in PR #18272:
URL: https://github.com/apache/shardingsphere/pull/18272#discussion_r894141503
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DMLStatement.g4:
##########
@@ -463,60 +463,38 @@ checkpoint
;
copy
- : COPY (BINARY)? qualifiedName (LP_ columnList RP_)? (FROM | TO) PROGRAM?
- (STRING_ | STDIN | STDOUT) copyDelimiter? (WITH)? copyOptions whereClause?
- | COPY LP_ preparableStmt RP_ TO PROGRAM? (STRING_ | STDIN | STDOUT) WITH? copyOptions
+ : copyWithTableOrQuery | copyWithTableOrQueryBinaryCsv | copyWithTableBinary
;
-copyOptions
- : copyOptList | LP_ copyGenericOptList RP_
+copyWithTableOrQuery
+ : COPY (tableName columnNames? | LP_ preparableStmt RP_) (FROM | TO) (fileName | PROGRAM STRING_ | STDIN | STDOUT) (WITH? LP_ copyOptionList RP_)? whereClause?
Review Comment:
Sure @strongduanmu, I've changed `tableName` to `qualifiedName`.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@shardingsphere.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org