Skip to content
Permalink

Comparing changes

This is a direct comparison between two commits made in this repository or its related repositories. View the default comparison for this range or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: apache/hive
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 4788447ece9aaee9c4ed4f687a07810225e4ccc8
Choose a base ref
..
head repository: apache/hive
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 5275b5c198459a3f410f2e46ca6c33d0d4aecaaa
Choose a head ref
Showing with 2,270 additions and 131 deletions.
  1. +36 −26 beeline/src/java/org/apache/hive/beeline/BeeLine.java
  2. +8 −8 beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java
  3. +5 −1 beeline/src/java/org/apache/hive/beeline/cli/HiveCli.java
  4. +40 −0 beeline/src/test/org/apache/hive/beeline/BeeLineForTest.java
  5. +28 −0 beeline/src/test/org/apache/hive/beeline/cli/HiveCliForTest.java
  6. +1 −1 beeline/src/test/org/apache/hive/beeline/cli/TestHiveCli.java
  7. +1 −1 common/src/java/org/apache/hive/common/util/MatchingStringsCompleter.java
  8. +1 −1 hcatalog/hcatalog-pig-adapter/pom.xml
  9. +6 −6 ...rg/iceberg-handler/src/main/java/org/apache/iceberg/mr/hive/IcebergTransformSortFunctionUtil.java
  10. +1 −1 iceberg/pom.xml
  11. +3 −3 itests/hive-unit/src/test/java/org/apache/hive/beeline/TestBeeLineWithArgs.java
  12. +1 −0 itests/src/test/resources/testconfiguration.properties
  13. +2 −2 pom.xml
  14. +1 −1 ql/src/gen/vectorization/UDAFTemplates/VectorUDAFMinMaxString.txt
  15. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/ColumnStatsUpdateTask.java
  16. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/MoveTask.java
  17. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/OperatorFactory.java
  18. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/ReplCopyTask.java
  19. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/StatsTask.java
  20. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/Task.java
  21. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/TaskRunner.java
  22. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/mr/ExecDriver.java
  23. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/mr/MapredLocalTask.java
  24. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/AtlasDumpTask.java
  25. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/AtlasLoadTask.java
  26. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/ReplicationMigrationTool.java
  27. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/bootstrap/load/LoadDatabase.java
  28. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/ReplUtils.java
  29. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/repl/util/SnapshotUtils.java
  30. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/tez/PerPoolTriggerValidatorRunnable.java
  31. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezTask.java
  32. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TriggerValidatorRunnable.java
  33. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorColumnOrderedMap.java
  34. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/vector/VectorCopyRow.java
  35. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/FilterStringColRegExpStringScalar.java
  36. +7 −13 ql/src/java/org/apache/hadoop/hive/ql/exec/vector/expressions/VectorUDFDayOfWeekString.java
  37. +57 −15 ql/src/java/org/apache/hadoop/hive/ql/optimizer/SharedWorkOptimizer.java
  38. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/cost/HiveOnTezCostModel.java
  39. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HiveJoinToMultiJoinRule.java
  40. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/CrossProductHandler.java
  41. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/LlapDecider.java
  42. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/LlapPreVectorizationPass.java
  43. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/MemoryDecider.java
  44. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/optimizer/physical/SerializeFilter.java
  45. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/plan/ExprDynamicParamDesc.java
  46. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/plan/ExprNodeConstantDesc.java
  47. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/plan/TezWork.java
  48. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/ppd/SyntheticJoinPredicate.java
  49. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/stats/BasicStatsNoJobTask.java
  50. +1 −1 ql/src/java/org/apache/hadoop/hive/ql/stats/ColStatsProcessor.java
  51. +108 −0 ql/src/test/queries/clientpositive/sharedwork_mapjoin_datasize_check.q
  52. +31 −0 ql/src/test/queries/clientpositive/udf_dayofweek_with_tz.q
  53. +1,809 −0 ql/src/test/results/clientpositive/llap/sharedwork_mapjoin_datasize_check.q.out
  54. +72 −0 ql/src/test/results/clientpositive/udf_dayofweek_with_tz.q.out
  55. +3 −2 ...e-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/HiveAlterHandler.java
  56. +5 −10 ...dalone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/ObjectStore.java
  57. +2 −1 ...lone-metastore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MColumn.java
  58. +1 −4 ...tore/metastore-server/src/main/java/org/apache/hadoop/hive/metastore/model/MColumnDescriptor.java
  59. +7 −1 standalone-metastore/pom.xml
62 changes: 36 additions & 26 deletions beeline/src/java/org/apache/hive/beeline/BeeLine.java
Original file line number Diff line number Diff line change
@@ -113,11 +113,13 @@
import com.google.common.annotations.VisibleForTesting;

import org.jline.reader.Completer;
import org.jline.reader.EndOfFileException;
import org.jline.reader.History;
import org.jline.reader.LineReader;
import org.jline.reader.LineReaderBuilder;
import org.jline.reader.impl.LineReaderImpl;
import org.jline.reader.impl.history.DefaultHistory;
import org.jline.terminal.Terminal;
import org.jline.terminal.TerminalBuilder;

import static org.jline.builtins.Completers.FileNameCompleter;
@@ -158,7 +160,7 @@ public class BeeLine implements Closeable {
private OutputFile recordOutputFile = null;
private PrintStream outputStream = new PrintStream(System.out, true);
private PrintStream errorStream = new PrintStream(System.err, true);
private InputStream inputStream = System.in;
private Terminal terminal;
private LineReader lineReader;
private List<String> batch = null;
private final Reflector reflector = new Reflector(this);
@@ -440,7 +442,6 @@ public class BeeLine implements Closeable {
.create());
}


static Manifest getManifest() throws IOException {
URL base = BeeLine.class.getResource("/META-INF/MANIFEST.MF");
URLConnection c = base.openConnection();
@@ -1367,11 +1368,12 @@ private int execute(LineReader reader, boolean exitOnError) {
Character mask = (System.getProperty("jline.terminal", "").equals("jline.UnsupportedTerminal")) ? null
: LineReaderImpl.NULL_MASK;

String line;
while (!exit) {
try {
// Execute one instruction; terminate on executing a script if there is an error
// in silent mode, prevent the query and prompt being echoed back to terminal
String line = (getOpts().isSilent() && getOpts().getScriptFile() != null) ? reader
line = (getOpts().isSilent() && getOpts().getScriptFile() != null) ? reader
.readLine(null, mask) : reader.readLine(getPrompt());

// trim line
@@ -1387,7 +1389,17 @@ private int execute(LineReader reader, boolean exitOnError) {
} else if (line != null) {
lastExecutionResult = ERRNO_OK;
}

} catch (EndOfFileException t) {
/*
* If you're reading from a normal file (not from standard input or a terminal), JLine might raise an
* EndOfFileException when it reaches the end of the file. JLine uses readLine() for reading input, and it
* expects the input source to provide data interactively. When reading from a file, it might misinterpret
* the EOF condition.
* It's unlikely that this catch-and-return-OK block masks a real issue.
* In interactive usage, EndOfFileException is not triggered, and in script file mode (-f),
* any potential corruption would typically surface as a failing command.
*/
return lastExecutionResult;
} catch (Throwable t) {
handleException(t);
return ERRNO_OTHER;
@@ -1416,25 +1428,14 @@ private void addBeelineShutdownHook() throws IOException {

public LineReader initializeLineReader(InputStream inputStream) throws IOException {
final LineReaderBuilder builder = LineReaderBuilder.builder();
if (inputStream != null) {
// ### NOTE: fix for sf.net bug 879425.
// Working around an issue in jline-2.1.2, see https://github.com/jline/jline/issues/10
// by appending a newline to the end of inputstream
InputStream inputStreamAppendedNewline = new SequenceInputStream(inputStream,
new ByteArrayInputStream((new String("\n")).getBytes()));
builder.terminal(TerminalBuilder.builder()
.streams(inputStreamAppendedNewline, getErrorStream()).build());
} else {
builder.terminal(TerminalBuilder.builder()
.streams(getInputStream(), getErrorStream()).build());
}
terminal = buildTerminal(prepareInputStream(inputStream));
builder.terminal(terminal);

if (inputStream instanceof FileInputStream || inputStream instanceof FSDataInputStream) {
// from script.. no need to load history and no need of completer, either
lineReader = builder.build();
return lineReader;
}

try {
// now set the output for the history
if (this.history != null) {
@@ -1449,7 +1450,7 @@ public LineReader initializeLineReader(InputStream inputStream) throws IOExcepti
}

builder.completer(new BeeLineCompleter(this));
lineReader = builder.build();
lineReader = builder.build();
lineReader.unsetOpt(LineReader.Option.HISTORY_TIMESTAMPED);

if (this.history != null) {
@@ -1460,6 +1461,23 @@ public LineReader initializeLineReader(InputStream inputStream) throws IOExcepti

}

private InputStream prepareInputStream(InputStream inputStream) {
if (inputStream != null) {
inputStream = new SequenceInputStream(inputStream,
new ByteArrayInputStream((new String("\n")).getBytes()));
}
return inputStream;
}

protected Terminal buildTerminal(InputStream inputStream) throws IOException {
if (inputStream != null) { // typically when there is a file script to read from
return TerminalBuilder.builder().streams(inputStream, getErrorStream()).build();
} else { // no input stream, normal operation: proper behavior needs a system terminal
// system terminal can only be created with system streams
return TerminalBuilder.builder().system(true).dumb(false).streams(System.in, System.err).build();
}
}

void usage() {
output(loc("cmd-usage"));
}
@@ -2505,18 +2523,10 @@ PrintStream getErrorStream() {
return errorStream;
}

InputStream getInputStream() {
return inputStream;
}

LineReader getLineReader() {
return lineReader;
}

void setLineReader(LineReader reader) {
this.lineReader = reader;
}

List<String> getBatch() {
return batch;
}
16 changes: 8 additions & 8 deletions beeline/src/java/org/apache/hive/beeline/BeeLineOpts.java
Original file line number Diff line number Diff line change
@@ -88,7 +88,6 @@ public class BeeLineOpts implements Completer {
private boolean showElapsedTime = true;
private boolean entireLineAsCommand = false;
private String numberFormat = "default";
private Terminal terminal;
private int maxWidth = DEFAULT_MAX_WIDTH;
private int maxHeight = DEFAULT_MAX_HEIGHT;
private int maxColumnWidth = DEFAULT_MAX_COLUMN_WIDTH;
@@ -155,16 +154,17 @@ public String get(String envVar) {
public BeeLineOpts(BeeLine beeLine, Properties props) {
this.beeLine = beeLine;
try {
terminal = TerminalBuilder.terminal();
Terminal terminal = TerminalBuilder.terminal();
if (terminal.getWidth() > 0) {
maxWidth = terminal.getWidth();
}
if (terminal.getHeight() > 0) {
maxHeight = terminal.getHeight();
}
terminal.close();
} catch(IOException e) {
// nothing to do
}
if (terminal.getWidth() > 0) {
maxWidth = terminal.getWidth();
}
if (terminal.getHeight() > 0) {
maxHeight = terminal.getHeight();
}
loadProperties(props);
}

6 changes: 5 additions & 1 deletion beeline/src/java/org/apache/hive/beeline/cli/HiveCli.java
Original file line number Diff line number Diff line change
@@ -31,11 +31,15 @@ public static void main(String[] args) throws IOException {
}

public int runWithArgs(String[] cmd, InputStream inputStream) throws IOException {
beeLine = new BeeLine(false);
beeLine = createBeeline();
try {
return beeLine.begin(cmd, inputStream);
} finally {
beeLine.close();
}
}

protected BeeLine createBeeline() {
return new BeeLine(false);
}
}
40 changes: 40 additions & 0 deletions beeline/src/test/org/apache/hive/beeline/BeeLineForTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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 org.apache.hive.beeline;

import java.io.IOException;
import java.io.InputStream;

import org.jline.terminal.Terminal;
import org.jline.terminal.impl.DumbTerminal;

public class BeeLineForTest extends BeeLine {

public BeeLineForTest() {
this(true);
}

public BeeLineForTest(boolean isBeeLine) {
super(isBeeLine);
}

protected Terminal buildTerminal(InputStream inputStream) throws IOException {
return new DumbTerminal(inputStream, getOutputStream());
}
}
28 changes: 28 additions & 0 deletions beeline/src/test/org/apache/hive/beeline/cli/HiveCliForTest.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License 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 org.apache.hive.beeline.cli;

import org.apache.hive.beeline.BeeLine;
import org.apache.hive.beeline.BeeLineForTest;

public class HiveCliForTest extends HiveCli {

protected BeeLine createBeeline() {
return new BeeLineForTest(false);
}
}
Original file line number Diff line number Diff line change
@@ -294,7 +294,7 @@ public static void init(){
@Before
public void setup() throws IOException, URISyntaxException {
System.setProperty("datanucleus.schema.autoCreateAll", "true");
cli = new HiveCli();
cli = new HiveCliForTest();
redirectOutputStream();
initFromFile();
}
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
import java.util.TreeSet;

/**
* A matching string Completer based on JLine2's StringCompleter
* A matching string Completer based on JLine's StringCompleter
*/
public class MatchingStringsCompleter implements Completer {
protected SortedSet<String> candidateStrings = new TreeSet<>();
2 changes: 1 addition & 1 deletion hcatalog/hcatalog-pig-adapter/pom.xml
Original file line number Diff line number Diff line change
@@ -30,7 +30,7 @@
<name>Hive HCatalog Pig Adapter</name>
<properties>
<hive.path.to.root>../..</hive.path.to.root>
<jline.version>3.21.0</jline.version>
<jline.version>3.25.0</jline.version> <!-- HIVE-28992: only upgrade to newer than 3.25.0 if you tested the prompt -->
</properties>
<dependencies>
<!-- dependencies are always listed in sorted order by groupId, artifactId -->
Original file line number Diff line number Diff line change
@@ -50,7 +50,7 @@ private IcebergTransformSortFunctionUtil() {
* Takes the source column index and the bucket count to create a function where Iceberg transform UDF is used to
* build the sort expression, e.g. iceberg_bucket(_col2, 5)
*/
private static final transient BiFunction<Integer, Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final BiFunction<Integer, Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
BUCKET_SORT_EXPR =
(idx, bucket) -> cols -> {
try {
@@ -65,7 +65,7 @@ private IcebergTransformSortFunctionUtil() {
}
};

private static final transient BiFunction<Integer, Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final BiFunction<Integer, Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
TRUNCATE_SORT_EXPR =
(idx, truncateLength) -> cols -> {
try {
@@ -80,7 +80,7 @@ private IcebergTransformSortFunctionUtil() {
}
};

private static final transient Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
YEAR_SORT_EXPR =
idx -> cols -> {
try {
@@ -94,7 +94,7 @@ private IcebergTransformSortFunctionUtil() {
}
};

private static final transient Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
MONTH_SORT_EXPR =
idx -> cols -> {
try {
@@ -108,7 +108,7 @@ private IcebergTransformSortFunctionUtil() {
}
};

private static final transient Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
DAY_SORT_EXPR =
idx -> cols -> {
try {
@@ -122,7 +122,7 @@ private IcebergTransformSortFunctionUtil() {
}
};

private static final transient Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
private static final Function<Integer, Function<List<ExprNodeDesc>, ExprNodeDesc>>
HOUR_SORT_EXPR =
idx -> cols -> {
try {
2 changes: 1 addition & 1 deletion iceberg/pom.xml
Original file line number Diff line number Diff line change
@@ -29,7 +29,7 @@
<iceberg.version>1.6.1</iceberg.version>
<kryo-shaded.version>4.0.3</kryo-shaded.version>
<iceberg.mockito-core.version>5.2.0</iceberg.mockito-core.version>
<iceberg.avro.version>1.11.4</iceberg.avro.version>
<iceberg.avro.version>1.12.0</iceberg.avro.version>
<iceberg.checkstyle.plugin.version>3.5.0</iceberg.checkstyle.plugin.version>
<spotless.maven.plugin.version>2.44.4</spotless.maven.plugin.version>
<google.errorprone.version>2.29.2</google.errorprone.version>
Original file line number Diff line number Diff line change
@@ -161,7 +161,7 @@ public static void postTests() {
static String testCommandLineScript(List<String> argList, InputStream inputStream,
OutStream streamType)
throws Throwable {
BeeLine beeLine = new BeeLine();
BeeLine beeLine = new BeeLineForTest();
ByteArrayOutputStream os = new ByteArrayOutputStream();
PrintStream beelineOutputStream = new PrintStream(os);
switch (streamType) {
@@ -266,8 +266,8 @@ public Tuple<Pattern> apply(Tuple<String> tuple) {
boolean matches = m.matches();
if (patternToMatch.shouldMatch != matches) {
//failed
fail("Output" + output + " should" + (patternToMatch.shouldMatch ? "" : " not") +
" contain " + patternToMatch.pattern.pattern());
fail(String.format("Output '%s' should %s contain '%s' (mode: %s)", output, (patternToMatch.shouldMatch ? "" :
" not"), patternToMatch.pattern.pattern(), mode));
}
}
}
1 change: 1 addition & 0 deletions itests/src/test/resources/testconfiguration.properties
Original file line number Diff line number Diff line change
@@ -306,6 +306,7 @@ mr.query.files=\
udaf_percentile_approx_23.q,\
udf_context_aware.q,\
udf_count.q,\
udf_dayofweek_with_tz.q,\
udf_using.q,\
uniquejoin.q,\
windowing_windowspec.q
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -110,7 +110,7 @@
<antlr4.version>4.9.3</antlr4.version>
<apache-directory-server.version>2.0.0-M24</apache-directory-server.version>
<avatica.version>1.23.0</avatica.version>
<avro.version>1.11.4</avro.version>
<avro.version>1.12.0</avro.version>
<bcprov-jdk18on.version>1.78</bcprov-jdk18on.version>
<calcite.version>1.33.0</calcite.version>
<datanucleus-api-jdo.version>6.0.3</datanucleus-api-jdo.version>
@@ -160,7 +160,7 @@
<jettison.version>1.5.4</jettison.version>
<jetty.version>9.4.57.v20241219</jetty.version>
<jersey.version>1.19.4</jersey.version>
<jline.version>3.30.4</jline.version>
<jline.version>3.25.0</jline.version> <!-- HIVE-28992: only upgrade to newer than 3.25.0 if you tested the prompt -->
<jms.version>2.0.2</jms.version>
<joda.version>2.13.0</joda.version>
<jodd.version>6.0.0</jodd.version>
Loading