[
https://issues.apache.org/jira/browse/BEAM-4646?focusedWorklogId=116669&page=com.atlassian.jira.plugin.system.issuetabpanels:worklog-tabpanel#worklog-116669
]
ASF GitHub Bot logged work on BEAM-4646:
----------------------------------------
Author: ASF GitHub Bot
Created on: 27/Jun/18 23:46
Start Date: 27/Jun/18 23:46
Worklog Time Spent: 10m
Work Description: apilloud commented on a change in pull request #5792:
[BEAM-4646][SQL] Improve BigQuery write integration test
URL: https://github.com/apache/beam/pull/5792#discussion_r198673191
##########
File path:
sdks/java/extensions/sql/src/test/java/org/apache/beam/sdk/extensions/sql/meta/provider/bigquery/BigQueryWriteIT.java
##########
@@ -55,8 +65,89 @@
.addNullableField("arr", FieldType.array(STRING))
.build();
+ private static final Schema SOURCE_SCHEMA_TWO =
+ Schema.builder()
+ .addNullableField("c_bigint", INT64)
+ .addNullableField("c_tinyint", BYTE)
+ .addNullableField("c_smallint", INT16)
+ .addNullableField("c_integer", INT32)
+ .addNullableField("c_float", FLOAT)
+ .addNullableField("c_double", DOUBLE)
+ .addNullableField("c_decimal", DECIMAL)
+ .addNullableField("c_boolean", BOOLEAN)
+ .addNullableField("c_timestamp",
FieldType.DATETIME.withMetadata("TS"))
+ .addNullableField("c_varchar", STRING)
+ .addNullableField("c_char", STRING)
+ .addNullableField("c_arr", FieldType.array(STRING))
+ .build();
+
@Rule public transient TestPipeline pipeline = TestPipeline.create();
@Rule public transient TestBigQuery bigQuery =
TestBigQuery.create(SOURCE_SCHEMA);
+ @Rule public transient TestBigQuery bigQueryTestingTypes =
TestBigQuery.create(SOURCE_SCHEMA_TWO);
+
+ @Test
+ public void testSQLTypes() {
+ BeamSqlEnv sqlEnv = BeamSqlEnv.inMemory(new BigQueryTableProvider());
+
+ String createTableStatement =
+ "CREATE TABLE TEST( \n"
+ + " c_bigint BIGINT, \n"
+ + " c_tinyint TINYINT, \n"
+ + " c_smallint SMALLINT, \n"
+ + " c_integer INTEGER, \n"
+ + " c_float FLOAT, \n"
+ + " c_double DOUBLE, \n"
+ + " c_decimal DECIMAL, \n"
+ + " c_boolean BOOLEAN, \n"
+ + " c_timestamp TIMESTAMP, \n"
+ + " c_varchar VARCHAR, \n "
+ + " c_char CHAR, \n"
+ + " c_arr ARRAY<VARCHAR> \n"
+ + ") \n"
+ + "TYPE 'bigquery' \n"
+ + "LOCATION '"
+ + bigQueryTestingTypes.tableSpec()
+ + "'";
+ sqlEnv.executeDdl(createTableStatement);
+ System.out.println(bigQueryTestingTypes.tableSpec());
+
+ String insertStatement =
+ "INSERT INTO TEST VALUES ("
+ + "9223372036854775807, "
+ + "127, "
+ + "32767, "
+ + "2147483647, "
+ + "1.0, "
+ + "1.0, "
+ + "123.45, "
+ + "TRUE, "
+ + "TIMESTAMP '2018-05-28 20:17:40', "
Review comment:
Should probably test to microseconds here (`.123456`) as I hear there is
some ambiguity in how they are handled.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
Issue Time Tracking
-------------------
Worklog Id: (was: 116669)
Time Spent: 2.5h (was: 2h 20m)
> Improve SQL's BigQuery write integration test
> ---------------------------------------------
>
> Key: BEAM-4646
> URL: https://issues.apache.org/jira/browse/BEAM-4646
> Project: Beam
> Issue Type: Improvement
> Components: dsl-sql
> Reporter: Rui Wang
> Assignee: Rui Wang
> Priority: Major
> Time Spent: 2.5h
> Remaining Estimate: 0h
>
> Right now SQL's BigQuery write integration test only tests VARCHAR, ARRAY and
> BIGINT, it might be better to test other SQL types which Beam SQL/Calcite is
> supporting.
--
This message was sent by Atlassian JIRA
(v7.6.3#76005)