Skip to content

Commit

Permalink
Merge #75550 #75573
Browse files Browse the repository at this point in the history
75550: sql: add array of JSON type to pre-constructed types r=xinhaoz a=xinhaoz

This commit adds the JSONArray type to the preconstructed list of types
for use in bultin function definition.

Release note: None

75573: ci: pass `GITHUB_API_TOKEN` down to bazel roachtest nightlies r=rail a=rickystewart

Release note: None

Co-authored-by: Xin Hao Zhang <[email protected]>
Co-authored-by: Ricky Stewart <[email protected]>
  • Loading branch information
3 people committed Jan 26, 2022
3 parents 5c767a0 + 61a1ba0 + 036375e commit b64fe37
Show file tree
Hide file tree
Showing 6 changed files with 11 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))"
source "$dir/teamcity-support.sh" # For $root
source "$dir/teamcity-bazel-support.sh" # For run_bazel

BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e AWS_ACCESS_KEY_ID -e AWS_KMS_KEY_ARN_A -e AWS_KMS_KEY_ARN_B -e AWS_KMS_REGION_A -e AWS_KMS_REGION_B -e AWS_SECRET_ACCESS_KEY -e BUILD_TAG -e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e AWS_ACCESS_KEY_ID -e AWS_KMS_KEY_ARN_A -e AWS_KMS_KEY_ARN_B -e AWS_KMS_REGION_A -e AWS_KMS_REGION_B -e AWS_SECRET_ACCESS_KEY -e BUILD_TAG -e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GITHUB_API_TOKEN -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
run_bazel build/teamcity/cockroach/nightlies/roachtest_nightly_impl.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))"
source "$dir/teamcity-support.sh" # For $root
source "$dir/teamcity-bazel-support.sh" # For run_bazel

BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e BUILD_TAG -e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e LITERAL_ARTIFACTS_DIR=$root/artifacts -e BUILD_TAG -e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GITHUB_API_TOKEN -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
run_bazel build/teamcity/cockroach/nightlies/roachtest_nightly_impl.sh
2 changes: 1 addition & 1 deletion build/teamcity/cockroach/nightlies/roachtest_weekly.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@ dir="$(dirname $(dirname $(dirname $(dirname "${0}"))))"
source "$dir/teamcity-support.sh" # For $root
source "$dir/teamcity-bazel-support.sh" # For run_bazel

BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
BAZEL_SUPPORT_EXTRA_DOCKER_ARGS="-e CLOUD -e COCKROACH_DEV_LICENSE -e COUNT -e GITHUB_API_TOKEN -e GOOGLE_EPHEMERAL_CREDENTIALS -e SLACK_TOKEN -e TC_BUILD_BRANCH -e TC_BUILD_ID" \
run_bazel build/teamcity/cockroach/nightlies/roachtest_weekly_impl.sh
4 changes: 2 additions & 2 deletions docs/generated/sql/functions.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,9 +323,9 @@
</span></td></tr>
<tr><td><a name="cardinality"></a><code>cardinality(input: anyelement[]) &rarr; <a href="int.html">int</a></code></td><td><span class="funcdesc"><p>Calculates the number of elements contained in <code>input</code></p>
</span></td></tr>
<tr><td><a name="crdb_internal.merge_statement_stats"></a><code>crdb_internal.merge_statement_stats(input: anyelement[]) &rarr; jsonb</code></td><td><span class="funcdesc"><p>Merge an array of roachpb.StatementStatistics into a single JSONB object</p>
<tr><td><a name="crdb_internal.merge_statement_stats"></a><code>crdb_internal.merge_statement_stats(input: jsonb[]) &rarr; jsonb</code></td><td><span class="funcdesc"><p>Merge an array of roachpb.StatementStatistics into a single JSONB object</p>
</span></td></tr>
<tr><td><a name="crdb_internal.merge_transaction_stats"></a><code>crdb_internal.merge_transaction_stats(input: anyelement[]) &rarr; jsonb</code></td><td><span class="funcdesc"><p>Merge an array of roachpb.TransactionStatistics into a single JSONB object</p>
<tr><td><a name="crdb_internal.merge_transaction_stats"></a><code>crdb_internal.merge_transaction_stats(input: jsonb[]) &rarr; jsonb</code></td><td><span class="funcdesc"><p>Merge an array of roachpb.TransactionStatistics into a single JSONB object</p>
</span></td></tr>
<tr><td><a name="string_to_array"></a><code>string_to_array(str: <a href="string.html">string</a>, delimiter: <a href="string.html">string</a>) &rarr; <a href="string.html">string</a>[]</code></td><td><span class="funcdesc"><p>Split a string into components on a delimiter.</p>
</span></td></tr>
Expand Down
4 changes: 2 additions & 2 deletions pkg/sql/sem/builtins/builtins.go
Original file line number Diff line number Diff line change
Expand Up @@ -4079,7 +4079,7 @@ value if you rely on the HLC for accuracy.`,
),
"crdb_internal.merge_statement_stats": makeBuiltin(arrayProps(),
tree.Overload{
Types: tree.ArgTypes{{"input", types.AnyArray}},
Types: tree.ArgTypes{{"input", types.JSONArray}},
ReturnType: tree.FixedReturnType(types.Jsonb),
Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) {
arr := tree.MustBeDArray(args[0])
Expand Down Expand Up @@ -4107,7 +4107,7 @@ value if you rely on the HLC for accuracy.`,
),
"crdb_internal.merge_transaction_stats": makeBuiltin(arrayProps(),
tree.Overload{
Types: tree.ArgTypes{{"input", types.AnyArray}},
Types: tree.ArgTypes{{"input", types.JSONArray}},
ReturnType: tree.FixedReturnType(types.Jsonb),
Fn: func(_ *tree.EvalContext, args tree.Datums) (tree.Datum, error) {
arr := tree.MustBeDArray(args[0])
Expand Down
4 changes: 4 additions & 0 deletions pkg/sql/types/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -599,6 +599,10 @@ var (
AnyEnumArray = &T{InternalType: InternalType{
Family: ArrayFamily, ArrayContents: AnyEnum, Oid: oid.T_anyarray, Locale: &emptyLocale}}

// JSONArray is the type of an array value having JSON-typed elements.
JSONArray = &T{InternalType: InternalType{
Family: ArrayFamily, ArrayContents: Jsonb, Oid: oid.T__jsonb, Locale: &emptyLocale}}

// Int2Vector is a type-alias for an array of Int2 values with a different
// OID (T_int2vector instead of T__int2). It is a special VECTOR type used
// by Postgres in system tables. Int2vectors are 0-indexed, unlike normal arrays.
Expand Down

0 comments on commit b64fe37

Please sign in to comment.