-
Notifications
You must be signed in to change notification settings - Fork 234
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support comma in column value for service test csv data #1899
Conversation
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
...alStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/DDL/testDDL.pure
Outdated
Show resolved
Hide resolved
db9fb45
to
030e84c
Compare
...alStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/DDL/testDDL.pure
Show resolved
Hide resolved
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
...alStore-pure/src/main/resources/core_relational/relational/sqlQueryToString/DDL/testDDL.pure
Show resolved
Hide resolved
...tore-pure/src/main/resources/core_relational/relational/helperFunctions/helperFunctions.pure
Outdated
Show resolved
Hide resolved
'personTable\n'+ | ||
'id, firstName, lastName, age, addressId, firmId, managerId\n'+ | ||
'1,Peter, "I\'m Smith, Jr",23,1,1,2'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there is issue with the following test case:
'1,Peter's, "I\'m Smith, Jr" ,23,1,1,2'
We need to add logic to handle the case when quote is not the first character
let charArray = chunk($s, 1); | ||
let finalSplitterState = $charArray->fold({currentChar, splitterState| | ||
if ($currentChar == '\'' || $currentChar == '\"', | ||
|if (!$splitterState.inQuotes, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (!$splitterState.inQuotes && !$splitterState.currentTokenChars->anySatisfy(x| $x != ' '),
@@ -129,7 +129,7 @@ function <<paramTest.BeforePackage>> meta::relational::tests::dbSpecificTests::s | |||
'---\n'+ | |||
'default\n'+ | |||
'testTable3\n'+ | |||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ,"0123456789","!\"#$%&()*+-./:;<=>?@[\]^_`{|}",abcdefghijklmnopqrstuvwxzy\n'+ | |||
'ABCDEFGHIJKLMNOPQRSTUVWXYZ,"0123456789","!\"\"#$%&()*+-./:;<=>?@[\]^_`{|}",abcdefghijklmnopqrstuvwxzy\n'+ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since double-quote is part of data in this case, it should be enclosed in single quote
'!\"#$%&()*+-./:;<=>?@[\]^_`{|}'
860a697
to
a004bda
Compare
Hello @vikask-gs and @MauricioUyaguari , Could we create a clear rule of database name and column name convention? Currently, we have a very loose standard about how users can define a database name or column name, which is making correctly parsing by comma impossible. In prodSince we parse the we support
There are existing tests (naming.pure) in the codebase
(this example exists in legend-testable-relational-service-embeddedData.pure) NowSince we already allow the cases above, there would be many way of parsing the csv data below
No matter how I improve the algorithm, I can't guarantee it could be backward compatible so all existing use cases won't be broken. Either A. Could we take a step back to think if it really makes sense to have a delimiter inside the column value? There would be tons of corner cases if we allow the cases above B. Could we make sure that we add the rules below if we have to include a delimiter inside the column value?
(this example exists in legend-testable-relational-service-embeddedData.pure)
|
Spoke to Mauricio offline
|
7aa02da
to
54707b2
Compare
spoke offline with Vikas and Yannan on this PR
What type of PR is this?
Bug Fix
This PR is not backwards compaitble.
Some user tests in prod need to be updated.
What does this PR do / why is it needed ?
Before:
After:
Screen.Recording.2023-06-09.at.6.47.58.PM.mov
Which issue(s) this PR fixes:
Fixes #
Other notes for reviewers:
Does this PR introduce a user-facing change?