Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Time type precision check failed #93

Open
kd97 opened this issue Sep 28, 2022 · 0 comments
Open

Time type precision check failed #93

kd97 opened this issue Sep 28, 2022 · 0 comments

Comments

@kd97
Copy link

kd97 commented Sep 28, 2022

Hi, I noticed that the time type parsed from calcite will have a precision value check before generating substrait plan.

case TIME -> {
if (type.getPrecision() != 6) {
throw new UnsupportedOperationException(
"unsupported time precision " + type.getPrecision());
}
yield creator.TIME;
}
case TIMESTAMP -> {
if (type.getPrecision() != 6) {
throw new UnsupportedOperationException(
"unsupported timestamp precision " + type.getPrecision());
}
yield creator.TIMESTAMP;
}
case TIMESTAMP_WITH_LOCAL_TIME_ZONE -> {
if (type.getPrecision() != 6) {
throw new UnsupportedOperationException(
"unsupported timestamptz precision " + type.getPrecision());
}
yield creator.TIMESTAMP_TZ;
}

I added some timestamp related sql tests(sql ddl like "CREATE TABLE test(col_date DATE, col_time TIME(6), col_timestamp TIMESTAMP(6));")and found time type precision value parsed from calcite will not be greater than three, will always make this check fail. Is there a bug in the use of time types?

unsupported timestamp precision 3
java.lang.UnsupportedOperationException: unsupported timestamp precision 3
	at io.substrait.isthmus.TypeConverter.convert(TypeConverter.java:77)
	at io.substrait.isthmus.TypeConverter.convert(TypeConverter.java:109)
	at io.substrait.isthmus.TypeConverter.toNamedStruct(TypeConverter.java:37)
	at io.substrait.isthmus.SubstraitRelVisitor.visit(SubstraitRelVisitor.java:76)
	at io.substrait.isthmus.SubstraitRelVisitor.visit(SubstraitRelVisitor.java:32)
	at io.substrait.isthmus.RelNodeVisitor.reverseAccept(RelNodeVisitor.java:85)
	at io.substrait.isthmus.SubstraitRelVisitor.apply(SubstraitRelVisitor.java:319)
	at io.substrait.isthmus.SubstraitRelVisitor.visit(SubstraitRelVisitor.java:122)
	at io.substrait.isthmus.SubstraitRelVisitor.visit(SubstraitRelVisitor.java:32)
	at io.substrait.isthmus.RelNodeVisitor.reverseAccept(RelNodeVisitor.java:95)
	at io.substrait.isthmus.SubstraitRelVisitor.apply(SubstraitRelVisitor.java:319)
	at io.substrait.isthmus.SubstraitRelVisitor.convert(SubstraitRelVisitor.java:340)
	at io.substrait.isthmus.SubstraitRelVisitor.convert(SubstraitRelVisitor.java:332)
	at io.substrait.isthmus.SqlToSubstrait.lambda$executeInner$0(SqlToSubstrait.java:120)
	at java.base/java.lang.Iterable.forEach(Iterable.java:75)
	at io.substrait.isthmus.SqlToSubstrait.executeInner(SqlToSubstrait.java:113)
	at io.substrait.isthmus.SqlToSubstrait.execute(SqlToSubstrait.java:81)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant