Skip to content

Commit 86c3420

Browse files
evanvdiatdcmeehan
authored andcommitted
Revert "Enrich Update infromation in Queryinfo"
This reverts commit bf21a45.
1 parent 0754edc commit 86c3420

File tree

105 files changed

+117
-767
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+117
-767
lines changed

presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/Analysis.java

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,6 @@
2424
import com.facebook.presto.spi.analyzer.AccessControlInfoForTable;
2525
import com.facebook.presto.spi.analyzer.AccessControlReferences;
2626
import com.facebook.presto.spi.analyzer.AccessControlRole;
27-
import com.facebook.presto.spi.analyzer.UpdateInfo;
2827
import com.facebook.presto.spi.function.FunctionHandle;
2928
import com.facebook.presto.spi.function.FunctionKind;
3029
import com.facebook.presto.spi.security.AccessControl;
@@ -101,7 +100,7 @@ public class Analysis
101100
@Nullable
102101
private final Statement root;
103102
private final Map<NodeRef<Parameter>, Expression> parameters;
104-
private UpdateInfo updateInfo;
103+
private String updateType;
105104

106105
private final Map<NodeRef<Table>, NamedQuery> namedQueries = new LinkedHashMap<>();
107106

@@ -213,14 +212,14 @@ public Statement getStatement()
213212
return root;
214213
}
215214

216-
public UpdateInfo getUpdateInfo()
215+
public String getUpdateType()
217216
{
218-
return updateInfo;
217+
return updateType;
219218
}
220219

221-
public void setUpdateInfo(UpdateInfo updateInfo)
220+
public void setUpdateType(String updateType)
222221
{
223-
this.updateInfo = updateInfo;
222+
this.updateType = updateType;
224223
}
225224

226225
public boolean isCreateTableAsSelectWithData()

presto-analyzer/src/main/java/com/facebook/presto/sql/analyzer/BuiltInQueryAnalysis.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
import com.facebook.presto.spi.TableHandle;
1818
import com.facebook.presto.spi.analyzer.AccessControlReferences;
1919
import com.facebook.presto.spi.analyzer.QueryAnalysis;
20-
import com.facebook.presto.spi.analyzer.UpdateInfo;
2120
import com.facebook.presto.spi.function.FunctionKind;
2221
import com.facebook.presto.sql.tree.Explain;
2322
import com.google.common.collect.ImmutableSet;
@@ -42,9 +41,9 @@ public Analysis getAnalysis()
4241
}
4342

4443
@Override
45-
public UpdateInfo getUpdateInfo()
44+
public String getUpdateType()
4645
{
47-
return analysis.getUpdateInfo();
46+
return analysis.getUpdateType();
4847
}
4948

5049
@Override

