eliaperantoni commented on code in PR #1738:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1738#discussion_r1967128017


##########
src/ast/value.rs:
##########
@@ -26,10 +26,25 @@ use bigdecimal::BigDecimal;
 #[cfg(feature = "serde")]
 use serde::{Deserialize, Serialize};
 
-use crate::ast::Ident;
+use crate::{ast::Ident, tokenizer::Span};
 #[cfg(feature = "visitor")]
 use sqlparser_derive::{Visit, VisitMut};
 
+/// Primitive SQL values such as number and string
+#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)]
+#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))]
+#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))]
+pub struct ValueWrapper {
+    pub value: Value,
+    pub span: Span,
+}

Review Comment:
   Do we want `Span` to influence `ValueWrapper`'s implementations of 
`PartialEq`, `PartialOrd`, and `Hash`?



##########
tests/sqlparser_bigquery.rs:
##########
@@ -50,112 +50,146 @@ fn parse_literal_string() {
     let select = dialect.verified_only_select(sql);
     assert_eq!(12, select.projection.len());
     assert_eq!(
-        &Expr::Value(Value::SingleQuotedString("single".into())),
+        &Expr::Value(
+            Value::SingleQuotedString("single".into())
+                .with_span(Span::new(Location::new(1, 7), Location::new(1, 
12)))
+        ),

Review Comment:
   Perhaps there's an automated way to do this, instead of manually writing 
locations?
   
   I had to do something similar in one of my DataFusion PRs:
   
   
https://github.com/eliaperantoni/datafusion/blob/7265bd2d4d6fd86d34ce69672739b10aa4995b8c/datafusion/sql/tests/cases/diagnostic.rs#L132-L140



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to