Skip to content

Commit

Permalink
fix bugs for lpad rpad and shell
Browse files Browse the repository at this point in the history
  • Loading branch information
anuchak committed Nov 18, 2022
1 parent 8926807 commit 6361d9f
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ struct BaseLowerUpperOperation {
static uint32_t getResultLen(char* inputStr, uint32_t inputLen, bool isUpper);
static void convertCase(char* result, uint32_t len, char* input, bool toUpper);
};

} // namespace operation
} // namespace function
} // namespace kuzu
3 changes: 3 additions & 0 deletions src/function/string/operations/include/base_pad_operation.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ struct BasePadOperation {
ku_string_t& result, ValueVector& resultValueVector,
void (*padOperation)(
ku_string_t& src, int64_t count, ku_string_t& characterToPad, string& paddedResult)) {
if(count < 0) {
count = 0;
}
string paddedResult;
padOperation(src, count, characterToPad, paddedResult);
result.len = paddedResult.size();
Expand Down
14 changes: 14 additions & 0 deletions test/test_files/tinySNB/function/string.test
Original file line number Diff line number Diff line change
Expand Up @@ -346,6 +346,13 @@ Huber
âóâThe 😂😃🧘🏻‍♂️🌍🌦️🍞🚗 movie
âóâóâóâóâóâóâóâóâóâóâRoma

-NAME LpadNegativeCount
-QUERY MATCH (m:movies) RETURN lpad(m.name, -1, ".")
---- 3




# TODO(Semih): Uncomment when enabling ad-hoc properties
#-NAME LpadStructuredStrAndStructuredInt
#-QUERY MATCH (p:person) RETURN lpad(p.fName, p.ID, "<")
Expand Down Expand Up @@ -390,6 +397,13 @@ Sóló cón tu párejââó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞
The 😂😃🧘🏻‍♂️🌍🌦️🍞🚗 movieâó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞
Romaâó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞🚗âó😂😃🍞

-NAME RpadNegativeCount
-QUERY MATCH (m:movies) RETURN rpad(m.name, -1, "âó😂😃🍞🚗")
---- 3




-NAME RpadStructuredStrAndStructuredInt
-QUERY MATCH (p:person) RETURN rpad(p.fName, p.ID, "<")
---- 8
Expand Down
3 changes: 1 addition & 2 deletions third_party/utf8proc/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ cc_library(
hdrs = glob([
"include/*.h",
]),
visibility = ["//visibility:public"],
deps = [],
visibility = ["//visibility:public"]
)

2 changes: 1 addition & 1 deletion tools/shell/linenoise.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -820,7 +820,7 @@ void linenoiseEditMoveRight(struct linenoiseState* l) {

/* Checks to see if character defines a separation between words */
bool isWordSeparator(char c) {
return (!isalpha(c) && !isdigit(c));
return (c == 0x20);
}

/* Move cursor one word to the left */
Expand Down

0 comments on commit 6361d9f

Please sign in to comment.