Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
P
picodata
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Container Registry
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
core
picodata
Commits
9ff808c8
Commit
9ff808c8
authored
1 year ago
by
Georgy Moshkin
Browse files
Options
Downloads
Patches
Plain Diff
fix: pico.raft_log() broke after updating tarantool-sys
parent
bec43c4a
No related branches found
No related tags found
1 merge request
!927
Gmoshkin/join using batch dml
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/luamod.rs
+18
-17
18 additions, 17 deletions
src/luamod.rs
test/int/test_basics.py
+4
-2
4 additions, 2 deletions
test/int/test_basics.py
with
22 additions
and
19 deletions
src/luamod.rs
+
18
−
17
View file @
9ff808c8
...
@@ -904,40 +904,37 @@ pub(crate) fn setup(config: &PicodataConfig) {
...
@@ -904,40 +904,37 @@ pub(crate) fn setup(config: &PicodataConfig) {
let
row_sep
=
|
buf
:
&
mut
Vec
<
u8
>
|
{
let
row_sep
=
|
buf
:
&
mut
Vec
<
u8
>
|
{
match
justify_contents
{
match
justify_contents
{
Justify
::
Left
=>
{
Justify
::
Left
=>
{
// NOTE: here and later a special unicode character \u{200b} is used.
writeln!
(
buf
,
"+{0:-^iw$}+{0:-^tw$}+{0:-<cw$}+"
,
""
)
// This is a ZERO WIDTH SPACE and it helps with the tarantool's console.
// The way it works is that tarantool's console when printing the values
// returned from a function will surround string values with quotes if
// for instance they start with a '|' pipe character, which is our case.
// Adding a space before '|' doesn't help but a ZERO WIDTH SPACE
// for what ever reason does. So this is basically a crutch,
// but if it's good enough for tarantool developers, it's good enough for us.
writeln!
(
buf
,
"
\u{200b}
+{0:-^iw$}+{0:-^tw$}+{0:-<cw$}+"
,
""
)
}
}
Justify
::
Center
=>
{
Justify
::
Center
=>
{
writeln!
(
buf
,
"
\u{200b}
+{0:-^iw$}+{0:-^tw$}+{0:-^cw$}+"
,
""
)
writeln!
(
buf
,
"+{0:-^iw$}+{0:-^tw$}+{0:-^cw$}+"
,
""
)
}
}
Justify
::
Right
=>
{
Justify
::
Right
=>
{
writeln!
(
buf
,
"
\u{200b}
+{0:-^iw$}+{0:-^tw$}+{0:->cw$}+"
,
""
)
writeln!
(
buf
,
"+{0:-^iw$}+{0:-^tw$}+{0:->cw$}+"
,
""
)
}
}
}
}
.unwrap
()
.unwrap
()
};
};
row_sep
(
&
mut
buf
);
row_sep
(
&
mut
buf
);
write!
(
buf
,
"
\u{200b}
|{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
// NOTE: here and later we use the special uincode \u{01c0} symbol.
// It looks like this `ǀ` (exactly like `|`). We do this,
// because tarantool's yaml handler has special behavior when it
// sees a pipe character at the start of the string. This is the
// same thing as what tarantool's `index:fselect()` is doing.
write!
(
buf
,
"
\u{01c0}
{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
write_contents
(
&
mut
buf
,
contents
)
.unwrap
();
write_contents
(
&
mut
buf
,
contents
)
.unwrap
();
row_sep
(
&
mut
buf
);
row_sep
(
&
mut
buf
);
for
[
index
,
term
,
contents
]
in
rows
{
for
[
index
,
term
,
contents
]
in
rows
{
if
contents
.
len
()
<=
cw
{
if
contents
.
chars
()
.count
()
<=
cw
{
write!
(
buf
,
"
\u{
200b}
|
{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
write!
(
buf
,
"
\u{
01c0}
{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
write_contents
(
&
mut
buf
,
&
contents
)
.unwrap
();
write_contents
(
&
mut
buf
,
&
contents
)
.unwrap
();
}
else
{
}
else
{
write!
(
buf
,
"
\u{
200b}
|
{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
write!
(
buf
,
"
\u{
01c0}
{index: ^iw$}|{term: ^tw$}|"
)
.unwrap
();
write_contents
(
&
mut
buf
,
&
contents
[
..
cw
])
.unwrap
();
write_contents
(
&
mut
buf
,
&
contents
[
..
cw
])
.unwrap
();
let
mut
rest
=
&
contents
[
cw
..
];
let
mut
rest
=
&
contents
[
cw
..
];
while
!
rest
.is_empty
()
{
while
!
rest
.is_empty
()
{
let
clamped_cw
=
usize
::
min
(
rest
.len
(),
cw
);
let
clamped_cw
=
usize
::
min
(
rest
.len
(),
cw
);
write!
(
buf
,
"
\u{
200b}
|
{blank: ^iw$}|{blank: ^tw$}|"
,
blank
=
"~"
,)
write!
(
buf
,
"
\u{
01c0}
{blank: ^iw$}|{blank: ^tw$}|"
,
blank
=
"~"
,)
.unwrap
();
.unwrap
();
write_contents
(
&
mut
buf
,
&
rest
[
..
clamped_cw
])
.unwrap
();
write_contents
(
&
mut
buf
,
&
rest
[
..
clamped_cw
])
.unwrap
();
rest
=
&
rest
[
clamped_cw
..
];
rest
=
&
rest
[
clamped_cw
..
];
...
@@ -949,7 +946,11 @@ pub(crate) fn setup(config: &PicodataConfig) {
...
@@ -949,7 +946,11 @@ pub(crate) fn setup(config: &PicodataConfig) {
let
s
=
String
::
from_utf8_lossy
(
&
buf
);
let
s
=
String
::
from_utf8_lossy
(
&
buf
);
let
mut
res
=
vec!
[];
let
mut
res
=
vec!
[];
for
line
in
s
.lines
()
{
for
line
in
s
.lines
()
{
res
.push
(
line
.into
());
// replace all spaces with the non-breaking space character
// to prevent tarantool's yaml handler from breaking the
// rows which we tried so hard to format correctly
let
line
=
line
.replace
(
' '
,
"
\u{a0}
"
);
res
.push
(
line
);
}
}
Ok
(
Some
(
res
))
Ok
(
Some
(
res
))
},
},
...
...
This diff is collapsed.
Click to expand it.
test/int/test_basics.py
+
4
−
2
View file @
9ff808c8
...
@@ -311,10 +311,12 @@ def test_raft_log(instance: Instance):
...
@@ -311,10 +311,12 @@ def test_raft_log(instance: Instance):
# don't care about the vertical lines
# don't care about the vertical lines
continue
continue
# these are the hacks used to make pretty tables work in tarantool's console
line
=
line
.
replace
(
"
\u01c0
"
,
"
|
"
)
line
=
line
.
replace
(
"
\u00a0
"
,
"
"
)
columns
=
line
.
split
(
"
|
"
)
columns
=
line
.
split
(
"
|
"
)
columns
=
[
c
.
strip
()
for
c
in
columns
]
columns
=
[
c
.
strip
()
for
c
in
columns
]
# This is what's to the left of first '|' and it's a special '\u200b' character
columns
[
0
]
=
""
# blank out the index column so we don't need to manually update it
# blank out the index column so we don't need to manually update it
if
columns
[
1
].
isdigit
():
if
columns
[
1
].
isdigit
():
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment