You are viewing a plain text version of this content. The canonical link for it is here.
Posted to github@arrow.apache.org by GitBox <gi...@apache.org> on 2020/09/04 14:53:25 UTC

[GitHub] [arrow] wqc200 commented on a change in pull request #8033: ARROW-9837: [Rust][DataFusion] Add provider for variable

wqc200 commented on a change in pull request #8033:
URL: https://github.com/apache/arrow/pull/8033#discussion_r483668849



##########
File path: rust/datafusion/src/variable/user_defined.rs
##########
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! User defined variable provider
+
+use crate::error::Result;
+use crate::logicalplan::ScalarValue;
+use crate::variable::VarProvider;
+
+/// user defined variable
+pub struct UserDefinedVar {}

Review comment:
       Yes, I move it to test dir

##########
File path: rust/datafusion/src/variable/system.rs
##########
@@ -0,0 +1,40 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+//! System variable provider
+
+use crate::error::Result;
+use crate::logicalplan::ScalarValue;
+use crate::variable::VarProvider;
+
+/// System variable
+pub struct SystemVar {}
+
+impl SystemVar {
+    /// new system variable
+    pub fn new() -> Self {
+        Self {}
+    }
+}
+
+impl VarProvider for SystemVar {
+    /// get system variable value
+    fn get_value(&self, var_names: Vec<String>) -> Result<ScalarValue> {
+        let s = format!("{}-{}", "test".to_string(), var_names.concat());

Review comment:
       Yes, I move it to test dir




----------------------------------------------------------------
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.

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