-
Notifications
You must be signed in to change notification settings - Fork 162
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into examples-doc
- Loading branch information
Showing
143 changed files
with
27,340 additions
and
23 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,47 @@ | ||
package substrait | ||
|
||
import ( | ||
"embed" | ||
"io/fs" | ||
"testing" | ||
|
||
"github.com/stretchr/testify/assert" | ||
"github.com/stretchr/testify/require" | ||
) | ||
|
||
func TestGetSubstraitExtensionsFS(t *testing.T) { | ||
fsArr := []embed.FS{GetSubstraitExtensionsFS(), GetSubstraitFS()} | ||
for _, got := range fsArr { | ||
filePaths, err := ListFiles(got, ".") | ||
require.NoError(t, err) | ||
assert.Greater(t, len(filePaths), 15) | ||
assert.Contains(t, filePaths, "extensions/functions_arithmetic.yaml") | ||
assert.Contains(t, filePaths, "extensions/functions_arithmetic_decimal.yaml") | ||
assert.Contains(t, filePaths, "extensions/functions_datetime.yaml") | ||
} | ||
} | ||
|
||
func TestGetSubstraitTestsFS(t *testing.T) { | ||
got := GetSubstraitTestsFS() | ||
filePaths, err := ListFiles(got, ".") | ||
require.NoError(t, err) | ||
assert.Greater(t, len(filePaths), 3) | ||
assert.Contains(t, filePaths, "tests/cases/arithmetic/add.test") | ||
assert.Contains(t, filePaths, "tests/cases/arithmetic/max.test") | ||
assert.Contains(t, filePaths, "tests/cases/arithmetic_decimal/power.test") | ||
assert.Contains(t, filePaths, "tests/cases/datetime/lt_datetime.test") | ||
} | ||
|
||
func ListFiles(embedFs embed.FS, root string) ([]string, error) { | ||
var files []string | ||
err := fs.WalkDir(embedFs, root, func(path string, d fs.DirEntry, err error) error { | ||
if err != nil { | ||
return err | ||
} | ||
if !d.IsDir() { | ||
files = append(files, path) | ||
} | ||
return nil | ||
}) | ||
return files, err | ||
} |
This file contains 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 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 |
---|---|---|
@@ -1,3 +1,11 @@ | ||
module github.com/substrait-io/substrait | ||
|
||
go 1.22.0 | ||
|
||
require github.com/stretchr/testify v1.9.0 | ||
|
||
require ( | ||
github.com/davecgh/go-spew v1.1.1 // indirect | ||
github.com/pmezard/go-difflib v1.0.0 // indirect | ||
gopkg.in/yaml.v3 v3.0.1 // indirect | ||
) |
This file contains 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 |
---|---|---|
@@ -0,0 +1,10 @@ | ||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= | ||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= | ||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= | ||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= | ||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= | ||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= | ||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= | ||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= | ||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= |
This file contains 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 |
---|---|---|
@@ -0,0 +1,113 @@ | ||
lexer grammar FuncTestCaseLexer; | ||
|
||
import SubstraitLexer; | ||
|
||
options { | ||
caseInsensitive = true; | ||
} | ||
|
||
Whitespace : [ \t\n\r]+ -> channel(HIDDEN) ; | ||
|
||
TripleHash: '###'; | ||
SubstraitScalarTest: 'SUBSTRAIT_SCALAR_TEST'; | ||
SubstraitAggregateTest: 'SUBSTRAIT_AGGREGATE_TEST'; | ||
SubstraitInclude: 'SUBSTRAIT_INCLUDE'; | ||
|
||
FormatVersion | ||
: 'v' DIGIT+ ('.' DIGIT+)? | ||
; | ||
|
||
DescriptionLine | ||
: '# ' ~[\r\n]* '\r'? '\n' | ||
; | ||
|
||
Define: 'DEFINE'; | ||
ErrorResult: '<!ERROR>'; | ||
UndefineResult: '<!UNDEFINED>'; | ||
Overflow: 'OVERFLOW'; | ||
Rounding: 'ROUNDING'; | ||
Error: 'ERROR'; | ||
Saturate: 'SATURATE'; | ||
Silent: 'SILENT'; | ||
TieToEven: 'TIE_TO_EVEN'; | ||
NaN: 'NAN'; | ||
AcceptNulls: 'ACCEPT_NULLS'; | ||
IgnoreNulls: 'IGNORE_NULLS'; | ||
NullHandling: 'NULL_HANDLING'; | ||
SpacesOnly: 'SPACES_ONLY'; | ||
Truncate: 'TRUNCATE'; | ||
|
||
IntegerLiteral | ||
: [+-]? Int | ||
; | ||
|
||
DecimalLiteral | ||
: [+-]? [0-9]+ ('.' [0-9]+)? | ||
; | ||
|
||
FloatLiteral | ||
: [+-]? [0-9]+ ('.' [0-9]*)? ( 'E' [+-]? [0-9]+ )? | ||
| [+-]? 'inf' | ||
| 'snan' | ||
; | ||
|
||
BooleanLiteral | ||
: 'true' | 'false' | ||
; | ||
|
||
fragment FourDigits: [0-9][0-9][0-9][0-9]; | ||
fragment TwoDigits: [0-9][0-9]; | ||
|
||
TimestampTzLiteral | ||
: '\'' FourDigits '-' TwoDigits '-' TwoDigits 'T' TwoDigits ':' TwoDigits ':' TwoDigits ( '.' [0-9]+ )? | ||
[+-] TwoDigits ':' TwoDigits '\'' | ||
; | ||
|
||
TimestampLiteral | ||
: '\'' FourDigits '-' TwoDigits '-' TwoDigits 'T' TwoDigits ':' TwoDigits ':' TwoDigits ( '.' [0-9]+ )? '\'' | ||
; | ||
|
||
TimeLiteral | ||
: '\'' TwoDigits ':' TwoDigits ':' TwoDigits ( '.' [0-9]+ )? '\'' | ||
; | ||
|
||
DateLiteral | ||
: '\'' FourDigits '-' TwoDigits '-' TwoDigits '\'' | ||
; | ||
|
||
PeriodPrefix: 'P'; | ||
TimePrefix: 'T'; | ||
YearPrefix: 'Y'; | ||
MSuffix: 'M'; // used for both months and minutes | ||
DaySuffix: 'D'; | ||
HourSuffix: 'H'; | ||
SecondSuffix: 'S'; | ||
FractionalSecondSuffix: 'F'; | ||
OAngleBracket: Lt; | ||
CAngleBracket: Gt; | ||
|
||
IntervalYearLiteral | ||
: '\'' PeriodPrefix IntegerLiteral YearPrefix (IntegerLiteral MSuffix)? '\'' | ||
| '\'' PeriodPrefix IntegerLiteral MSuffix '\'' | ||
; | ||
|
||
IntervalDayLiteral | ||
: '\'' PeriodPrefix IntegerLiteral DaySuffix (TimePrefix TimeInterval)? '\'' | ||
| '\'' PeriodPrefix TimePrefix TimeInterval '\'' | ||
; | ||
|
||
fragment TimeInterval | ||
: IntegerLiteral HourSuffix (IntegerLiteral MSuffix)? (DecimalLiteral SecondSuffix)? | ||
| IntegerLiteral MSuffix (DecimalLiteral SecondSuffix)? | ||
| DecimalLiteral SecondSuffix | ||
; | ||
|
||
NullLiteral: 'null'; | ||
|
||
StringLiteral | ||
: '\'' ('\\' . | '\'\'' | ~['\\])* '\'' | ||
; | ||
|
||
ColumnName | ||
: 'COL' Int | ||
; |
Oops, something went wrong.