Skip to content

Draw the Beam SQL live view's lines in tmux and Cloud Shell - #41657

Open
ahmedabu98 wants to merge 1 commit into
apache:masterfrom
ahmedabu98:sql-live-view-box-chars
Open

ahmedabu98 wants to merge 1 commit into
apache:masterfrom
ahmedabu98:sql-live-view-box-chars

Conversation

@ahmedabu98

Copy link
Copy Markdown
Contributor

Follow-up to #41408.

In tmux, the live view's table lines show up as letters: │ comes out as x and ─ as q, so the header reads op x id x item x qty over a row of qqqqnqqqq. Cloud Shell runs every terminal in tmux, so it happens there too.

tmux and screen draw lines from a second character set, which a program has to load (the enacs capability) before it switches to it. JLine switches to that set to draw the table but never loads it, so tmux prints the letters it was given. xterm-style terminals don't need the extra step, which is why the view looks right in most terminals.

The view now sends enacs when it opens. Terminals without the capability skip it.

I checked it in tmux 3.6. With the change, an attached client gets │, and without it, a plain x. A new test checks that the view loads the set before it draws the first line.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

📋 Review Summary

This PR enables the alternate character set (Capability.ena_acs / enacs) when initializing LiveResultView, fixing an issue in tmux, screen, and Cloud Shell where box-drawing characters were rendered as ASCII letters (x, q, n). The change is concise, safe for terminals without the enacs capability, and verified with a unit test.

🔍 General Feedback

  • The fix accurately addresses JLine's assumption that the G1 character set is already loaded with DEC Special Graphics when emitting enter_alt_charset_mode (SO).
  • In LiveResultViewTest, the helper method wraps() has a minor parser assumption about character set selection escape sequences that would be good to update if wraps() is ever used with screen or tmux terminal outputs.

💡 Tip: Comment /gemini review on this pull request to trigger a new Gemini code review.

💬 Inline Findings

  • sdks/java/extensions/sql/jdbc/src/test/java/org/apache/beam/sdk/extensions/sql/jdbc/LiveResultViewTest.java (line 259): 🟢 Low: FYI: Since Capability.ena_acs is now emitted (which sends \033(B\033)0 on screen/tmux terminals), wraps() currently only skips 2 characters after \033 for ( and only 1 character for ), which would leave the trailing '0' in \033)0 to be counted as a printable character if wraps() is ever called on screen/tmux output. Handling output.charAt(i) == ')' alongside '(' in wraps() would keep the test helper resilient.

@github-actions github-actions Bot added java extensions sql size/s S: 10-49 lines changed labels Nov 24, 2026
@codecov

codecov Bot commented Nov 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 58.04%. Comparing base (e502259) to head (8c9fa9d).
⚠️ Report is 4 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #41657      +/-   ##
============================================
- Coverage     59.44%   58.04%   -1.40%     
+ Complexity     5156     2841    -2315     
============================================
  Files          1470     1210     -260     
  Lines        187755   173283   -14472     
  Branches       3828     2329    -1499     
============================================
- Hits         111604   100578   -11026     
+ Misses        72746    69994    -2752     
+ Partials       3405     2711     -694     
Flag Coverage Δ
java 66.42% <100.00%> (-4.46%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions

Copy link
Copy Markdown
Contributor

Assigning reviewers:

R: @Abacn for label java.
Backup reviewer: damccorm (if the main reviewer is unresponsive, you can escalate to them by tagging their username)

Note: If you would like to opt out of this review, comment assign to next reviewer.

Available commands:

  • stop reviewer notifications - opt out of the automated review tooling
  • remind me after tests pass - tag the comment author after tests pass
  • waiting on author - shift the attention set back to the author (any comment or push by the author will return the attention set to the reviewers)

The PR bot will only process comments in the main thread (not review comments).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant