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

Make it easier to create ScalarValue from String and &str #8380

Closed
alamb opened this issue Nov 30, 2023 · 3 comments · Fixed by #8411
Closed

Make it easier to create ScalarValue from String and &str #8380

alamb opened this issue Nov 30, 2023 · 3 comments · Fixed by #8411
Labels
enhancement New feature or request good first issue Good for newcomers

Comments

@alamb
Copy link
Contributor

alamb commented Nov 30, 2023

Is your feature request related to a problem or challenge?

Someone reported on Discord: https://discord.com/channels/885562378132000778/1166447479609376850/1179899297483980941

currently when I'm trying to pass a String into ScalarValue::from(), the compiler is telling me that the trait bound ScalarValue: Fromstd::string::String is not satisfied

Let's make it easier for people to get started with DataFusioN!

Describe the solution you'd like

Make it so the following code works

let scalar = ScalarValue::from("foo");
let scalar = ScalarValue::from("foo".to_string());

Describe alternatives you've considered

No response

Additional context

I think this is a good first issue as it is well specified and would be a nice usability improvement

Related PR: #8378 (it would be nice to add an example of creating ScalarValue from a string there too)

@alamb alamb added enhancement New feature or request good first issue Good for newcomers labels Nov 30, 2023
@QuenKar
Copy link
Contributor

QuenKar commented Dec 1, 2023

Hi, I want to do this issue

@QuenKar
Copy link
Contributor

QuenKar commented Dec 1, 2023

I met some question in scalar.rs. when adding a test case for it, it can't compiled in vscode. It seems to have something to do with parquet.

error[E0433]: failed to resolve: use of undeclared crate or module `parquet`
   --> datafusion/common/src/file_options/mod.rs:302:9
    |
302 |     use parquet::{
    |         ^^^^^^^ use of undeclared crate or module `parquet`

error[E0432]: unresolved import `super::parquet_writer`
   --> datafusion/common/src/file_options/mod.rs:316:17
    |
316 |     use super::{parquet_writer::ParquetWriterOptions, StatementOptions};
    |                 ^^^^^^^^^^^^^^ could not find `parquet_writer` in `super`

error[E0599]: no variant or associated item named `PARQUET` found for enum `file_type::FileType` in the current scope
   --> datafusion/common/src/file_options/file_type.rs:120:35
    |
45  | pub enum FileType {
    | ----------------- variant or associated item `PARQUET` not found for this enum
...
120 |             ("parquet", FileType::PARQUET),
    |                                   ^^^^^^^ variant or associated item not found in `FileType`

error[E0599]: no variant or associated item named `PARQUET` found for enum `file_type::FileType` in the current scope
   --> datafusion/common/src/file_options/file_type.rs:121:35
    |
45  | pub enum FileType {
    | ----------------- variant or associated item `PARQUET` not found for this enum
...
121 |             ("PARQUET", FileType::PARQUET),
    |                                   ^^^^^^^ variant or associated item not found in `FileType`

error[E0425]: cannot find function `parquet_test_data` in this scope
   --> datafusion/common/src/test_util.rs:292:19
    |
161 | pub fn arrow_test_data() -> String {
    | ---------------------------------- similarly named function `arrow_test_data` defined here
...
292 |         let res = parquet_test_data();
    |                   ^^^^^^^^^^^^^^^^^ help: a function with a similar name exists: `arrow_test_data`

Some errors have detailed explanations: E0425, E0432, E0433, E0599.
For more information about an error, try `rustc --explain E0425`.
error: could not compile `datafusion-common` (lib test) due to 5 previous errors

@alamb
Copy link
Contributor Author

alamb commented Dec 1, 2023

I met some question in scalar.rs. when adding a test case for it, it can't compiled in vscode. It seems to have something to do with parquet.

THanks @QuenKar -- I think this is #8250 (also noticed by @jayzhan211 )

Here is the workaround: #8250 (comment)

It would be great for someone to fix this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants