Skip to content
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

feat(function): Support Semi-structured function GET/GET_IGNORE_CASE/GET_PATH #4684

Merged
merged 1 commit into from
Apr 8, 2022

Conversation

b41sh
Copy link
Member

@b41sh b41sh commented Apr 4, 2022

I hereby agree to the terms of the CLA available at: https://databend.rs/dev/policies/cla/

Summary

Support GET function
Support GET_IGNORE_CASE function
Support GET_PATH function

Changelog

  • New Feature
  • Build/Testing/CI
  • Documentation

Related Issues

Fixes #4665

Test Plan

Unit Tests

Stateless Tests

@vercel
Copy link

vercel bot commented Apr 4, 2022

This pull request is being automatically deployed with Vercel (learn more).
To see the status of your deployment, click below or on the icon next to each commit.

🔍 Inspect: https://vercel.com/databend/databend/6L2CxR4bqkHs7FoJ2MciC3NWeUyb
✅ Preview: https://databend-git-fork-b41sh-func-get-databend.vercel.app

@mergify
Copy link
Contributor

mergify bot commented Apr 4, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@mergify mergify bot added pr-feature this PR introduces a new feature to the codebase pr-build this PR changes build/testing/ci steps pr-doc-fix labels Apr 4, 2022
@b41sh b41sh requested a review from sundy-li April 4, 2022 02:54
@BohuTANG
Copy link
Member

BohuTANG commented Apr 6, 2022

@mergify update

@mergify
Copy link
Contributor

mergify bot commented Apr 6, 2022

update

✅ Branch has been successfully updated

Hey, I reacted but my real name is @Mergifyio

@BohuTANG
Copy link
Member

BohuTANG commented Apr 6, 2022



