Copilot commented on code in PR #6947:
URL: https://github.com/apache/hive/pull/6947#discussion_r4487883324
##########
beeline/src/java/org/apache/hive/beeline/BeeLine.java:
##########
@@ -1543,7 +1544,17 @@ private InputStream prepareInputStream(InputStream
inputStream) {
protected Terminal buildTerminal(InputStream inputStream) throws IOException
{
Terminal terminal;
if (inputStream != null) { // typically when there is a file script to
read from
- terminal = TerminalBuilder.builder().streams(inputStream,
getErrorStream()).build();
+ // Do not use TerminalBuilder.builder().streams(...).build() with the
default provider order: native
+ // providers (ffm/jni/jna) implement newTerminal() by opening a PTY and
return PosixPtyTerminal, which
+ // corrupts or drops lines from large -f scripts. Force the exec
provider so JLine uses a non-PTY
+ // stream terminal with TYPE_DUMB (ExecTerminalProvider.newTerminal);
UTF-8 matches getCommands(File).
+ terminal = TerminalBuilder.builder()
+ .name("beeline")
+ .provider(TerminalBuilder.PROP_PROVIDER_EXEC)
+ .type(Terminal.TYPE_DUMB)
+ .streams(inputStream, getErrorStream())
+ .encoding(StandardCharsets.UTF_8)
Review Comment:
Please add a regression test that exercises the real
`BeeLine.getFileLineReader` terminal construction with a large script and
verifies that every line is preserved, including UTF-8 text and a final line
without a newline. The existing script tests in `TestBeeLineWithArgs` override
`buildTerminal` to return `DumbTerminal` directly (lines 186–200), so they
bypass this change and cannot detect a regression in the provider selection
that caused the corruption.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]