Compare commits

...

5 Commits

Author SHA1 Message Date
sponomarova
becda23e39 patch(TPS-3137): modify release notes 2019-05-31 16:07:37 +03:00
sponomarova
d42ea7e4b8 patch(TPS-3137): add release notes 2019-05-31 16:05:38 +03:00
Hanna Liashchuk
710d5b4fe5 fix(TBD-8649): activated option allowLargeResult for BigQuery service account 2019-05-31 12:39:09 +03:00
Hanna Liashchuk
67b3d22dce fix(TBD-8649): activated option allowLargeResult for BigQuery service… (#3485)
* fix(TBD-8649): activated option allowLargeResult for BigQuery service account

* Update tBigQueryInput_begin.javajet

* Update tBigQueryInput_begin.javajet

* Update tBigQueryInput_begin.javajet
2019-05-31 12:34:07 +03:00
sponomarova
6d99e820ed patch(TPS-3137): tBigQueryInput - Always fails when you have more than one 2019-05-31 12:33:35 +03:00
4 changed files with 102 additions and 16 deletions

74
PATCH_RELEASE_NOTE.md Normal file
View File

@@ -0,0 +1,74 @@
---
version: 7.1.1
module: https://talend.poolparty.biz/coretaxonomy/42
product: https://talend.poolparty.biz/coretaxonomy/22
---
# TPS-3137
| Info | Value |
| ---------------- | ---------------- |
| Patch Name | Patch\_20190531\_TPS-3137\_v1-7.1.1|
| Release Date | 2019-06-07 |
| Target Version | 20181026\_1147-v7.1.1 |
| Product affected | Talend Studio |
## Introduction <!-- mandatory -->
This is a self-contained patch.
**NOTE**: For information on how to obtain this patch, reach out to your Support contact at Talend.
## Fixed issues <!-- mandatory -->
This patch contains the following fixes:
- TPS-3137 resolves tBigQueryInput component doesn't contain field Result Size when the authentication type is Service account(TBD-8649)
## Prerequisites <!-- mandatory -->
Consider the following requirements for your system:
- Talend Studio 7.1.1 must be installed.
- Patch_20190218_TPS-2912_v1 must be installed.
- Patch_20190326_TPS-2958_v1 must be installed.
## Installation <!-- mandatory -->
### Installing the patch using Software update <!-- if applicable -->
1) Logon TAC and switch to Configuration->Software Update, then enter the correct values and save referring to the documentation: https://help.talend.com/reader/f7Em9WV_cPm2RRywucSN0Q/j9x5iXV~vyxMlUafnDejaQ
2) Switch to Software update page, where the new patch will be listed. The patch can be downloaded from here into the nexus repository.
3) On Studio Side: Logon Studio with remote mode, on the logon page the Update button is displayed: click this button to install the patch.
### Installing the patch using Talend Studio <!-- if applicable -->
1) Create a folder named "patches" under your studio installer directory and copy the patch .zip file to this folder.
2) Restart your studio: a window pops up, then click OK to install the patch, or restart the commandline and the patch will be installed automatically.
### Installing the patch using Commandline <!-- if applicable -->
Execute the following commands:
1. Talend-Studio-win-x86_64.exe -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace startServer -p 8002 --talendDebug
2. initRemote {tac_url} -ul {TAC login username} -up {TAC login password}
3. checkAndUpdate -tu {TAC login username} -tup {TAC login password}
## Affected files for this patch <!-- if applicable -->
The following files are installed by this patch:
- tBigQueryInput_begin.javajet
- tBigQueryInput_end.javajet
- tBigQueryInput_java.xml

View File

@@ -28,7 +28,8 @@
String authorizationCode = ElementParameterParser.getValue(node,"__AUTHORIZATION_CODE__");
String query = ElementParameterParser.getValue(node,"__QUERY__");
boolean useLegacySql = ElementParameterParser.getBooleanValue(node,"__USE_LEGACY_SQL__");
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
query = query.replaceAll("\n"," ");
query = query.replaceAll("\r"," ");
@@ -177,9 +178,7 @@
}
<%
String resultSizeType = ElementParameterParser.getValue(node,"__RESULT_SIZE__");
%>
<%@ include file="@{org.talend.designer.components.localprovider}/components/tBigQueryInput/BigQueryInputQueryHelper.javajet"%>
// Start a Query Job
@@ -198,7 +197,7 @@
<%
if(isLog4jEnabled){
%>
log.info("<%=cid%> - Try <%="LARGE".equals(resultSizeType) ? "with" : "without"%> allow large results flag");
log.info("<%=cid%> - Try <%="LARGE".equals(resultSizeType) ? "with" : "without"%> the allowLargeResults flag");
<%
}
%>
@@ -221,15 +220,30 @@
credentials_<%=cid%> = com.google.auth.oauth2.ServiceAccountCredentials.fromStream(credentialsStream_<%=cid%>);
}
String query_<%=cid%> = <%=query%>;
String dataset = query_<%=cid%>.substring(query_<%=cid%>.indexOf("from") + 4, query_<%=cid%>.indexOf(".")).trim();
String temp_table = "temp_" + dataset + java.util.UUID.randomUUID().toString().replaceAll("-", "")
+ "<%=cid%>".toLowerCase().replaceAll("[^a-z0-9]", "0").replaceAll("^[^a-z]", "a")
+ Integer.toHexString(java.util.concurrent.ThreadLocalRandom.current().nextInt());
com.google.cloud.bigquery.BigQuery bigquery_<%=cid%> = com.google.cloud.bigquery.BigQueryOptions.newBuilder()
.setCredentials(credentials_<%=cid%>)
.setProjectId(<%=projectId%>)
.build()
.getService();
com.google.cloud.bigquery.QueryJobConfiguration queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>).build();
com.google.cloud.bigquery.JobId jobId_tBigQueryInput_1 = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>).setJobId(jobId_<%=cid%>).build());
com.google.cloud.bigquery.QueryJobConfiguration.Builder queryConfiguration_<%=cid%> = com.google.cloud.bigquery.QueryJobConfiguration.newBuilder(<%=query%>).setUseLegacySql(<%=useLegacySql%>);
<%
if (resultSizeType.equals("LARGE") || resultSizeType.equals("AUTO")) {
%>
queryConfiguration_<%=cid%>.setDestinationTable(com.google.cloud.bigquery.TableId.of(dataset, temp_table)).setAllowLargeResults(true);
<%
}
%>
com.google.cloud.bigquery.JobId jobId_<%=cid%> = com.google.cloud.bigquery.JobId.of(java.util.UUID.randomUUID().toString());
com.google.cloud.bigquery.Job job_<%=cid%> = bigquery_<%=cid%>.create(com.google.cloud.bigquery.JobInfo.newBuilder(queryConfiguration_<%=cid%>.build()).setJobId(jobId_<%=cid%>).build());
<%
if(isLog4jEnabled){
@@ -239,7 +253,7 @@
}
%>
job_<%=cid%> = job_<%=cid%>.waitFor();
if (job_<%=cid%> == null) {
throw new RuntimeException("Job no longer exists");
} else if (job_<%=cid%>.getStatus().getError() != null) {
@@ -253,9 +267,7 @@
<%
}
%>
com.google.cloud.bigquery.TableResult result_<%=cid%> = job_<%=cid%>.getQueryResults();
long nb_line_<%=cid%> = 0;
<%
} else {
@@ -276,7 +288,6 @@
.setPageToken(pageToken_<%=cid%>).execute();
List<com.google.api.services.bigquery.model.TableRow> rows_<%=cid %> = dataList_<%=cid %>.getRows();
if(rows_<%=cid %> == null) {
// Means there is no record.
rows_<%=cid %> = new java.util.ArrayList<com.google.api.services.bigquery.model.TableRow>();
@@ -334,6 +345,7 @@
}
%>
if(com.google.api.client.util.Data.isNull(value_<%=cid%>)) value_<%=cid%> = null;
if(value_<%=cid%> != null){
<%
@@ -342,7 +354,7 @@
<%=connName%>.<%=columnName%> = value_<%=cid%>.toString();
<%
} else if (javaType == JavaTypesManager.OBJECT) {
%>
%>
<%=connName%>.<%=columnName%> = value_<%=cid%>;
<%
} else if(javaType == JavaTypesManager.DATE) {
@@ -350,7 +362,7 @@
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_Date(value_<%=cid%>.toString());
<%
} else if(advancedSeparator && JavaTypesManager.isNumberType(javaType)) {
%>
%>
<%=connName%>.<%=columnName%> = ParserUtils.parseTo_<%= typeToGenerate %>(ParserUtils.parseTo_Number(value_<%=cid%>.toString(), <%= thousandsSeparator %>, <%= decimalSeparator %>));
<%
} else if(javaType == JavaTypesManager.BYTE_ARRAY) {

View File

@@ -24,6 +24,7 @@ imports="
} else if (authMode.equals("SERVICEACCOUNT")) {
%>
}
bigquery_<%=cid%>.delete(com.google.cloud.bigquery.TableId.of(dataset, temp_table));
<%
} else {
throw new IllegalArgumentException("authentication mode should be either \"SERVICEACCOUNT\" or \"OAUTH\", but it is " + authMode);

View File

@@ -125,7 +125,6 @@
FIELD="CLOSED_LIST"
NUM_ROW="60"
REQUIRED="true"
SHOW_IF="AUTH_MODE == 'OAUTH'"
>
<ITEMS DEFAULT="SMALL">
<ITEM NAME="SMALL" VALUE="SMALL" />