presto-cli/src/main/java/com/facebook/presto/cli/Query.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ private boolean renderQueryOutput(PrintStream out, OutputFormat outputFormat, bo
160160
// if running or finished
161161
if (client.isRunning() || (client.isFinished() && client.finalStatusInfo().getError() == null)) {
162162
QueryStatusInfo results = client.isRunning() ? client.currentStatusInfo() : client.finalStatusInfo();
163-
if (results.getUpdateInfo() != null) {
163+
if (results.getUpdateType() != null) {
164164
renderUpdate(errorChannel, results);
165165
}
166166
else if (results.getColumns() == null) {
@@ -220,8 +220,7 @@ private void processInitialStatusUpdates(WarningsPrinter warningsPrinter)
220220

221221
private void renderUpdate(PrintStream out, QueryStatusInfo results)
222222
{
223-
checkState(results.getUpdateInfo() != null, "Update info is null");
224-
String status = results.getUpdateInfo().getUpdateType();
223+
String status = results.getUpdateType();
225224
if (results.getUpdateCount() != null) {
226225
long count = results.getUpdateCount();
227226
status += format(": %s row%s", count, (count != 1) ? "s" : "");

presto-client/src/main/java/com/facebook/presto/client/QueryResults.java

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package com.facebook.presto.client;
1515

1616
import com.facebook.presto.spi.PrestoWarning;
17-
import com.facebook.presto.spi.analyzer.UpdateInfo;
1817
import com.fasterxml.jackson.annotation.JsonCreator;
1918
import com.fasterxml.jackson.annotation.JsonProperty;
2019
import com.google.common.collect.ImmutableList;
@@ -46,7 +45,7 @@ public class QueryResults
4645
private final StatementStats stats;
4746
private final QueryError error;
4847
private final List<PrestoWarning> warnings;
49-
private final UpdateInfo updateInfo;
48+
private final String updateType;
5049
private final Long updateCount;
5150

5251
@JsonCreator
@@ -61,7 +60,7 @@ public QueryResults(
6160
@JsonProperty("stats") StatementStats stats,
6261
@JsonProperty("error") QueryError error,
6362
@JsonProperty("warnings") List<PrestoWarning> warnings,
64-
@JsonProperty("updateInfo") UpdateInfo updateInfo,
63+
@JsonProperty("updateType") String updateType,
6564
@JsonProperty("updateCount") Long updateCount)
6665
{
6766
this(
@@ -75,7 +74,7 @@ public QueryResults(
7574
stats,
7675
error,
7776
firstNonNull(warnings, ImmutableList.of()),
78-
updateInfo,
77+
updateType,
7978
updateCount);
8079
}
8180

@@ -90,7 +89,7 @@ public QueryResults(
9089
StatementStats stats,
9190
QueryError error,
9291
List<PrestoWarning> warnings,
93-
UpdateInfo updateInfo,
92+
String updateType,
9493
Long updateCount)
9594
{
9695
this.id = requireNonNull(id, "id is null");
@@ -104,7 +103,7 @@ public QueryResults(
104103
this.stats = requireNonNull(stats, "stats is null");
105104
this.error = error;
106105
this.warnings = ImmutableList.copyOf(requireNonNull(warnings, "warnings is null"));
107-
this.updateInfo = updateInfo;
106+
this.updateType = updateType;
108107
this.updateCount = updateCount;
109108
}
110109

@@ -227,9 +226,9 @@ public List<PrestoWarning> getWarnings()
227226
@Nullable
228227
@JsonProperty
229228
@Override
230-
public UpdateInfo getUpdateInfo()
229+
public String getUpdateType()
231230
{
232-
return updateInfo;
231+
return updateType;
233232
}
234233

235234
/**
@@ -256,7 +255,7 @@ public String toString()
256255
.add("hasBinaryData", binaryData != null)
257256
.add("stats", stats)
258257
.add("error", error)
259-
.add("updateInfo", updateInfo)
258+
.add("updateType", updateType)
260259
.add("updateCount", updateCount)
261260
.toString();
262261
}

presto-client/src/main/java/com/facebook/presto/client/QueryStatusInfo.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
package com.facebook.presto.client;
1515

1616
import com.facebook.presto.spi.PrestoWarning;
17-
import com.facebook.presto.spi.analyzer.UpdateInfo;
1817

1918
import java.net.URI;
2019
import java.util.List;
@@ -37,7 +36,7 @@ public interface QueryStatusInfo
3736

3837
List<PrestoWarning> getWarnings();
3938

40-
UpdateInfo getUpdateInfo();
39+
String getUpdateType();
4140

4241
Long getUpdateCount();
4342
}

presto-hive/src/test/java/com/facebook/presto/hive/TestHiveIntegrationSmokeTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5891,7 +5891,7 @@ public void testCreateMaterializedView()
58915891
assertQueryFails(
58925892
"CREATE MATERIALIZED VIEW test_customer_view AS SELECT name FROM test_customer_base",
58935893
format(
5894-
".* Destination materialized view '%s.%s.test_customer_view' already exists",
5894+
".* Materialized view '%s.%s.test_customer_view' already exists",
58955895
getSession().getCatalog().get(),
58965896
getSession().getSchema().get()));
58975897
assertQuerySucceeds("CREATE MATERIALIZED VIEW IF NOT EXISTS test_customer_view AS SELECT name FROM test_customer_base");

presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoResultSet.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
import com.facebook.presto.client.QueryStatusInfo;
2121
import com.facebook.presto.client.StatementClient;
2222
import com.facebook.presto.jdbc.ColumnInfo.Nullable;
23-
import com.facebook.presto.spi.analyzer.UpdateInfo;
2423
import com.google.common.collect.AbstractIterator;
2524
import com.google.common.collect.ImmutableList;
2625
import com.google.common.collect.ImmutableMap;
@@ -1776,14 +1775,14 @@ private ResultsPageIterator(StatementClient client, Consumer<QueryStats> progres
17761775

17771776
private static boolean isQuery(StatementClient client)
17781777
{
1779-
UpdateInfo updateInfo;
1778+
String updateType;
17801779
if (client.isRunning()) {
1781-
updateInfo = client.currentStatusInfo().getUpdateInfo();
1780+
updateType = client.currentStatusInfo().getUpdateType();
17821781
}
17831782
else {
1784-
updateInfo = client.finalStatusInfo().getUpdateInfo();
1783+
updateType = client.finalStatusInfo().getUpdateType();
17851784
}
1786-
return updateInfo == null;
1785+
return updateType == null;
17871786
}
17881787

17891788
@Override

presto-jdbc/src/main/java/com/facebook/presto/jdbc/PrestoStatement.java

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
import com.facebook.presto.client.ClientException;
1717
import com.facebook.presto.client.QueryStatusInfo;
1818
import com.facebook.presto.client.StatementClient;
19-
import com.facebook.presto.spi.analyzer.UpdateInfo;
2019
import com.facebook.presto.spi.security.SelectedRole;
2120
import com.google.common.collect.ImmutableMap;
2221
import com.google.common.primitives.Ints;
@@ -53,7 +52,7 @@ public class PrestoStatement
5352
private final AtomicReference<PrestoResultSet> currentResult = new AtomicReference<>();
5453
private final AtomicReference<Optional<WarningsManager>> currentWarningsManager = new AtomicReference<>(Optional.empty());
5554
private final AtomicLong currentUpdateCount = new AtomicLong(-1);
56-
private final AtomicReference<UpdateInfo> currentUpdateType = new AtomicReference<UpdateInfo>();
55+
private final AtomicReference<String> currentUpdateType = new AtomicReference<>();
5756
private final AtomicReference<Optional<Consumer<QueryStats>>> progressCallback = new AtomicReference<>(Optional.empty());
5857
private final Consumer<QueryStats> progressConsumer = value -> progressCallback.get().ifPresent(callback -> callback.accept(value));
5958
private final AtomicInteger statementDepth = new AtomicInteger(0);
@@ -278,7 +277,7 @@ final boolean internalExecute(String sql)
278277
}
279278

280279
// check if this is a query
281-
if (intercepted || client.currentStatusInfo().getUpdateInfo() == null) {
280+
if (intercepted || client.currentStatusInfo().getUpdateType() == null) {
282281
currentResult.set(resultSet);
283282
if (shouldIntercept) {
284283
resultSet = connection().invokeQueryInterceptorsPost(sql, this, resultSet);
@@ -297,7 +296,7 @@ final boolean internalExecute(String sql)
297296

298297
Long updateCount = client.finalStatusInfo().getUpdateCount();
299298
currentUpdateCount.set((updateCount != null) ? updateCount : 0);
300-
currentUpdateType.set(client.finalStatusInfo().getUpdateInfo());
299+
currentUpdateType.set(client.finalStatusInfo().getUpdateType());
301300
warningsManager.addWarnings(client.finalStatusInfo().getWarnings());
302301
return false;
303302
}
@@ -620,7 +619,7 @@ public boolean isWrapperFor(Class<?> iface)
620619
return iface.isInstance(this);
621620
}
622621

623-
public UpdateInfo getUpdateType()
622+
public String getUpdateType()
624623
throws SQLException
625624
{
626625
checkOpen();

presto-jdbc/src/test/java/com/facebook/presto/jdbc/TestPrestoDriver.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@
3535
import com.facebook.presto.metadata.SessionPropertyManager;
3636
import com.facebook.presto.plugin.blackhole.BlackHolePlugin;
3737
import com.facebook.presto.server.testing.TestingPrestoServer;
38-
import com.facebook.presto.spi.analyzer.UpdateInfo;
3938
import com.facebook.presto.spi.security.SelectedRole;
4039
import com.facebook.presto.tpch.TpchMetadata;
4140
import com.facebook.presto.tpch.TpchPlugin;
@@ -1258,7 +1257,7 @@ public void testGetMoreResultsClearsUpdateCount()
12581257
try (PrestoStatement statement = connection.createStatement().unwrap(PrestoStatement.class)) {
12591258
assertFalse(statement.execute("CREATE TABLE test_more_results_clears_update_count (id bigint)"));
12601259
assertEquals(statement.getUpdateCount(), 0);
1261-
assertEquals(statement.getUpdateType(), new UpdateInfo("CREATE TABLE", "test_more_results_clears_update_count"));
1260+
assertEquals(statement.getUpdateType(), "CREATE TABLE");
12621261
assertFalse(statement.getMoreResults());
12631262
assertEquals(statement.getUpdateCount(), -1);
12641263
assertNull(statement.getUpdateType());

presto-main-base/src/main/java/com/facebook/presto/event/QueryMonitor.java

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,6 @@
4848
import com.facebook.presto.server.BasicQueryStats;
4949
import com.facebook.presto.spi.ConnectorId;
5050
import com.facebook.presto.spi.QueryId;
51-
import com.facebook.presto.spi.analyzer.UpdateInfo;
5251
import com.facebook.presto.spi.eventlistener.Column;
5352
import com.facebook.presto.spi.eventlistener.OperatorStatistics;
5453
import com.facebook.presto.spi.eventlistener.QueryCompletedEvent;
@@ -278,7 +277,6 @@ public void queryImmediateFailureEvent(BasicQueryInfo queryInfo, ExecutionFailur
278277
ImmutableSet.of(),
279278
Optional.empty(),
280279
ImmutableMap.of(),
281-
Optional.empty(),
282280
Optional.empty()));
283281

284282
logQueryTimeline(queryInfo);
@@ -322,8 +320,7 @@ public void queryCompletedEvent(QueryInfo queryInfo)
322320
queryInfo.getWindowFunctions(),
323321
queryInfo.getPrestoSparkExecutionContext(),
324322
getPlanHash(queryInfo.getPlanCanonicalInfo(), historyBasedPlanStatisticsTracker.getStatsEquivalentPlanRootNode(queryInfo.getQueryId())),
325-
Optional.of(queryInfo.getPlanIdNodeMap()),
326-
Optional.ofNullable(queryInfo.getUpdateInfo()).map(UpdateInfo::getUpdateObject)));
323+
Optional.of(queryInfo.getPlanIdNodeMap())));
327324

328325
logQueryTimeline(queryInfo);
329326
}
@@ -366,7 +363,7 @@ private QueryMetadata createQueryMetadata(QueryInfo queryInfo)
366363
.map(stageId -> String.valueOf(stageId.getId()))
367364
.collect(toImmutableList()),
368365
queryInfo.getSession().getTraceToken(),
369-
Optional.ofNullable(queryInfo.getUpdateInfo()).map(UpdateInfo::getUpdateType));
366+
Optional.ofNullable(queryInfo.getUpdateType()));
370367
}
371368

372369
private List<OperatorStatistics> createOperatorStatistics(QueryInfo queryInfo)

0 commit comments

Comments
 (0)