Skip to content

Commit d5b0b3a

Browse files
craig[bot]normanchenn
andcommitted
Merge #144259
144259: jsonpath: clean up JSONPath TODOs r=normanchenn a=normanchenn This commit updates many JSONPath-related TODOs with links to their relevant issues, and removes some unnecessary ones. Epic: None Release note: None Co-authored-by: Norman Chen <[email protected]>
2 parents b5e5b88 + 09c6094 commit d5b0b3a

File tree

13 files changed

+13
-16
lines changed

13 files changed

+13
-16
lines changed

pkg/sql/conn_executor_exec.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -58,8 +58,8 @@ import (
5858
"github.com/cockroachdb/cockroach/pkg/util/errorutil/unimplemented"
5959
"github.com/cockroachdb/cockroach/pkg/util/fsm"
6060
"github.com/cockroachdb/cockroach/pkg/util/hlc"
61-
// TODO(normanchenn): temporarily import the parser here to ensure that
62-
// init() is called.
61+
// This import is needed here to properly inject tree.ValidateJSONPath from
62+
// pkg/util/jsonpath/parser/parse.go.
6363
_ "github.com/cockroachdb/cockroach/pkg/util/jsonpath/parser"
6464
"github.com/cockroachdb/cockroach/pkg/util/log"
6565
"github.com/cockroachdb/cockroach/pkg/util/log/eventpb"

pkg/sql/distsql_physical_planner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -358,7 +358,7 @@ func (v *distSQLExprCheckVisitor) VisitPre(expr tree.Expr) (recurse bool, newExp
358358
return false, expr
359359
}
360360
case *tree.DJsonpath:
361-
// TODO(normanchenn): We currently do not have an encoding for jsonpath
361+
// TODO(#22513): We currently do not have an encoding for jsonpath
362362
// thus do not support it within distsql
363363
v.err = newQueryNotSupportedErrorf("jsonpath %s cannot be executed with distsql", t)
364364
return false, expr

pkg/sql/opt/memo/interner.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -910,7 +910,7 @@ func (h *hasher) IsDatumEqual(l, r tree.Datum) bool {
910910
}
911911
return len(lt.Array) != 0 || h.IsTypeEqual(ltyp, rtyp)
912912
case *tree.DJsonpath:
913-
// TODO(normanchenn): Workaround until we allow jsonpath encoding.
913+
// TODO(#22513): Workaround until we allow jsonpath encoding.
914914
rt := r.(*tree.DJsonpath)
915915
return h.IsStringEqual(string(*lt), string(*rt))
916916
default:

pkg/sql/randgen/datum.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -582,7 +582,7 @@ func randJSONSimpleDepth(rng *rand.Rand, depth int) json.JSON {
582582

583583
const charSet = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"
584584

585-
// TODO(normanchenn): Add support for more complex jsonpath queries.
585+
// TODO(#22513): Add support for more complex jsonpath queries.
586586
func randJsonpath(rng *rand.Rand) string {
587587
var parts []string
588588
depth := 1 + rng.Intn(20)

pkg/sql/randgen/type.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ func init() {
4747
// Don't include FLOAT4 due to known bugs that cause test failures.
4848
// See #73743 and #48613.
4949
case oidext.T_jsonpath:
50-
// TODO(normanchenn): Temporarily don't include Jsonpath
50+
// TODO(#22513): Temporarily don't include Jsonpath
5151
case oid.T_anyarray, oid.T_oidvector, oid.T_int2vector:
5252
// Include these.
5353
SeedTypes = append(SeedTypes, typ)

pkg/sql/randgen/types_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ loop:
3434
// These are not included on purpose.
3535
continue loop
3636
case types.JsonpathFamily:
37-
// TODO(normanchenn): Don't include jsonpath in randomized tests yet.
37+
// TODO(#22513): Don't include jsonpath in randomized tests yet.
3838
continue loop
3939
}
4040
noFamilyRepresentative[familyID] = struct{}{}

pkg/sql/scanner/jsonpath_scan.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ func (s *JSONPathScanner) Scan(lval ScanSymType) {
2323
return
2424
}
2525

26-
// TODO(normanchenn): We still need to handle $.Xe where X is any digit.
26+
// TODO(#144258): We still need to handle $.Xc where X is any digit and c is any character.
2727
switch ch {
2828
case '$':
2929
// Root path ($)
@@ -129,7 +129,7 @@ func isIdentMiddle(ch int) bool {
129129

130130
// scanIdent is similar to Scanner.scanIdent, but uses Jsonpath tokens.
131131
func (s *JSONPathScanner) scanIdent(lval ScanSymType) {
132-
// TODO(normanchenn): Allow any case for specific identifiers (strict, lax, to)
132+
// TODO(#144255): Allow any case for specific identifiers (strict, lax, to)
133133
s.normalizeIdent(lval, isIdentMiddle, false /* toLower */)
134134
lval.SetID(lexbase.GetKeywordID(lval.Str()))
135135
}

pkg/sql/sem/eval/math.go

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ func DecimalPow(ctx *apd.Context, d, x, y *apd.Decimal) error {
5353
d.Set(e)
5454
return nil
5555
}
56-
// TODO(normanchenn): do something with the condition.
5756
_, err = ctx.Pow(d, x, y)
5857
if err != nil {
5958
return err

pkg/sql/sem/tree/constant.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ var (
552552
types.VarBitArray,
553553
types.AnyTuple,
554554
types.AnyTupleArray,
555-
// TODO(normanchenn): Reevaluate conversions for jsonpath array.
555+
// TODO(#22513): Reevaluate conversions for jsonpath array.
556556
}
557557
// StrValAvailBytes is the set of types convertible to byte array.
558558
StrValAvailBytes = []*types.T{types.Bytes, types.Uuid, types.String, types.AnyEnum}

pkg/sql/sem/tree/constant_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -726,7 +726,7 @@ func TestStringConstantResolveAvailableTypes(t *testing.T) {
726726
continue
727727
}
728728

729-
// TODO(normanchenn): Skip JsonpathFamily for now, since it will resolve to a
729+
// TODO(#22513): Skip JsonpathFamily for now, since it will resolve to a
730730
// string but in the future we don't want to.
731731
if availType.Family() == types.JsonpathFamily {
732732
continue

0 commit comments

Comments
 (0)