Skip to content

Support json_extract function - #4645

Merged
fengttt merged 23 commits into
matrixorigin:mainfrom
mooleetzi:JSON_QUERY
Sep 5, 2022
Merged

fengttt merged 23 commits into
matrixorigin:mainfrom
mooleetzi:JSON_QUERY

Conversation

@mooleetzi

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #4644

What this PR does / why we need it:

Support query function for json type

@matrix-meow matrix-meow added the size/XL Denotes a PR that changes [1000, 1999] lines label Aug 23, 2022
@mergify mergify Bot added the kind/feature label Aug 23, 2022
@mooleetzi

Copy link
Copy Markdown
Contributor Author

I transferred json_extract to jq, but CI told me I need to add json_extract  😿

@yingfeng

Copy link
Copy Markdown
Contributor

I transferred json_extract to jq, but CI told me I need to add json_extract 😿

@guguducken what does this mean? since github.com/matrixorigin/matrixone/pkg/vectorize/json_extract is deleted in this PR

  cd $GITHUB_WORKSPACE/matrixone
  echo "-----------------------ut start-----------------------"
  CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo"
  CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo -lm"
  go test -v -cover -tags matrixone_test -p 1 -covermode=count --count=1 github.com/matrixorigin/matrixone/pkg/container/bytejson github.com/matrixorigin/matrixone/pkg/container/types github.com/matrixorigin/matrixone/pkg/errno github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect/mysql github.com/matrixorigin/matrixone/pkg/sql/plan/function/builtin/binary github.com/matrixorigin/matrixone/pkg/sql/plan/function github.com/matrixorigin/matrixone/pkg/vectorize/jq github.com/matrixorigin/matrixone/pkg/vectorize/json_extract | tee 'UT-Report.out'
  cat 'UT-Report.out' | grep -a -P "(?m)(?<=ok|\?).*(?=%|])" > 'ut_coverage.raw'
  echo "-----------------------ut finish-----------------------"
  shell: /usr/bin/bash -e {0}
  env:
    raw_ut_coverage: 'ut_coverage.raw'
    ut_report: 'UT-Report.out'
-----------------------ut start-----------------------
no required module provides package github.com/matrixorigin/matrixone/pkg/vectorize/json_extract; to add it:
	go get github.com/matrixorigin/matrixone/pkg/vectorize/json_extract
Error: Process completed with exit code 1.

@guguducken

Copy link
Copy Markdown
Contributor

I transferred json_extract to jq, but CI told me I need to add json_extract 😿

@guguducken what does this mean? since github.com/matrixorigin/matrixone/pkg/vectorize/json_extract is deleted in this PR

  cd $GITHUB_WORKSPACE/matrixone
  echo "-----------------------ut start-----------------------"
  CGO_CFLAGS="-I${GITHUB_WORKSPACE}/matrixone/cgo"
  CGO_LDFLAGS="-L${GITHUB_WORKSPACE}/matrixone/cgo -lmo -lm"
  go test -v -cover -tags matrixone_test -p 1 -covermode=count --count=1 github.com/matrixorigin/matrixone/pkg/container/bytejson github.com/matrixorigin/matrixone/pkg/container/types github.com/matrixorigin/matrixone/pkg/errno github.com/matrixorigin/matrixone/pkg/sql/parsers/dialect/mysql github.com/matrixorigin/matrixone/pkg/sql/plan/function/builtin/binary github.com/matrixorigin/matrixone/pkg/sql/plan/function github.com/matrixorigin/matrixone/pkg/vectorize/jq github.com/matrixorigin/matrixone/pkg/vectorize/json_extract | tee 'UT-Report.out'
  cat 'UT-Report.out' | grep -a -P "(?m)(?<=ok|\?).*(?=%|])" > 'ut_coverage.raw'
  echo "-----------------------ut finish-----------------------"
  shell: /usr/bin/bash -e {0}
  env:
    raw_ut_coverage: 'ut_coverage.raw'
    ut_report: 'UT-Report.out'
-----------------------ut start-----------------------
no required module provides package github.com/matrixorigin/matrixone/pkg/vectorize/json_extract; to add it:
	go get github.com/matrixorigin/matrixone/pkg/vectorize/json_extract
Error: Process completed with exit code 1.

This is because this unit test with modified file path did not think of the folder deleted scenario, I will fix it

@guguducken

guguducken commented Aug 24, 2022 •

Copy link
Copy Markdown
Contributor

@matrix-meow rerun failed

All failed jobs are rerun ----- @matrix-meow

@fengttt fengttt 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.

Is there a document on the jq syntax we will support?

@mooleetzi

Copy link
Copy Markdown
Contributor Author

Is there a document on the jq syntax we will support?

I'll add them later, Thx.

@mooleetzi

Copy link
Copy Markdown
Contributor Author

@matrix-meow rerun failed

All failed jobs are rerun ----- @matrix-meow

Hello, CI still let me add github.com/matrixorigin/matrixone/pkg/vectorize/json_extract.

@mooleetzi
mooleetzi requested a review from fengttt August 25, 2022 12:28
@guguducken

Copy link
Copy Markdown
Contributor

@matrix-meow rerun failed

All failed jobs are rerun ----- @matrix-meow

Hello, CI still let me add github.com/matrixorigin/matrixone/pkg/vectorize/json_extract.

Hello, I will fix this tomorrow, This CI does not affect the merge at this time.

@mooleetzi

Copy link
Copy Markdown
Contributor Author

@matrix-meow rerun failed

All failed jobs are rerun ----- @matrix-meow

Hello, CI still let me add github.com/matrixorigin/matrixone/pkg/vectorize/json_extract.

Hello, I will fix this tomorrow, This CI does not affect the merge at this time.

🫡

@fengttt

fengttt commented Aug 28, 2022

Copy link
Copy Markdown
Contributor

Is there a document on the jq syntax we will support?

I'll add them later, Thx.

This change won't be approved until we see the doc.

@fengttt fengttt 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.

Rename jq to extract, this is good to go.

Thank you very much,

@mooleetzi

Copy link
Copy Markdown
Contributor Author

Rename jq to extract, this is good to go.

Thank you very much,

Ok. Thank you too.

@matrix-meow matrix-meow added size/L Denotes a PR that changes [500,999] lines and removed size/XL Denotes a PR that changes [1000, 1999] lines labels Sep 2, 2022
@matrix-meow matrix-meow added size/XL Denotes a PR that changes [1000, 1999] lines and removed size/L Denotes a PR that changes [500,999] lines labels Sep 2, 2022
@mooleetzi mooleetzi changed the title Support jq function Support json_extract function Sep 2, 2022
@fengttt
fengttt merged commit e1fd77f into matrixorigin:main Sep 5, 2022
@mooleetzi
mooleetzi deleted the JSON_QUERY branch September 6, 2022 02:24
fengttt added a commit to fengttt/matrixone that referenced this pull request May 7, 2026
* CI: add PR UT coverage (matrixorigin#4371)

Create a new yml file to support detect incremental code coverage

Approved by: @sukki37

* add json path expr

* support json query base_line

* merge main into JSON_QUERY

* support jq & add ut + bvt test cases

* add doc

* add more examples

* rename jq to json_extract

* add test case in mysql_sql_test.go

* add test case in json_extract_test.go

* add more doc details

* add more ut case

* improve ut coverage

Co-authored-by: brown <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Co-authored-by: fengttt <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/feature size/XL Denotes a PR that changes [1000, 1999] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants