Repository navigation
[Refactor]: get rid of constant package in our parser and remove some useless code - #18123
Merged
Merged
Conversation
jensenojs
requested review from
XuPeng-SH,
aunjgr,
badboynt1,
daviszhen,
iamlinjunhong,
ouyuanning and
qingxinhome
as code owners
August 14, 2024 09:24
Contributor
Author
|
核心的修改是针对 // before
func NewNumValWithType(value constant.Value, origString string, negative bool, typ P_TYPE) *NumVal {
numVal := &NumVal{
Value: value,
origString: origString,
negative: negative,
ValType: typ,
}
return numVal
}
// now
func NewNumVal[T bool | int64 | uint64 | float64 | string](val T, originString string, negative bool, typ P_TYPE) *NumVal {
nv := &NumVal{
ValType: typ,
negative: negative,
origString: originString,
}
switch v := any(val).(type) {
case bool:
if typ != P_bool {
logutil.Fatalf("unexpected type %T", v)
}
nv.resBool = v
case int64:
if typ != P_int64 {
logutil.Fatalf("unexpected type %T", v)
}
nv.resInt64 = v
case uint64:
if typ != P_uint64 {
logutil.Fatalf("unexpected type %T", v)
}
nv.resUint64 = v
case float64:
if typ != P_float64 {
logutil.Fatalf("unexpected type %T", v)
}
nv.resFloat64 = v
case string:
// do nothing as val already store in origString
default:
logutil.Fatalf("unexpected type %T", v)
}
return nv
} |
Contributor
Author
1 task done
daviszhen
approved these changes
Aug 15, 2024
badboynt1
approved these changes
Aug 15, 2024
iamlinjunhong
approved these changes
Aug 15, 2024
aunjgr
approved these changes
Aug 19, 2024
jensenojs
force-pushed
the
clean-parser
branch
from
August 19, 2024 05:40
6bd9629 to
fcfa498
Compare
Contributor
Author
|
后面如果用go.1.23新出的unique的话, 可能可以再把parser的内存占用给压低下来一些, |
XuPeng-SH
approved these changes
Aug 19, 2024
fengttt
pushed a commit
to fengttt/matrixone
that referenced
this pull request
May 7, 2026
… useless code (matrixorigin#18123) constant.Value is heavy Approved by: @daviszhen, @badboynt1, @iamlinjunhong, @aunjgr, @XuPeng-SH
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


What type of PR is this?
Which issue(s) this PR fixes:
issue #17733
What this PR does / why we need it:
constant.Value is heavy