This repository was archived by the owner on Feb 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 232
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,6 +13,7 @@ import ( | |
| "github.com/featurebasedb/featurebase/v3/dax" | ||
| "github.com/featurebasedb/featurebase/v3/pql" | ||
| "github.com/featurebasedb/featurebase/v3/sql3" | ||
| "github.com/featurebasedb/featurebase/v3/sql3/parser" | ||
| "github.com/featurebasedb/featurebase/v3/sql3/planner/types" | ||
| "github.com/pkg/errors" | ||
| ) | ||
|
|
@@ -253,9 +254,9 @@ func (i *insertRowIter) Next(ctx context.Context) (types.Row, error) { | |
| } | ||
|
|
||
| case pilosa.FieldTypeTime: | ||
| row.Time = qbatchTime | ||
| switch v := eval.(type) { | ||
| case []int64: | ||
| row.Time = qbatchTime | ||
| uint64s := make([]uint64, len(v)) | ||
| for i := range v { | ||
| if v[i] < 0 { | ||
|
|
@@ -264,6 +265,59 @@ func (i *insertRowIter) Next(ctx context.Context) (types.Row, error) { | |
| uint64s[i] = uint64(v[i]) | ||
| } | ||
| row.Values[posVals[idx]] = uint64s | ||
|
|
||
| case []interface{}: | ||
| // it's a tuple, check length | ||
| if len(v) != 2 { | ||
| return nil, sql3.NewErrUnexpectedTimeQuantumTupleLength(0, 0, columnName, rowNumber+1, v, len(v)) | ||
| } | ||
|
|
||
| tupleType, ok := iv.Type().(*parser.DataTypeTuple) | ||
| if !ok { | ||
| return nil, sql3.NewErrInternalf("unexpected tuple type '%T'", v[0]) | ||
| } | ||
|
|
||
| // first member must be a timestamp or coercable as one | ||
| cval, err := coerceValue(tupleType.Members[0], parser.NewDataTypeTimestamp(), v[0], parser.Pos{Line: 0, Column: 0}) | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. do we not have a valid position we can use here? also... should the timestamp be the first value? my intuition would have been that the timestamp was the last value in the tuple. did we specify this anywhere? is there a thing we're doing this to be compatible with?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Completely arbitrary. If someone can point to prior art where it's the other way, happy to change it. |
||
| if err != nil { | ||
| return nil, err | ||
| } | ||
| tval, ok := cval.(time.Time) | ||
| if !ok { | ||
| return nil, sql3.NewErrInternalf("unexpected tuple time value type '%T'", v[0]) | ||
| } | ||
| var qrowTime fbbatch.QuantizedTime | ||
| qrowTime.Set(tval) | ||
| row.Time = qrowTime | ||
|
|
||
| // second member must be a set of the correct type | ||
| targetCol := i.targetColumns[idx] | ||
|
|
||
| switch targetCol.Type().(type) { | ||
| case *parser.DataTypeStringSetQuantum: | ||
| sval, ok := v[1].([]string) | ||
| if !ok { | ||
| return nil, sql3.NewErrInternalf("string set type expected '%T'", v[1]) | ||
| } | ||
| row.Values[posVals[idx]] = sval | ||
|
|
||
| case *parser.DataTypeIDSetQuantum: | ||
| sval, ok := v[1].([]int64) | ||
| if !ok { | ||
| return nil, sql3.NewErrInternalf("id set type expected '%T'", v[1]) | ||
| } | ||
| uint64s := make([]uint64, len(sval)) | ||
| for i := range sval { | ||
| if sval[i] < 0 { | ||
| return nil, sql3.NewErrInternalf("converting negative slice value to uint64: %d", sval[i]) | ||
| } | ||
| uint64s[i] = uint64(sval[i]) | ||
| } | ||
| row.Values[posVals[idx]] = uint64s | ||
|
|
||
| default: | ||
| return nil, sql3.NewErrInternalf("unexpected set type '%T'", targetCol.Type()) | ||
| } | ||
| default: | ||
| row.Values[posVals[idx]] = eval | ||
| } | ||
|
|
||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unexpected Time Quantum Tuple Length
value
%vout of rangeI don't feel like these describe the same problem?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops - copy pasta