Skip to content

Conversation

@gamife
Copy link
Contributor

@gamife gamife commented Feb 10, 2022

  1. Array expression: ARRAY[1,2]
  2. Array index expression: foo[1]
  3. Extend the array data type: INT[][]
SELECT (CAST(ARRAY[ARRAY[2, 3]] AS INT[][]))[1][2]

@coveralls
Copy link

coveralls commented Feb 11, 2022

Pull Request Test Coverage Report for Build 1856868780

  • 64 of 64 (100.0%) changed or added relevant lines in 3 files are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.008%) to 90.586%

Files with Coverage Reduction New Missed Lines %
src/ast/mod.rs 1 77.89%
src/parser.rs 6 84.15%
Totals Coverage Status
Change from base Build 1818592432: -0.008%
Covered Lines: 7082
Relevant Lines: 7818

💛 - Coveralls

Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you for the contribution @gamife

expr: Box::new(expr),
})
} else if Token::LBracket == tok {
if dialect_of!(self is PostgreSqlDialect) {
Copy link
Contributor

Choose a reason for hiding this comment

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

}

#[test]
fn parse_map_access_expr() {
Copy link
Contributor

Choose a reason for hiding this comment

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

Could you please add back the the existing test parsing the simpler expression SELECT foo[0] FROM foos to make sure that that syntax is still supported (it would be fine if the resulting parse tree is slightly different)

I think it is important to ensure that this PR does not introduce a regression in terms of the syntax that is supported (I don't think it does, but I would like the test to ensure that this is the case)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok. Thanks for the review!

@alamb alamb changed the title feat: add array expression Suppport array expressions such as ARRAY[1,2] , foo[1] and INT[][] Feb 17, 2022
@alamb alamb changed the title Suppport array expressions such as ARRAY[1,2] , foo[1] and INT[][] Support array expressions such as ARRAY[1,2] , foo[1] and INT[][] Feb 17, 2022
Copy link
Contributor

@alamb alamb left a comment

Choose a reason for hiding this comment

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

Thank you @gamife

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants