Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
scnerd committed Oct 15, 2024
1 parent dc6504d commit d76a433
Show file tree
Hide file tree
Showing 42 changed files with 379 additions and 396 deletions.
2 changes: 1 addition & 1 deletion src/commands/_sample/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::commands::ConvertCommandRoot;
use crate::spl::ast;
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::parser::{field, token, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::multi::many0;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_add_totals/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::multi::many0;
use nom::sequence::pair;
Expand Down
19 changes: 7 additions & 12 deletions src/commands/cmd_bin/spl.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast;
use crate::spl::ast::{FieldOrAlias, ParsedCommandOptions, TimeSpan};
use crate::spl::ast::*;
use crate::spl::parser::{aliased_field, field};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::combinator::{into, map};
use nom::sequence::pair;
Expand Down Expand Up @@ -59,12 +58,8 @@ impl TryFrom<ParsedCommandOptions> for BinCommandOptions {

fn try_from(value: ParsedCommandOptions) -> Result<Self, Self::Error> {
Ok(Self {
span: value.get_span_option("span")?.map(|span| match span {
ast::SplSpan::TimeSpan(s) => s,
}),
min_span: value.get_span_option("minspan")?.map(|span| match span {
ast::SplSpan::TimeSpan(s) => s,
}),
span: value.get_span_option("span")?,
min_span: value.get_span_option("minspan")?,
bins: value.get_int_option("bins")?,
start: value.get_int_option("start")?,
end: value.get_int_option("end")?,
Expand Down Expand Up @@ -122,12 +117,12 @@ mod tests {
Ok((
"",
BinCommand {
field: _alias("bar", ast::Field::from("foo")).into(),
span: Some(ast::TimeSpan {
field: _alias("bar", Field::from("foo")).into(),
span: Some(TimeSpan {
value: 30,
scale: "minutes".into()
}),
min_span: Some(ast::TimeSpan {
min_span: Some(TimeSpan {
value: 5,
scale: "minutes".into()
}),
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_collect/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::field_list0;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use anyhow::anyhow;
use nom::combinator::map;
use nom::sequence::pair;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_convert/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field, token, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::multi::many0;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_dedup/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast;
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt, verify};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_eval/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, Field, ParsedCommandOptions};
use crate::spl::parser::{comma_separated_list0, expr, field, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag;
use nom::combinator::map;
use nom::sequence::separated_pair;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_event_stats/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, Field, ParsedCommandOptions};
use crate::spl::parser::{field_list0, stats_call, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_fields/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field_list1, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_fill_null/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{double_quoted, field, token, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::combinator::{into, map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_format/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::parser::{double_quoted, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::{map, opt};
use nom::sequence::{pair, tuple};
use nom::IResult;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_head/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{BoolValue, Expr, ParsedCommandOptions};
use crate::spl::parser::{bool_, expr, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_input_lookup/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, ParsedCommandOptions};
use crate::spl::parser::{expr, token, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_join/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions, Pipeline};
use crate::spl::parser::{field_list1, sub_search};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::sequence::tuple;
use nom::IResult;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_lookup/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{FieldLike, ParsedCommandOptions};
use crate::spl::parser::{aliased_field, comma_or_space_separated_list1, field, token, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag_no_case;
use nom::character::complete::multispace1;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_make_results/spl.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::IResult;
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_map/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{ParsedCommandOptions, Pipeline};
use crate::spl::parser::quoted_search;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::sequence::pair;
use nom::IResult;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_multi_search/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{ParsedCommandOptions, Pipeline};
use crate::spl::parser::{sub_search, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::multi::many_m_n;
use nom::IResult;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_mv_combine/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{double_quoted, field, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::sequence::{pair, preceded};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_mv_expand/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::sequence::{pair, preceded};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_rare/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field_list0, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_regex/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{double_quoted, field, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_rename/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Alias, ParsedCommandOptions};
use crate::spl::parser::{aliased_field, comma_separated_list1};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::IResult;
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_return/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast;
use crate::spl::ast::{FieldOrAlias, IntValue, ParsedCommandOptions};
use crate::spl::parser::{field, field_and_value, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_rex/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::parser::double_quoted;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use anyhow::ensure;
use nom::combinator::map;
use nom::sequence::pair;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_s_path/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::parser::{field, string, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_search/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use crate::spl::ast::{Expr, ParsedCommandOptions};
use crate::spl::operators;
use crate::spl::operators::OperatorSymbolTrait;
use crate::spl::parser::{combine_all_expressions, comma_or_space_separated_list1, expr};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::tag_no_case;
use nom::character::complete::{multispace0, multispace1};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_sort/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, ParsedCommandOptions};
use crate::spl::parser::{comma_separated_list1, expr, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_stats/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, Field, ParsedCommandOptions};
use crate::spl::parser::{bool_, field_list1, stats_call, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::sequence::{pair, preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_stream_stats/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, Field, ParsedCommandOptions};
use crate::spl::parser::{field_list0, stats_call, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_t_stats/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::spl::parser::{
comma_or_space_separated_list1, field, field_in, logical_expression, space_separated_list1,
time_span, token, ws,
};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::branch::alt;
use nom::bytes::complete::{tag, tag_no_case};
use nom::character::complete::multispace1;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_table/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::field_list1;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::IResult;
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_tail/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::ParsedCommandOptions;
use crate::spl::parser::int;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::IResult;
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_top/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Field, ParsedCommandOptions};
use crate::spl::parser::{field_list1, int, ws};
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_where/spl.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::ast::{Expr, ParsedCommandOptions};
use crate::spl::parser::logical_expression;
use crate::spl::python::impl_pyclass;
use crate::spl::python::*;
use nom::combinator::map;
use nom::IResult;
use pyo3::prelude::*;
Expand Down
2 changes: 1 addition & 1 deletion src/functions/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ impl TryFrom<ast::Expr> for String {
ast::Constant::SnapTime(_) => {
bail!("No default conversion from {:?} to String", const_)
}
ast::Constant::SplSpan(_) => {
ast::Constant::TimeSpan(_) => {
bail!("No default conversion from {:?} to String", const_)
}
ast::Constant::Field(ast::Field(val)) => Ok(val.clone()),
Expand Down
6 changes: 3 additions & 3 deletions src/pyspark/transpiler/expr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -154,9 +154,9 @@ impl TryFrom<ast::Expr> for Expr {
ast::Constant::SnapTime(ast::SnapTime { .. }) => {
bail!("Unimplemented value in field-in rhs: {:?}", const_)
}
ast::Constant::SplSpan(ast::SplSpan::TimeSpan(ast::TimeSpan {
..
})) => bail!("Unimplemented value in field-in rhs: {:?}", const_),
ast::Constant::TimeSpan(ast::TimeSpan { .. }) => {
bail!("Unimplemented value in field-in rhs: {:?}", const_)
}
ast::Constant::Field(ast::Field(val)) => {
Ok(column_like!([c.clone()] == [Raw::from(val.clone())]))
}
Expand Down
Loading

0 comments on commit d76a433

Please sign in to comment.