File tree Expand file tree Collapse file tree 1 file changed +19
-0
lines changed
python/pyspark/sql/connect Expand file tree Collapse file tree 1 file changed +19
-0
lines changed Original file line number Diff line number Diff line change 44
44
)
45
45
46
46
import copy
47
+ import os
47
48
import sys
48
49
import random
49
50
import pyarrow as pa
@@ -1732,6 +1733,24 @@ def __getitem__(
1732
1733
)
1733
1734
)
1734
1735
else :
1736
+ # TODO: revisit classic Spark's Dataset.col
1737
+ # if (sparkSession.sessionState.conf.supportQuotedRegexColumnName) {
1738
+ # colRegex(colName)
1739
+ # } else {
1740
+ # ConnectColumn(addDataFrameIdToCol(resolve(colName)))
1741
+ # }
1742
+
1743
+ # validate the column name
1744
+ if os .environ .get ("PYSPARK_VALIDATE_COLUMN_NAME_LEGACY" ) == "1" and not hasattr (
1745
+ self ._session , "is_mock_session"
1746
+ ):
1747
+ from pyspark .sql .connect .types import verify_col_name
1748
+
1749
+ # Try best to verify the column name with cached schema
1750
+ # If fails, fall back to the server side validation
1751
+ if not verify_col_name (item , self ._schema ):
1752
+ self .select (item ).isLocal ()
1753
+
1735
1754
return self ._col (item )
1736
1755
elif isinstance (item , Column ):
1737
1756
return self .filter (item )
You can’t perform that action at this time.
0 commit comments