Skip to content

Conversation

@jdye64
Copy link
Collaborator

@jdye64 jdye64 commented Jul 20, 2022

We were previously "catching" all encountered ScalarValue variants in a single arm and panic-ing. This is the first step in not doing that.

@jdye64 jdye64 added the datafusion Related to work in DataFusion label Jul 20, 2022
@jdye64 jdye64 self-assigned this Jul 20, 2022
literal_value = None
elif literal_type == "IntervalDayTime":
literal_type = SqlTypeName.INTERVAL
literal_value = rex.getIntervalDayTimeValue()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What kind of literal_value is returned in this case? Is it a string or an integer?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i64

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In that case we might have to update the logic in sql to python value, since the conversion there seems to assume it's a string and do some computation instead.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think int should be fine as long as we update the logic here as well: https://github.com/dask-contrib/dask-sql/blob/datafusion-sql-planner/dask_sql/mappings.py#L131.

I'm surprised all tests passed. Maybe none actually test the case where an interval type is passed?

@jdye64
Copy link
Collaborator Author

jdye64 commented Jul 21, 2022 via email

@jdye64 jdye64 marked this pull request as ready for review August 4, 2022 16:03
@jdye64
Copy link
Collaborator Author

jdye64 commented Aug 4, 2022

@ayushdg can we merge this one now?

@ayushdg
Copy link
Collaborator

ayushdg commented Aug 4, 2022

@ayushdg can we merge this one now?

Could we add some tests around interval types or move the interval handling to a followup pr if the other functionality is needed. There's still some issues to iron out there, and statements like SELECT INTERVAL '3 days' as t fail.

@codecov-commenter
Copy link

codecov-commenter commented Aug 8, 2022

Codecov Report

❗ No coverage uploaded for pull request base (datafusion-sql-planner@2866fab). Click here to learn what that means.
The diff coverage is n/a.

@@                    Coverage Diff                    @@
##             datafusion-sql-planner     #638   +/-   ##
=========================================================
  Coverage                          ?   65.89%           
=========================================================
  Files                             ?       73           
  Lines                             ?     3633           
  Branches                          ?      752           
=========================================================
  Hits                              ?     2394           
  Misses                            ?     1091           
  Partials                          ?      148           

📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more

@jdye64
Copy link
Collaborator Author

jdye64 commented Aug 8, 2022

@ayushdg the failures are unrelated and are part of codecov issues that @charlesbluca is working on I. #666. Does this PR look good to you know with the changes?

Copy link
Collaborator

@ayushdg ayushdg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes lgtm! The other interval types can be added in a followup pr.

}
}

#[pyo3(name = "getIntervalDayTimeValue")]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should also add methods to extract this information from interval yearMonth and MonthDayNano types


elif sql_type == SqlTypeName.INTERVAL_DAY:
return timedelta(days=literal_value[0], milliseconds=literal_value[1])
elif sql_type == SqlTypeName.INTERVAL:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above

@ayushdg ayushdg merged commit 40073a3 into dask-contrib:datafusion-sql-planner Aug 8, 2022
@jdye64 jdye64 deleted the datafusion-expand-scalarvalue-catchall branch March 16, 2023 13:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

datafusion Related to work in DataFusion

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants