Skip to content

Commit cf85053

Browse files
Merge branch 'apache:master' into ASYNC_IMPORT
2 parents a65a5f8 + b29c9f7 commit cf85053

File tree

19 files changed

+13902
-44
lines changed

19 files changed

+13902
-44
lines changed

.asf.yaml

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,6 @@ github:
3232
squash: true
3333
merge: false
3434
rebase: false
35-
notifications:
36-
37-
38-
pullrequests: [email protected]
39-
pullrequests_comment: [email protected]
40-
jira_options: worklog link label
4135
protected_branches:
4236
master: {}
4337
collaborators:
@@ -48,3 +42,10 @@ github:
4842
- pinal-shah
4943
- rkundam
5044
- sarathsubramanian
45+
46+
notifications:
47+
48+
49+
pullrequests: [email protected]
50+
pullrequests_comment: [email protected]
51+
jira_options: worklog link label

addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/ImpalaLineageHook.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -107,6 +107,7 @@ public void process(ImpalaQuery lineageQuery) throws Exception {
107107
case CREATETABLE_AS_SELECT:
108108
case ALTERVIEW_AS:
109109
case QUERY:
110+
case QUERY_WITH_CLAUSE:
110111
event = new CreateImpalaProcess(context);
111112
break;
112113
default:

addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/ImpalaOperationParser.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ public class ImpalaOperationParser {
4141
private static final Pattern INSERT_SELECT_FROM_PATTERN =
4242
Pattern.compile("^[ ]*\\binsert\\b.*\\b(into|overwrite)\\b.*\\bselect\\b.*\\bfrom\\b.*", Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
4343

44+
private static final Pattern WITH_CLAUSE_INSERT_SELECT_FROM_PATTERN =
45+
Pattern.compile("^[ ]*(\\bwith\\b.*)?\\s*\\binsert\\b.*\\b(into|overwrite)\\b.*\\bselect\\b.*\\bfrom\\b.*", Pattern.DOTALL | Pattern.CASE_INSENSITIVE);
46+
4447
public ImpalaOperationParser() {
4548
}
4649

@@ -55,6 +58,9 @@ public static ImpalaOperationType getImpalaOperationType(String queryText) {
5558
return ImpalaOperationType.ALTERVIEW_AS;
5659
} else if (doesMatch(queryTextWithNoComments, INSERT_SELECT_FROM_PATTERN)) {
5760
return ImpalaOperationType.QUERY;
61+
} else if (doesMatch(queryTextWithNoComments, WITH_CLAUSE_INSERT_SELECT_FROM_PATTERN)) {
62+
return ImpalaOperationType.QUERY_WITH_CLAUSE;
63+
5864
}
5965

6066
return ImpalaOperationType.UNKNOWN;

addons/impala-bridge/src/main/java/org/apache/atlas/impala/hook/events/BaseImpalaEvent.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -208,8 +208,8 @@ protected String getQualifiedName(List<AtlasEntity> inputs, List<AtlasEntity> ou
208208
}
209209
}
210210

211-
if (operation != ImpalaOperationType.QUERY) {
212-
String errorMessage = String.format("Expect operation to be QUERY, but get unexpected operation type {}", operation.name());
211+
if (operation != ImpalaOperationType.QUERY && operation != ImpalaOperationType.QUERY_WITH_CLAUSE) {
212+
String errorMessage = String.format("Expect operation to be QUERY or QUERY_WITH_CLAUSE, but get unexpected operation type {}", operation.name());
213213
LOG.error(errorMessage);
214214
throw new IllegalArgumentException(errorMessage);
215215
}

addons/impala-bridge/src/main/java/org/apache/atlas/impala/model/ImpalaOperationType.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ public enum ImpalaOperationType{
2323
CREATETABLE_AS_SELECT ("CREATETABLE_AS_SELECT"),
2424
ALTERVIEW_AS ("ALTERVIEW_AS"),
2525
QUERY ("QUERY"),
26+
QUERY_WITH_CLAUSE ("QUERY_WITH_CLAUSE"),
2627

2728
// sub operation type, which is associated with output
2829
INSERT ("INSERT"),
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
/**
2+
* Licensed to the Apache Software Foundation (ASF) under one
3+
* or more contributor license agreements. See the NOTICE file
4+
* distributed with this work for additional information
5+
* regarding copyright ownership. The ASF licenses this file
6+
* to you under the Apache License, Version 2.0 (the
7+
* "License"); you may not use this file except in compliance
8+
* with the License. You may obtain a copy of the License at
9+
*
10+
* http://www.apache.org/licenses/LICENSE-2.0
11+
*
12+
* Unless required by applicable law or agreed to in writing, software
13+
* distributed under the License is distributed on an "AS IS" BASIS,
14+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15+
* See the License for the specific language governing permissions and
16+
* limitations under the License.
17+
*/
18+
19+
package org.apache.atlas.impala.hook;
20+
21+
import org.apache.atlas.impala.model.ImpalaOperationType;
22+
import org.apache.commons.lang.RandomStringUtils;
23+
import org.slf4j.Logger;
24+
import org.slf4j.LoggerFactory;
25+
import org.testng.annotations.DataProvider;
26+
import org.testng.annotations.Test;
27+
28+
import java.util.HashMap;
29+
import java.util.Map;
30+
31+
import static org.testng.Assert.assertEquals;
32+
import static org.testng.Assert.fail;
33+
34+
public class ImpalaLineageHookTest {
35+
private static final Logger LOG = LoggerFactory.getLogger(ImpalaLineageHookTest.class);
36+
37+
@Test(dataProvider = "queryDataProvider")
38+
public void testAllImpalaOperationTypes(String query, ImpalaOperationType expectedOperationType) {
39+
try {
40+
ImpalaOperationType operationType = ImpalaOperationParser.getImpalaOperationType(query);
41+
assertEquals(operationType, expectedOperationType);
42+
} catch (Exception e) {
43+
fail("Query processing failed for query: " + query + " due to exception: " + e.getMessage());
44+
}
45+
}
46+
47+
@DataProvider(name = "queryDataProvider")
48+
public Object[][] provideTestData() {
49+
String table1 = "table_" + random();
50+
String table2 = "table_" + random();
51+
52+
return new Object[][] {
53+
{ "CREATE VIEW my_view AS SELECT id, name FROM " + table1, ImpalaOperationType.CREATEVIEW },
54+
{ "CREATE TABLE " + table1 + " AS SELECT id, name FROM " + table1, ImpalaOperationType.CREATETABLE_AS_SELECT },
55+
{ "ALTER VIEW my_view AS SELECT id, name FROM " + table1, ImpalaOperationType.ALTERVIEW_AS },
56+
{ "INSERT INTO " + table1 + " SELECT id, name FROM " + table1, ImpalaOperationType.QUERY },
57+
{ "WITH filtered_data AS (SELECT id, name, amount FROM " + table1 + " WHERE amount > 100) " +
58+
"INSERT INTO " + table2 + " SELECT id, name, amount FROM filtered_data", ImpalaOperationType.QUERY_WITH_CLAUSE }
59+
};
60+
}
61+
62+
private String random() {
63+
return RandomStringUtils.randomAlphanumeric(10);
64+
}
65+
}

build-tools/src/main/resources/ui-dist/index.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,19 @@
5151
window.ui = ui;
5252

5353
atlasLogo = gatewayUrl + "/img/atlas_logo.svg";
54-
$('#swagger-ui img').attr("src", atlasLogo);
54+
setTimeout(() => {
55+
const logoAnchor = document.querySelector(".swagger-ui .topbar a");
56+
57+
if (logoAnchor) {
58+
const svgLogo = logoAnchor.querySelector("svg");
59+
if (svgLogo) svgLogo.remove();
60+
const img = document.createElement("img");
61+
img.src = atlasLogo;
62+
img.alt = "Atlas Logo";
63+
img.style.height = "40px";
64+
logoAnchor.appendChild(img);
65+
}
66+
}, 500);
5567

5668
fetchCsrfHeader();
5769
}

build-tools/src/main/resources/ui-dist/swagger-ui-bundle.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tools/src/main/resources/ui-dist/swagger-ui-standalone-preset.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build-tools/src/main/resources/ui-dist/swagger-ui.css

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

client/common/src/main/java/org/apache/atlas/AtlasBaseClient.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -497,10 +497,11 @@ protected <T> T callAPIWithResource(API api, WebResource resource, Object reques
497497
} catch (ClientHandlerException e) {
498498
throw new AtlasServiceException(api, e);
499499
}
500-
} else if (clientResponse.getStatus() != ClientResponse.Status.SERVICE_UNAVAILABLE.getStatusCode()) {
500+
} else if (clientResponse.getStatus() != ClientResponse.Status.SERVICE_UNAVAILABLE.getStatusCode() &&
501+
clientResponse.getStatus() != ClientResponse.Status.INTERNAL_SERVER_ERROR.getStatusCode()) {
501502
break;
502503
} else {
503-
LOG.error("Got a service unavailable when calling: {}, will retry..", resource);
504+
LOG.error("attempt #{}: error {} when calling: {}, will retry..", (i + 1), clientResponse.getStatus(), resource);
504505

505506
sleepBetweenRetries();
506507
}

dashboardv2/gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ module.exports = function(grunt) {
247247
files: [{
248248
expand: true,
249249
cwd: distPath + '/js',
250-
src: ['**/*.js', '!libs/**', '!external_lib/**/purify.min.js', '!external_lib/**'],
250+
src: ['**/*.js', '!libs/**', '!external_lib/**'],
251251
dest: distPath + '/js'
252252
}]
253253
}

dashboardv2/public/js/external_lib/dompurify/purify.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dashboardv3/gruntfile.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ module.exports = function(grunt) {
253253
files: [{
254254
expand: true,
255255
cwd: distPath + '/js',
256-
src: ['**/*.js', '!libs/**', '!external_lib/**/purify.min.js', '!external_lib/**'],
256+
src: ['**/*.js', '!libs/**', '!external_lib/**'],
257257
dest: distPath + '/js'
258258
}]
259259
}

dashboardv3/public/js/external_lib/dompurify/purify.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)