-
Notifications
You must be signed in to change notification settings - Fork 3
Backport to branch(3) : Add PartiQL parser (Create Table and Insert) #191
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
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,3 +4,4 @@ include 'rpc' | |
| include 'client' | ||
| include 'schema-loader' | ||
| include 'generic-contracts' | ||
| include 'table-store' | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| plugins { | ||
| id 'net.ltgt.errorprone' version "${errorpronePluginVersion}" | ||
| id "com.github.spotbugs" version "${spotbugsPluginVersion}" | ||
| } | ||
|
|
||
| dependencies { | ||
| implementation project(':client') | ||
| implementation project(':generic-contracts') | ||
| implementation group: 'org.partiql', name: 'partiql-parser', version: "${partiqlVersion}" | ||
|
|
||
| // for Error Prone | ||
| errorprone "com.google.errorprone:error_prone_core:${errorproneVersion}" | ||
| errorproneJavac "com.google.errorprone:javac:${errorproneJavacVersion}" | ||
|
|
||
| // for SpotBugs | ||
| spotbugs "com.github.spotbugs:spotbugs:${spotbugsVersion}" | ||
| compileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}" | ||
| testCompileOnly "com.github.spotbugs:spotbugs-annotations:${spotbugsVersion}" | ||
| } | ||
|
|
||
| spotless { | ||
| java { | ||
| target 'src/*/java/**/*.java' | ||
| importOrder() | ||
| removeUnusedImports() | ||
| googleJavaFormat('1.7') | ||
| } | ||
| } | ||
|
|
||
| spotbugs { | ||
| ignoreFailures = false | ||
| showStackTraces = true | ||
| showProgress = true | ||
| effort = 'default' | ||
| reportLevel = 'default' | ||
| maxHeapSize = '1g' | ||
| extraArgs = [ '-nested:false' ] | ||
| jvmArgs = [ '-Duser.language=en' ] | ||
| } | ||
|
|
||
| spotbugsMain.reports { | ||
| html.enabled = true | ||
| } | ||
|
|
||
| spotbugsTest.reports { | ||
| html.enabled = true | ||
| } | ||
|
|
||
| task sourcesJar(type: Jar) { | ||
| classifier = 'sources' | ||
| from sourceSets.main.allSource | ||
| } |
109 changes: 109 additions & 0 deletions
109
table-store/src/main/java/com/scalar/dl/tablestore/client/error/TableStoreClientError.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,109 @@ | ||
| package com.scalar.dl.tablestore.client.error; | ||
|
|
||
| import com.scalar.dl.ledger.error.ScalarDlError; | ||
| import com.scalar.dl.ledger.service.StatusCode; | ||
|
|
||
| public enum TableStoreClientError implements ScalarDlError { | ||
|
|
||
| // | ||
| // Errors for INVALID_ARGUMENT(414) | ||
| // | ||
| SYNTAX_ERROR_IN_PARTIQL_PARSER( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "001", | ||
| "Syntax error. Line=%d, Offset=%d, Length=%d, Code=%s", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_PRIMARY_KEY_SPECIFICATION( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "002", | ||
| "Syntax error. The primary key column must be specified only once in a table.", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_COLUMN_CONSTRAINTS( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "003", | ||
| "Syntax error. The specified column constraint is invalid.", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_DATA_TYPE( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "004", | ||
| "Syntax error. The specified data type is invalid.", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_INSERT_STATEMENT( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "005", | ||
| "Syntax error. The specified insert statement is invalid.", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_STATEMENT( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "006", | ||
| "Syntax error. The specified statement is invalid.", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_EXPRESSION( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "007", | ||
| "Syntax error. The specified expression is invalid. Expression: %s", | ||
| "", | ||
| ""), | ||
| SYNTAX_ERROR_INVALID_LITERAL( | ||
| StatusCode.INVALID_ARGUMENT, | ||
| "008", | ||
| "Syntax error. The specified literal is invalid. Literal: %s", | ||
| "", | ||
| ""), | ||
| ; | ||
|
|
||
| private static final String COMPONENT_NAME = "DL-TABLE-STORE"; | ||
|
|
||
| private final StatusCode statusCode; | ||
| private final String id; | ||
| private final String message; | ||
| private final String cause; | ||
| private final String solution; | ||
|
|
||
| TableStoreClientError( | ||
| StatusCode statusCode, String id, String message, String cause, String solution) { | ||
| validate(COMPONENT_NAME, statusCode, id, message, cause, solution); | ||
|
|
||
| this.statusCode = statusCode; | ||
| this.id = id; | ||
| this.message = message; | ||
| this.cause = cause; | ||
| this.solution = solution; | ||
| } | ||
|
|
||
| @Override | ||
| public String getComponentName() { | ||
| return COMPONENT_NAME; | ||
| } | ||
|
|
||
| @Override | ||
| public StatusCode getStatusCode() { | ||
| return statusCode; | ||
| } | ||
|
|
||
| @Override | ||
| public String getId() { | ||
| return id; | ||
| } | ||
|
|
||
| @Override | ||
| public String getMessage() { | ||
| return message; | ||
| } | ||
|
|
||
| @Override | ||
| public String getCause() { | ||
| return cause; | ||
| } | ||
|
|
||
| @Override | ||
| public String getSolution() { | ||
| return solution; | ||
| } | ||
| } |
7 changes: 7 additions & 0 deletions
7
table-store/src/main/java/com/scalar/dl/tablestore/client/partiql/DataType.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,7 @@ | ||
| package com.scalar.dl.tablestore.client.partiql; | ||
|
|
||
| public enum DataType { | ||
| BOOLEAN, | ||
| NUMBER, | ||
| STRING, | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is recommended to maintain consistency in the order of declarations. Consider placing
CONTRACT_CREATEandCONTRACT_INSERTafterCONTRACT_GET_ASSET_IDandCONTRACT_SCANto maintain alphabetical order.