Skip to content

Commit

Permalink
Fixed compilation warnings. Added explicit checks to eval functions t…
Browse files Browse the repository at this point in the history
…o error out gracefully if insufficient arguments are provided.
  • Loading branch information
scnerd committed Sep 10, 2024
1 parent 385e909 commit 852dd76
Show file tree
Hide file tree
Showing 48 changed files with 294 additions and 63 deletions.
2 changes: 1 addition & 1 deletion src/commands/cmd_add_totals/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{field, ws};
use nom::combinator::map;
use nom::multi::many0;
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def cAddtotals[_: P]: P[AddTotals] = "addtotals" ~ commandOptions ~ field.rep(1).? map {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_bin/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use crate::spl::{aliased_field, field};
use nom::branch::alt;
use nom::combinator::{into, map};
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// // bin [<bin-options>...] <field> [AS <newfield>]
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_collect/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use super::spl::*;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for CollectCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_collect/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::spl::field_list;
use anyhow::anyhow;
use nom::combinator::map;
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def collect[_: P]: P[CollectCommand] = "collect" ~ commandOptions ~ fieldList map {
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_dedup/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_dedup::spl::DedupCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for DedupCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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 @@ -9,7 +9,7 @@ use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt, verify};
use nom::multi::many1;
use nom::sequence::{pair, preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;

#[derive(Debug, PartialEq, Clone, Hash)]
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_eval/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nom::bytes::complete::tag;
use nom::combinator::map;
use nom::multi::separated_list0;
use nom::sequence::separated_pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def eval[_: P]: P[EvalCommand] = "eval" ~ (field ~ "=" ~ expr).rep(sep = ",") map EvalCommand
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_event_stats/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_event_stats::spl::EventStatsCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for EventStatsCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{field_list, stats_call, ws};
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def eventStats[_: P]: P[EventStatsCommand] = ("eventstats" ~ commandOptions ~ statsCall
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_fields/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
use nom::multi::separated_list1;
use nom::sequence::tuple;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// /*
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_fill_null/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_fill_null::spl::FillNullCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for FillNullCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -7,7 +7,7 @@ use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
use nom::multi::many1;
use nom::sequence::{preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def fillNull[_: P]: P[FillNullCommand] = ("fillnull" ~ ("value=" ~~ (doubleQuoted|token)).?
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_format/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_format::spl::FormatCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for FormatCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_format/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::{double_quoted, ws};
use nom::combinator::{map, opt};
use nom::sequence::{pair, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def format[_: P]: P[FormatCommand] = ("format" ~ commandOptions ~ doubleQuoted.rep(6).?) map {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_head/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nom::branch::alt;
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// /**
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_input_lookup/pyspark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for super::spl::InputLookup {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{expr, token, ws};
use nom::bytes::complete::tag_no_case;
use nom::combinator::{map, opt};
use nom::sequence::{preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def inputLookup[_: P]: P[InputLookup] =
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_join/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_join::spl::JoinCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for JoinCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_join/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nom::bytes::complete::tag;
use nom::combinator::map;
use nom::multi::separated_list1;
use nom::sequence::tuple;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
// def join[_: P]: P[JoinCommand] =
// ("join" ~ commandOptions ~ field.rep(min = 1, sep = ",") ~ subSearch) map {
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_lookup/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_lookup::spl::LookupCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for LookupCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_lookup/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use nom::bytes::complete::tag_no_case;
use nom::character::complete::multispace1;
use nom::combinator::{map, opt};
use nom::sequence::{separated_pair, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;

#[derive(Debug, PartialEq, Clone, Hash)]
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_make_results/pyspark.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for super::spl::MakeResults {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -2,7 +2,7 @@ use crate::ast::ast::ParsedCommandOptions;
use crate::ast::python::impl_pyclass;
use crate::commands::spl::{SplCommand, SplCommandOptions};
use nom::combinator::map;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def makeResults[_: P]: P[MakeResults] = ("makeresults" ~ commandOptions) map {
Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_map/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::quoted_search;
use nom::combinator::map;
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def _map[_: P]: P[MapCommand] = "map" ~ quotedSearch ~ commandOptions map {
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_mv_combine/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_mv_combine::spl::MvCombineCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for MvCombineCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{double_quoted, field, ws};
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::sequence::{pair, preceded};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def mvcombine[_: P]: P[MvCombineCommand] = ("mvcombine" ~ ("delim" ~ "=" ~ doubleQuoted).?
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_mv_expand/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_mv_expand::spl::MvExpandCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for MvExpandCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{field, int, ws};
use nom::bytes::complete::{tag, tag_no_case};
use nom::combinator::{map, opt};
use nom::sequence::{pair, preceded};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def mvexpand[_: P]: P[MvExpandCommand] = ("mvexpand" ~ field ~ ("limit" ~ "=" ~ int).?) map {
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_regex/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_regex::spl::RegexCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for RegexCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_regex/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use nom::branch::alt;
use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
// def _regex[_: P]: P[RegexCommand] =
// "regex" ~ (field ~ ("="|"!=").!).? ~ doubleQuoted map RegexCommand.tupled
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_rename/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_rename::spl::RenameCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for RenameCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_rename/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::spl::{aliased_field, ws};
use nom::bytes::complete::tag;
use nom::combinator::map;
use nom::multi::separated_list1;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def rename[_: P]: P[RenameCommand] =
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_return/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_return::spl::ReturnCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for ReturnCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

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 @@ -8,7 +8,7 @@ use nom::bytes::complete::tag;
use nom::combinator::{map, opt};
use nom::multi::many1;
use nom::sequence::{preceded, tuple};
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// def _return[_: P]: P[ReturnCommand] = "return" ~ int.? ~ (
Expand Down
1 change: 1 addition & 0 deletions src/commands/cmd_rex/pyspark.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::commands::cmd_rex::spl::RexCommand;
use crate::pyspark::transpiler::{PipelineTransformState, PipelineTransformer};

impl PipelineTransformer for RexCommand {
#[allow(unused_variables, unreachable_code)]
fn transform(&self, state: PipelineTransformState) -> anyhow::Result<PipelineTransformState> {
let df = state.df;

Expand Down
2 changes: 1 addition & 1 deletion src/commands/cmd_rex/spl.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use crate::commands::spl::{SplCommand, SplCommandOptions};
use crate::spl::double_quoted;
use nom::combinator::map;
use nom::sequence::pair;
use nom::{IResult, Parser};
use nom::IResult;
use pyo3::prelude::*;
//
// // https://docs.splunk.com/Documentation/Splunk/8.2.2/SearchReference/Rex
Expand Down
Loading

0 comments on commit 852dd76

Please sign in to comment.