diff --git a/build/bazelutil/distdir_files.bzl b/build/bazelutil/distdir_files.bzl index 06a9fef251c7..00a18545f66f 100644 --- a/build/bazelutil/distdir_files.bzl +++ b/build/bazelutil/distdir_files.bzl @@ -982,23 +982,23 @@ DISTDIR_FILES = { "https://storage.googleapis.com/public-bazel-artifacts/bazel/rules_proto-b0cc14be5da05168b01db282fe93bdf17aa2b9f4.tar.gz": "88b0a90433866b44bb4450d4c30bc5738b8c4f9c9ba14e9661deb123f56a833d", "https://storage.googleapis.com/public-bazel-artifacts/bazel/rules_python-0.1.0.tar.gz": "b6d46438523a3ec0f3cead544190ee13223a52f6a6765a29eae7b7cc24cc83a0", "https://storage.googleapis.com/public-bazel-artifacts/bazel/sqllogictest-96138842571462ed9a697bff590828d8f6356a2f.tar.gz": "f7e0d659fbefb65f32d4c5d146cba4c73c43e0e96f9b217a756c82be17451f97", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.linux.20220520-181309.tar.gz": "755a734ed4f44328377f04ffe7e2a53f6552aee6de5f448ae34ade5bdf0047b3", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.linuxarm.20220520-181309.tar.gz": "10e55138113fb43ad4d4c4a38ae77b34d9d74b0d54c46f0bfa9ae6cf6551db46", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.macos.20220520-181309.tar.gz": "bcf05b88b102628ec878a91086d0039fd9460d17b6431e1322310b3820103f23", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.macosarm.20220520-181309.tar.gz": "bba59eb60c31c34bde10ac4a34d2210d201dc9d8e188be0aeb2d3038d148f63c", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libgeos_foreign.windows.20220520-181309.tar.gz": "27aea836a821920c8b444f9ec251c32af3842d6a2a084f286632e819b8c03d71", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.linux.20220520-181309.tar.gz": "d6e222cf1f09834216af546775b23a8a13bdb5b49cfe45741e1aff5c2a739ee9", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.linuxarm.20220520-181309.tar.gz": "10e34f6c314558b2ae092a55685eecad0767b161c7aa14e7fd5b87d9e7b450a1", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.macos.20220520-181309.tar.gz": "44dd0f9b296f5885f0bf5936ebbe0d6f574b4c067330d66b1f55b7fd15e33066", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.macosarm.20220520-181309.tar.gz": "e444612cba97d31ae8ce23534e2e0416c2ebf79bb505e38882cec5d8dd7b60dd", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libjemalloc_foreign.windows.20220520-181309.tar.gz": "3db4fe746a7591a87b94bbbfb35d727a51506775ea36b9f634eb770b486e9c7b", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libkrb5_foreign.linux.20220520-181309.tar.gz": "f1fe740b931f29289fd9cad7f877705072678c83bd5c9ef899cdbf3373985d2e", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libkrb5_foreign.linuxarm.20220520-181309.tar.gz": "6fe0ddee54c71f5afd71effb728a1227beb43ca6977205e56ee9eaf5b6f15422", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.linux.20220520-181309.tar.gz": "4bcd7ed82d8487370cad34f68096e160e768630f579fc2e9d09c72b0ebf3f741", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.linuxarm.20220520-181309.tar.gz": "dbbcf9a633d251530ad7b698934b6752eca347f34985060700d3ec187b1f3498", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.macos.20220520-181309.tar.gz": "aa618a6525c0df669ce1231c837dc46a1a789d54231ae3dcfcada599d0845b22", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.macosarm.20220520-181309.tar.gz": "e3206fa7c2544d1817103c3c61f132d342b5d4a07404d1de4582da968b622749", - "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220520-181309/libproj_foreign.windows.20220520-181309.tar.gz": "4d935601d1b989ff020c66011355a0e2985abacf36f9d952f7f1ce34d54684ad", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libgeos_foreign.linux.20220708-170245.tar.gz": "c02edafb99b5a289f04e689731f5cab498b852f3557120e329fcb842e5282471", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libgeos_foreign.linuxarm.20220708-170245.tar.gz": "a91006cc7b0e468feaf7b0b8ba0ce892568fc2ce21319edb843f9827a7025aba", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libgeos_foreign.macos.20220708-170245.tar.gz": "4d6d6ec7bd21f0b973c7b20426e509849d22d33a7a6cf995f3ddf4426bc4d904", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libgeos_foreign.macosarm.20220708-170245.tar.gz": "993e6d85270d01ffba87c3a65fa6e500ed0edefc169cf7e19ab5edce3b40939c", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libgeos_foreign.windows.20220708-170245.tar.gz": "43d69d5b3c57530fa06537afc946aa78cb84e8f0e29201c33136762fb4a1d7ea", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libjemalloc_foreign.linux.20220708-170245.tar.gz": "ea73589ba3b4f677e1554ab84d562bafeba0b1057b7fbd651a1bc8bfe0a361ee", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libjemalloc_foreign.linuxarm.20220708-170245.tar.gz": "76a6bbc84f73753bbde78d6ec02d4aded310c740c9ee90944de816ef11127905", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libjemalloc_foreign.macos.20220708-170245.tar.gz": "0099715b3ddbc29451138c4304c744757f1bd4288dd57fa9b1900a5fab6a667f", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libjemalloc_foreign.macosarm.20220708-170245.tar.gz": "5bbb74136597f560ef6584173fe535acde328b3837aec995801310e77fcf5b48", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libjemalloc_foreign.windows.20220708-170245.tar.gz": "b4cc4f08df6a6701036a24150236a2012688d81f11a635dd372dbedcedae919f", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libkrb5_foreign.linux.20220708-170245.tar.gz": "53712526d4fcd4f13d019f0c9b789bbca13ba11cf3f1574fa9a1db576c82aecd", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libkrb5_foreign.linuxarm.20220708-170245.tar.gz": "83c5110940056cdad028ef7265a0a0f1602a1e578a67cbe5849104f1db31bfa0", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.linux.20220708-170245.tar.gz": "a25bfdadf958955e8559ac2e03d5a76748919a838be07afef00635cc774b66c4", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.linuxarm.20220708-170245.tar.gz": "0c6c1c795e9e8f30e68a6d4fec738fae8c7773fef4fddd8ace2e633cff76eea1", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.macos.20220708-170245.tar.gz": "fd342ce3e99d9df6de8fcdf09ff9735887d7025d88ba9814b4c73cff24691b26", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.macosarm.20220708-170245.tar.gz": "6394f40dbc799909ee239e42c25d08b5b2af0ad0c8aa30f37553e936f1c1dc4e", + "https://storage.googleapis.com/public-bazel-artifacts/c-deps/20220708-170245/libproj_foreign.windows.20220708-170245.tar.gz": "233c6cecef5e826bd1aea7c7c603fb86fc78299d2016c4d3afcb0c1509eff001", "https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.11.darwin-amd64.tar.gz": "4f924c534230de8f0e1c7369f611c0310efd21fc2d9438b13bc2703af9dda25a", "https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.11.darwin-arm64.tar.gz": "b8e1ab009c2ff8dea462c7a1263d1f3f38e90ab5262e74c76d70e41a4db320be", "https://storage.googleapis.com/public-bazel-artifacts/go/go1.17.11.freebsd-amd64.tar.gz": "da78bcd5efa24cfa8ca3ccf0d222f7d66b755c4200d404869984ebdcfc7b6aa7", diff --git a/c-deps/REPOSITORIES.bzl b/c-deps/REPOSITORIES.bzl index 58397205dd4f..e6901167021f 100644 --- a/c-deps/REPOSITORIES.bzl +++ b/c-deps/REPOSITORIES.bzl @@ -39,85 +39,85 @@ def c_deps(): archived_cdep_repository( lib = "libgeos", config = "linux", - sha256 = "755a734ed4f44328377f04ffe7e2a53f6552aee6de5f448ae34ade5bdf0047b3", + sha256 = "c02edafb99b5a289f04e689731f5cab498b852f3557120e329fcb842e5282471", ) archived_cdep_repository( lib = "libjemalloc", config = "linux", - sha256 = "d6e222cf1f09834216af546775b23a8a13bdb5b49cfe45741e1aff5c2a739ee9", + sha256 = "ea73589ba3b4f677e1554ab84d562bafeba0b1057b7fbd651a1bc8bfe0a361ee", ) archived_cdep_repository( lib = "libkrb5", config = "linux", - sha256 = "f1fe740b931f29289fd9cad7f877705072678c83bd5c9ef899cdbf3373985d2e", + sha256 = "53712526d4fcd4f13d019f0c9b789bbca13ba11cf3f1574fa9a1db576c82aecd", ) archived_cdep_repository( lib = "libproj", config = "linux", - sha256 = "4bcd7ed82d8487370cad34f68096e160e768630f579fc2e9d09c72b0ebf3f741", + sha256 = "a25bfdadf958955e8559ac2e03d5a76748919a838be07afef00635cc774b66c4", ) archived_cdep_repository( lib = "libgeos", config = "linuxarm", - sha256 = "10e55138113fb43ad4d4c4a38ae77b34d9d74b0d54c46f0bfa9ae6cf6551db46", + sha256 = "a91006cc7b0e468feaf7b0b8ba0ce892568fc2ce21319edb843f9827a7025aba", ) archived_cdep_repository( lib = "libjemalloc", config = "linuxarm", - sha256 = "10e34f6c314558b2ae092a55685eecad0767b161c7aa14e7fd5b87d9e7b450a1", + sha256 = "76a6bbc84f73753bbde78d6ec02d4aded310c740c9ee90944de816ef11127905", ) archived_cdep_repository( lib = "libkrb5", config = "linuxarm", - sha256 = "6fe0ddee54c71f5afd71effb728a1227beb43ca6977205e56ee9eaf5b6f15422", + sha256 = "83c5110940056cdad028ef7265a0a0f1602a1e578a67cbe5849104f1db31bfa0", ) archived_cdep_repository( lib = "libproj", config = "linuxarm", - sha256 = "dbbcf9a633d251530ad7b698934b6752eca347f34985060700d3ec187b1f3498", + sha256 = "0c6c1c795e9e8f30e68a6d4fec738fae8c7773fef4fddd8ace2e633cff76eea1", ) archived_cdep_repository( lib = "libgeos", config = "macos", - sha256 = "bcf05b88b102628ec878a91086d0039fd9460d17b6431e1322310b3820103f23", + sha256 = "4d6d6ec7bd21f0b973c7b20426e509849d22d33a7a6cf995f3ddf4426bc4d904", ) archived_cdep_repository( lib = "libjemalloc", config = "macos", - sha256 = "44dd0f9b296f5885f0bf5936ebbe0d6f574b4c067330d66b1f55b7fd15e33066", + sha256 = "0099715b3ddbc29451138c4304c744757f1bd4288dd57fa9b1900a5fab6a667f", ) archived_cdep_repository( lib = "libproj", config = "macos", - sha256 = "aa618a6525c0df669ce1231c837dc46a1a789d54231ae3dcfcada599d0845b22", + sha256 = "fd342ce3e99d9df6de8fcdf09ff9735887d7025d88ba9814b4c73cff24691b26", ) archived_cdep_repository( lib = "libgeos", config = "macosarm", - sha256 = "bba59eb60c31c34bde10ac4a34d2210d201dc9d8e188be0aeb2d3038d148f63c", + sha256 = "993e6d85270d01ffba87c3a65fa6e500ed0edefc169cf7e19ab5edce3b40939c", ) archived_cdep_repository( lib = "libjemalloc", config = "macosarm", - sha256 = "e444612cba97d31ae8ce23534e2e0416c2ebf79bb505e38882cec5d8dd7b60dd", + sha256 = "5bbb74136597f560ef6584173fe535acde328b3837aec995801310e77fcf5b48", ) archived_cdep_repository( lib = "libproj", config = "macosarm", - sha256 = "e3206fa7c2544d1817103c3c61f132d342b5d4a07404d1de4582da968b622749", + sha256 = "6394f40dbc799909ee239e42c25d08b5b2af0ad0c8aa30f37553e936f1c1dc4e", ) archived_cdep_repository( lib = "libgeos", config = "windows", - sha256 = "27aea836a821920c8b444f9ec251c32af3842d6a2a084f286632e819b8c03d71", + sha256 = "43d69d5b3c57530fa06537afc946aa78cb84e8f0e29201c33136762fb4a1d7ea", ) archived_cdep_repository( lib = "libjemalloc", config = "windows", - sha256 = "3db4fe746a7591a87b94bbbfb35d727a51506775ea36b9f634eb770b486e9c7b", + sha256 = "b4cc4f08df6a6701036a24150236a2012688d81f11a635dd372dbedcedae919f", ) archived_cdep_repository( lib = "libproj", config = "windows", - sha256 = "4d935601d1b989ff020c66011355a0e2985abacf36f9d952f7f1ce34d54684ad", + sha256 = "233c6cecef5e826bd1aea7c7c603fb86fc78299d2016c4d3afcb0c1509eff001", ) diff --git a/c-deps/archived.bzl b/c-deps/archived.bzl index 5be0857d351f..79aa681e8916 100644 --- a/c-deps/archived.bzl +++ b/c-deps/archived.bzl @@ -4,7 +4,7 @@ load("@rules_cc//cc:find_cc_toolchain.bzl", "find_cc_toolchain") # NB: URL_TMPL and LOC are used by generate-distdir. Don't change the format or # name of these definitions unless you update generate-distdir accordingly. -LOC = "20220520-181309" +LOC = "20220708-170245" URL_TMPL = "https://storage.googleapis.com/public-bazel-artifacts/c-deps/{loc}/{lib}_foreign.{config}.{loc}.tar.gz" # NB: When we link with the krb5 libraries, we want the linker to see them in diff --git a/pkg/sql/opt/xform/general_funcs.go b/pkg/sql/opt/xform/general_funcs.go index da85ffd1959a..81de550e36c6 100644 --- a/pkg/sql/opt/xform/general_funcs.go +++ b/pkg/sql/opt/xform/general_funcs.go @@ -372,9 +372,7 @@ func (c *CustomFuncs) findConstantFilterCols( } datum := span.StartKey().Value(0) - if datum != tree.DNull { - constFilterCols[colID] = c.e.f.ConstructConstVal(datum, colTyp) - } + constFilterCols[colID] = c.e.f.ConstructConstVal(datum, colTyp) } } } diff --git a/pkg/sql/opt/xform/select_funcs.go b/pkg/sql/opt/xform/select_funcs.go index fa7b8d14da0c..9f7feffe7237 100644 --- a/pkg/sql/opt/xform/select_funcs.go +++ b/pkg/sql/opt/xform/select_funcs.go @@ -415,7 +415,7 @@ func (c *CustomFuncs) GenerateConstrainedScans( sb.Init(c, scanPrivate.Table) - // Check constraint and computed column filters + // Build optional filters from check constraint and computed column filters. optionalFilters, filterColumns := c.GetOptionalFiltersAndFilterColumns(explicitFilters, scanPrivate) @@ -424,7 +424,8 @@ func (c *CustomFuncs) GenerateConstrainedScans( iter.Init(c.e.evalCtx, c.e.f, c.e.mem, &c.im, scanPrivate, explicitFilters, rejectInvertedIndexes) iter.ForEach(func(index cat.Index, filters memo.FiltersExpr, indexCols opt.ColSet, isCovering bool, constProj memo.ProjectionsExpr) { - // A structure describing which index partitions are local to the gateway region + // Create a prefix sorter that describes which index partitions are + // local to the gateway region. prefixSorter, _ := tabMeta.IndexPartitionLocality(scanPrivate.Index, index, c.e.evalCtx) // Build Constraints to scan a subset of the table Spans. @@ -491,7 +492,7 @@ func (c *CustomFuncs) GenerateConstrainedScans( // tryFoldComputedCol tries to reduce the computed column with the given column // ID into a constant value, by evaluating it with respect to a set of other // columns that are constant. If the computed column is constant, enter it into -// the constCols map and return false. Otherwise, return false. +// the constCols map and return true. Otherwise, return false. // func (c *CustomFuncs) tryFoldComputedCol( tabMeta *opt.TableMeta, computedColID opt.ColumnID, constCols constColsMap, diff --git a/pkg/sql/opt/xform/testdata/rules/computed b/pkg/sql/opt/xform/testdata/rules/computed index 48d0dd33ac06..9ff88b5d768b 100644 --- a/pkg/sql/opt/xform/testdata/rules/computed +++ b/pkg/sql/opt/xform/testdata/rules/computed @@ -127,17 +127,14 @@ select └── filters └── (k_int:1 = 2) OR (k_int:1 = 3) [outer=(1), constraints=(/1: [/2 - /2] [/3 - /3]; tight)] -# Don't constrain the index for a NULL value. +# Constrain the index for a NULL value. opt SELECT k_int FROM t_int WHERE k_int IS NULL ---- -select +scan t_int@c_int_index ├── columns: k_int:1 - ├── fd: ()-->(1) - ├── scan t_int@c_int_index - │ └── columns: k_int:1 - └── filters - └── k_int:1 IS NULL [outer=(1), constraints=(/1: [/NULL - /NULL]; tight), fd=()-->(1)] + ├── constraint: /2/1/4: [/NULL/NULL - /NULL/NULL] + └── fd: ()-->(1) # Don't constrain the index when the computed column has a volatile function. @@ -267,3 +264,32 @@ project │ └── key: (1) └── filters └── d:4 = 1 [outer=(4), immutable, constraints=(/4: [/1 - /1]; tight), fd=()-->(4)] + +# Regression test for #83390. The optimizer should constrain an expression index +# with an IS NULL expression. +exec-ddl +CREATE TABLE t83390 ( + k INT PRIMARY KEY, + a INT, + INDEX idx ((a IS NULL)) +) +---- + +opt +SELECT * FROM t83390@idx WHERE a IS NULL +---- +select + ├── columns: k:1!null a:2 + ├── key: (1) + ├── fd: ()-->(2) + ├── index-join t83390 + │ ├── columns: k:1!null a:2 + │ ├── key: (1) + │ ├── fd: (1)-->(2) + │ └── scan t83390@idx + │ ├── columns: k:1!null + │ ├── constraint: /5/1: [/true - /true] + │ ├── flags: force-index=idx + │ └── key: (1) + └── filters + └── a:2 IS NULL [outer=(2), constraints=(/2: [/NULL - /NULL]; tight), fd=()-->(2)] diff --git a/pkg/sql/schemachanger/scbuild/build.go b/pkg/sql/schemachanger/scbuild/build.go index 5f2c515f0a51..355f9265d7d2 100644 --- a/pkg/sql/schemachanger/scbuild/build.go +++ b/pkg/sql/schemachanger/scbuild/build.go @@ -12,6 +12,7 @@ package scbuild import ( "context" + "runtime" "github.com/cockroachdb/cockroach/pkg/settings/cluster" "github.com/cockroachdb/cockroach/pkg/sql/catalog" @@ -62,12 +63,18 @@ func Build( SchemaFeatureChecker: dependencies.FeatureChecker(), } defer func() { - if recErr := recover(); recErr != nil { - if errObj, ok := recErr.(error); ok { - err = errObj - } else { - err = errors.Errorf("unexpected error encountered while building schema change plan %s", recErr) - } + switch recErr := recover().(type) { + case nil: + // No error. + case runtime.Error: + err = errors.WithAssertionFailure(recErr) + case error: + err = recErr + default: + err = errors.AssertionFailedf( + "unexpected error encountered while building schema change plan %s", + recErr, + ) } }() scbuildstmt.Process(b, an.GetStatement()) @@ -83,7 +90,7 @@ func Build( for _, e := range bs.output { if e.metadata.Size() == 0 { // Exclude targets which weren't explicitly set. - // Explicity-set targets have non-zero values in the target metadata. + // Explicitly-set targets have non-zero values in the target metadata. continue } ts.Targets = append(ts.Targets, scpb.MakeTarget(e.target, e.element, &e.metadata)) diff --git a/pkg/sql/schemachanger/scbuild/builder_test.go b/pkg/sql/schemachanger/scbuild/builder_test.go index d887693a923f..0ac5d83e4309 100644 --- a/pkg/sql/schemachanger/scbuild/builder_test.go +++ b/pkg/sql/schemachanger/scbuild/builder_test.go @@ -122,7 +122,7 @@ func run( var tableID descpb.ID tdb.QueryRow(t, fmt.Sprintf(`SELECT '%s'::REGCLASS::INT`, tableName)).Scan(&tableID) if tableID == 0 { - t.Fatalf("failed to read ID of new table %s", tableName) + d.Fatalf(t, "failed to read ID of new table %s", tableName) } t.Logf("created relation with id %d", tableID) } @@ -142,7 +142,7 @@ func run( require.NoError(t, err) for i := range stmts { output, err = scbuild.Build(ctx, deps, output, stmts[i].AST) - require.NoErrorf(t, err, "%s", stmts[i].SQL) + require.NoErrorf(t, err, "%s: %s", d.Pos, stmts[i].SQL) } }) return marshalState(t, output) diff --git a/pkg/ui/workspaces/cluster-ui/src/timeScaleDropdown/timeScaleDropdown.tsx b/pkg/ui/workspaces/cluster-ui/src/timeScaleDropdown/timeScaleDropdown.tsx index a5c0adb74b3b..8db97d5f8c38 100644 --- a/pkg/ui/workspaces/cluster-ui/src/timeScaleDropdown/timeScaleDropdown.tsx +++ b/pkg/ui/workspaces/cluster-ui/src/timeScaleDropdown/timeScaleDropdown.tsx @@ -270,6 +270,9 @@ export const getValidOption = ( currentScale: TimeScale, options: TimeScaleOptions, ): TimeScale => { + if (currentScale.key === "Custom") { + return currentScale; + } if (!(currentScale.key in options)) { const firstValidKey = Object.keys(options)[0]; return {