SyntaxError: /vercel/path0/docs/doc/30-reference/20-functions/110-semi-structured-functions/get_path.md: Expected corresponding JSX closing tag for <index>. (10:409)
--
10:23:22.794 | 8 \| <p>{`Extracts value from an `}<inlineCode parentName="p">{`ARRAY`}</inlineCode>{`, an `}<inlineCode parentName="p">{`OBJECT`}</inlineCode>{`, or a `}<inlineCode parentName="p">{`VARIANT`}</inlineCode>{` by `}<inlineCode parentName="p">{`path_name`}</inlineCode>{`.
10:23:22.794 | 9 \| The value is returned as a `}<inlineCode parentName="p">{`Variant`}</inlineCode>{` or `}<inlineCode parentName="p">{`NULL`}</inlineCode>{` if either of the arguments is `}<inlineCode parentName="p">{`NULL`}</inlineCode>{`.`}</p>
10:23:22.794 | > 10 \| <p><inlineCode parentName="p">{`GET_PATH`}</inlineCode>{` is equivalent to a chain of `}<inlineCode parentName="p">{`GET`}</inlineCode>{` functions, `}<inlineCode parentName="p">{`path_name`}</inlineCode>{` consists of a concatenation of field names preceded by periods (.), colons (:) or index operators (`}{`[`}<index>{`]`}{`). The first field name does not require the leading identifier to be specified.`}</p>
10:23:22.794 | \|                                                                                                                                                                                                                                                                                                                                                                                                                          ^
10:23:22.794 | 11 \| <h2 {...{"id":"syntax"}}>{`Syntax`}</h2>
10:23:22.794 | 12 \| <pre><code parentName="pre" {...{"className":"language-sql"}}>{`get_path(array, path_name)
10:23:22.794 | 13 \| get_path(object, path_name)
10:23:22.795 | [ERROR] Client bundle compiled with errors therefore further build is impossible.
10:23:22.843 | error Command failed with exit code 1.
10:23:22.844 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:23:22.852 | Error: Command "yarn run build" exited with 1


@b41sh
Copy link
Member Author

b41sh commented Apr 6, 2022



SyntaxError: /vercel/path0/docs/doc/30-reference/20-functions/110-semi-structured-functions/get_path.md: Expected corresponding JSX closing tag for <index>. (10:409)
--
10:23:22.794 | 8 \| <p>{`Extracts value from an `}<inlineCode parentName="p">{`ARRAY`}</inlineCode>{`, an `}<inlineCode parentName="p">{`OBJECT`}</inlineCode>{`, or a `}<inlineCode parentName="p">{`VARIANT`}</inlineCode>{` by `}<inlineCode parentName="p">{`path_name`}</inlineCode>{`.
10:23:22.794 | 9 \| The value is returned as a `}<inlineCode parentName="p">{`Variant`}</inlineCode>{` or `}<inlineCode parentName="p">{`NULL`}</inlineCode>{` if either of the arguments is `}<inlineCode parentName="p">{`NULL`}</inlineCode>{`.`}</p>
10:23:22.794 | > 10 \| <p><inlineCode parentName="p">{`GET_PATH`}</inlineCode>{` is equivalent to a chain of `}<inlineCode parentName="p">{`GET`}</inlineCode>{` functions, `}<inlineCode parentName="p">{`path_name`}</inlineCode>{` consists of a concatenation of field names preceded by periods (.), colons (:) or index operators (`}{`[`}<index>{`]`}{`). The first field name does not require the leading identifier to be specified.`}</p>
10:23:22.794 | \|                                                                                                                                                                                                                                                                                                                                                                                                                          ^
10:23:22.794 | 11 \| <h2 {...{"id":"syntax"}}>{`Syntax`}</h2>
10:23:22.794 | 12 \| <pre><code parentName="pre" {...{"className":"language-sql"}}>{`get_path(array, path_name)
10:23:22.794 | 13 \| get_path(object, path_name)
10:23:22.795 | [ERROR] Client bundle compiled with errors therefore further build is impossible.
10:23:22.843 | error Command failed with exit code 1.
10:23:22.844 | info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
10:23:22.852 | Error: Command "yarn run build" exited with 1

done.

@mergify
Copy link
Contributor

mergify bot commented Apr 7, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

@b41sh b41sh marked this pull request as ready for review April 7, 2022 02:07
@mergify
Copy link
Contributor

mergify bot commented Apr 7, 2022

Thanks for the contribution!
I have applied any labels matching special text in your PR Changelog.

Please review the labels and make any necessary changes.

continue;
}
for v in column.iter() {
let mut found_value = true;
Copy link
Member

@sundy-li sundy-li Apr 7, 2022

Choose a reason for hiding this comment

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

Will found_value defaults to false make this more simple?

Copy link
Member Author

@b41sh b41sh Apr 7, 2022

Choose a reason for hiding this comment

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

The default value of found_value is not simpler to set as false, because the lookup is recursive. If we can find a value we need to set it to true, otherwise we set it to false. If the default value is false, the following set found_value = false can't be omitted, but need to add some code to set found_value = true.

@BohuTANG
Copy link
Member

BohuTANG commented Apr 7, 2022

+++ /workspace/tests/suites/0_stateless/02_function/02_0051_function_semi_structureds_get.stdout	2022-04-07 05:02:22.259013252 +0000
@@ -1,3 +1,18 @@
+ERROR 2013 (HY000) at line 33: Lost connection to MySQL server during query
+ERROR 2006 (HY000) at line 34: MySQL server has gone away
+ERROR 2006 (HY000) at line 35: MySQL server has gone away
+ERROR 2006 (HY000) at line 36: MySQL server has gone away
+ERROR 2006 (HY000) at line 38: MySQL server has gone away
+ERROR 2006 (HY000) at line 39: MySQL server has gone away
+ERROR 2006 (HY000) at line 40: MySQL server has gone away
+ERROR 2006 (HY000) at line 42: MySQL server has gone away
+ERROR 2006 (HY000) at line 43: MySQL server has gone away
+ERROR 2006 (HY000) at line 44: MySQL server has gone away
+ERROR 2006 (HY000) at line 45: MySQL server has gone away
+ERROR 2006 (HY000) at line 46: MySQL server has gone away
+ERROR 2006 (HY000) at line 47: MySQL server has gone away
+ERROR 2006 (HY000) at line 48: MySQL server has gone away
+ERROR 2006 (HY000) at line 50: MySQL server has gone away
 ==get==
 2.71
 NULL
@@ -13,18 +28,4 @@
 "databend"
 "ext"
 NULL
-+==get from table==
-1
-NULL
-NULL
-1
-==get_ignore_case from table==
-1
-1
-==get_path from table==
-1
-"a"
-1
-1
-2

@b41sh
Copy link
Member Author

b41sh commented Apr 7, 2022

+++ /workspace/tests/suites/0_stateless/02_function/02_0051_function_semi_structureds_get.stdout	2022-04-07 05:02:22.259013252 +0000
@@ -1,3 +1,18 @@
+ERROR 2013 (HY000) at line 33: Lost connection to MySQL server during query
+ERROR 2006 (HY000) at line 34: MySQL server has gone away
+ERROR 2006 (HY000) at line 35: MySQL server has gone away
+ERROR 2006 (HY000) at line 36: MySQL server has gone away
+ERROR 2006 (HY000) at line 38: MySQL server has gone away
+ERROR 2006 (HY000) at line 39: MySQL server has gone away
+ERROR 2006 (HY000) at line 40: MySQL server has gone away
+ERROR 2006 (HY000) at line 42: MySQL server has gone away
+ERROR 2006 (HY000) at line 43: MySQL server has gone away
+ERROR 2006 (HY000) at line 44: MySQL server has gone away
+ERROR 2006 (HY000) at line 45: MySQL server has gone away
+ERROR 2006 (HY000) at line 46: MySQL server has gone away
+ERROR 2006 (HY000) at line 47: MySQL server has gone away
+ERROR 2006 (HY000) at line 48: MySQL server has gone away
+ERROR 2006 (HY000) at line 50: MySQL server has gone away
 ==get==
 2.71
 NULL
@@ -13,18 +28,4 @@
 "databend"
 "ext"
 NULL
-+==get from table==
-1
-NULL
-NULL
-1
-==get_ignore_case from table==
-1
-1
-==get_path from table==
-1
-"a"
-1
-1
-2

this is caused by another bug, I will fix it.

@BohuTANG
Copy link
Member

BohuTANG commented Apr 8, 2022

Conflicts that must be resolved :D

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
need-review pr-build this PR changes build/testing/ci steps pr-feature this PR introduces a new feature to the codebase
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature: Semi-structured data function get/get_ignore_case/get_path
5 participants