This repository has been archived by the owner on Aug 2, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 186
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add JDBC formatter in new SQL engine (#854)
* Add jdbc formatter * Add error response format method * Add java doc * Convert type to lower case * Enable branch coverage and pass jacoco * Remove version for now * Fix broken ITs * Change error code to 503 * Add back legcy ITs * Convert all legacy types * Add IT * Prepare PR * Prepare PR * Address PR comment * Remove valueMap
- Loading branch information
Showing
12 changed files
with
407 additions
and
38 deletions.
There are no files selected for viewing
This file contains 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 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 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
58 changes: 58 additions & 0 deletions
58
integ-test/src/test/java/com/amazon/opendistroforelasticsearch/sql/sql/JdbcFormatIT.java
This file contains 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,58 @@ | ||
/* | ||
* Copyright 2020 Amazon.com, Inc. or its affiliates. All Rights Reserved. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"). | ||
* You may not use this file except in compliance with the License. | ||
* A copy of the License is located at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* or in the "license" file accompanying this file. This file is distributed | ||
* on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either | ||
* express or implied. See the License for the specific language governing | ||
* permissions and limitations under the License. | ||
* | ||
*/ | ||
|
||
package com.amazon.opendistroforelasticsearch.sql.sql; | ||
|
||
import static com.amazon.opendistroforelasticsearch.sql.legacy.TestsConstants.TEST_INDEX_BANK; | ||
import static com.amazon.opendistroforelasticsearch.sql.util.MatcherUtils.schema; | ||
import static com.amazon.opendistroforelasticsearch.sql.util.MatcherUtils.verifySchema; | ||
|
||
import com.amazon.opendistroforelasticsearch.sql.legacy.SQLIntegTestCase; | ||
import org.json.JSONObject; | ||
import org.junit.jupiter.api.Test; | ||
|
||
public class JdbcFormatIT extends SQLIntegTestCase { | ||
|
||
@Override | ||
protected void init() throws Exception { | ||
loadIndex(Index.BANK); | ||
} | ||
|
||
@Test | ||
public void testSimpleDataTypesInSchema() { | ||
JSONObject response = new JSONObject(executeQuery( | ||
"SELECT account_number, address, age, birthdate, city, male, state " | ||
+ "FROM " + TEST_INDEX_BANK, "jdbc")); | ||
|
||
verifySchema(response, | ||
schema("account_number", "long"), | ||
schema("address", "text"), | ||
schema("age", "integer"), | ||
schema("birthdate", "timestamp"), | ||
schema("city", "keyword"), | ||
schema("male", "boolean"), | ||
schema("state", "text")); | ||
} | ||
|
||
@Test | ||
public void testAliasInSchema() { | ||
JSONObject response = new JSONObject(executeQuery( | ||
"SELECT account_number AS acc FROM " + TEST_INDEX_BANK, "jdbc")); | ||
|
||
verifySchema(response, schema("acc", "acc", "long")); | ||
} | ||
|
||
} |
This file contains 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 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 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 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 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
Oops, something went wrong.