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

Removing quotes from udf_metadata_key #1026

Merged
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Empty file added .lock_preprocessing
Empty file.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -185,8 +185,8 @@ SELECT ChatGPT('Is this video summary related to Ukraine russia war', text)
CREATE UDF IF NOT EXISTS PredictHouseRent FROM
( SELECT * FROM HomeRentals )
TYPE Ludwig
'predict' 'rental_price'
'time_limit' 120;
PREDICT 'rental_price'
TIME_LIMIT 120;
```

</details>
Expand Down
6 changes: 3 additions & 3 deletions docs/source/reference/evaql/create.rst
Original file line number Diff line number Diff line change
Expand Up @@ -44,9 +44,9 @@ To register an user-defined function by training a predication model.
CREATE UDF IF NOT EXISTS PredictHouseRent FROM
(SELECT * FROM HomeRentals)
TYPE Ludwig
'predict' 'rental_price'
'time_list' 120;
'tune_for_memory' False;
PREDICT 'rental_price'
TIME_LIST 120;
TUNE_FOR_MEMORY False;

CREATE MATERIALIZED VIEW
------------------------
Expand Down
8 changes: 4 additions & 4 deletions docs/source/reference/udfs/model-train.rst
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Training and Finetuning
CREATE UDF IF NOT EXISTS PredictHouseRent FROM
( SELECT sqft, location, rental_price FROM HomeRentals )
TYPE Ludwig
'predict' 'rental_price'
'time_limit' 120;
PREDICT 'rental_price'
TIME_LIMIT 120;

In the above query, you are creating a new customized UDF by automatically training a model from the `HomeRentals` table. The `rental_price` column will be the target column for predication, while `sqft` and `location` are the inputs.

Expand All @@ -24,8 +24,8 @@ You can also simply give all other columns in `HomeRentals` as inputs and let th
CREATE UDF IF NOT EXISTS PredictHouseRent FROM
( SELECT * FROM HomeRentals )
TYPE Ludwig
'predict' 'rental_price'
'time_limit' 120;
PREDICT 'rental_price'
TIME_LIMIT 120;

.. note::

Expand Down
2 changes: 1 addition & 1 deletion evadb/parser/evadb.lark
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ udf_impl: string_literal

udf_metadata: udf_metadata_key udf_metadata_value

udf_metadata_key: string_literal
udf_metadata_key: uid

udf_metadata_value: string_literal | decimal_literal

Expand Down
4 changes: 3 additions & 1 deletion evadb/parser/lark_visitor/_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,9 @@ def create_udf(self, tree):
value = key_value_pair[1]
if isinstance(value, ConstantValueExpression):
value = value.value
metadata.append((key_value_pair[0].value, value)),
# Removing .value from key_value_pair[0] since key is now an ID_LITERAL
# Adding lower() to ensure the key is in lowercase
metadata.append((key_value_pair[0].lower(), value)),

return CreateUDFStatement(
udf_name,
Expand Down
4 changes: 2 additions & 2 deletions test/integration_tests/long/test_model_train.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,8 +60,8 @@ def test_ludwig_automl(self):
CREATE UDF IF NOT EXISTS PredictHouseRent FROM
( SELECT * FROM HomeRentals )
TYPE Ludwig
'predict' 'rental_price'
'time_limit' 120;
PREDICT 'rental_price'
TIME_LIMIT 120;
"""
execute_query_fetch_all(self.evadb, create_predict_udf)

Expand Down
4 changes: 2 additions & 2 deletions test/unit_tests/parser/test_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -662,7 +662,7 @@ def test_create_udf_statement(self):
OUTPUT (Labels NDARRAY STR(10), Bbox NDARRAY UINT8(10, 4))
TYPE Classification
IMPL 'data/fastrcnn.py'
"KEY" "VALUE";
PREDICT "VALUE";
"""

expected_cci = ColConstraintInfo()
Expand Down Expand Up @@ -690,7 +690,7 @@ def test_create_udf_statement(self):
],
"Classification",
None,
[("KEY", "VALUE")],
[("predict", "VALUE")],
)
evadb_statement_list = parser.parse(create_udf_query)
self.assertIsInstance(evadb_statement_list, list)
Expand Down